Browse Source

Fix build on older compilers (used on OSX)

tags/1.9.4
falkTX 10 years ago
parent
commit
79e32745e0
11 changed files with 88 additions and 31 deletions
  1. +1
    -1
      source/Makefile.mk
  2. +2
    -2
      source/backend/engine/CarlaEngineBridge.cpp
  3. +10
    -6
      source/backend/engine/CarlaEngineGraph.cpp
  4. +26
    -8
      source/backend/plugin/BridgePlugin.cpp
  5. +1
    -1
      source/backend/plugin/JucePlugin.cpp
  6. +3
    -1
      source/modules/jackbridge/JackBridge2.cpp
  7. +1
    -1
      source/utils/CarlaBridgeUtils.hpp
  8. +2
    -2
      source/utils/CarlaLv2Utils.hpp
  9. +17
    -3
      source/utils/CarlaRingBuffer.hpp
  10. +9
    -2
      source/utils/LinkedList.hpp
  11. +16
    -4
      source/utils/Lv2AtomRingBuffer.hpp

+ 1
- 1
source/Makefile.mk View File

@@ -108,7 +108,7 @@ ifeq ($(TESTBUILD),true)
BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
BASE_FLAGS += -Wfloat-equal -Wpointer-arith -Wabi -Winit-self -Wuninitialized #-Wstrict-overflow=5
ifeq ($(CC),clang)
BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
# BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
# BASE_FLAGS += -Weverything
else
BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations


+ 2
- 2
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -114,7 +114,7 @@ struct BridgeRtControl : public CarlaRingBuffer<StackBuffer> {
jackbridge_shm_init(shm);
}

~BridgeRtControl() noexcept
~BridgeRtControl() noexcept override
{
// should be cleared by now
CARLA_SAFE_ASSERT(data == nullptr);
@@ -175,7 +175,7 @@ struct BridgeNonRtControl : public CarlaRingBuffer<BigStackBuffer> {
jackbridge_shm_init(shm);
}

~BridgeNonRtControl() noexcept
~BridgeNonRtControl() noexcept override
{
// should be cleared by now
CARLA_SAFE_ASSERT(data == nullptr);


+ 10
- 6
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -93,10 +93,18 @@ RackGraph::Audio::Audio() noexcept
connectedIn1(),
connectedIn2(),
connectedOut1(),
connectedOut2(),
inBuf{0, 0},
connectedOut2()
#ifdef CARLA_PROPER_CPP11_SUPPORT
, inBuf{0, 0},
inBufTmp{0, 0},
outBuf{0, 0} {}
#else
{
inBuf[0] = inBuf[1] = nullptr;
inBufTmp[0] = inBufTmp[1] = nullptr;
outBuf[0] = outBuf[1] = nullptr;
}
#endif

// -----------------------------------------------------------------------
// RackGraph MIDI
@@ -149,10 +157,6 @@ RackGraph::RackGraph(const uint32_t bufferSize, const uint32_t ins, const uint32
audio(),
midi()
{
audio.inBuf[0] = audio.inBuf[1] = nullptr;
audio.inBufTmp[0] = audio.inBufTmp[1] = nullptr;
audio.outBuf[0] = audio.outBuf[1] = nullptr;

setBufferSize(bufferSize);
}



+ 26
- 8
source/backend/plugin/BridgePlugin.cpp View File

@@ -106,8 +106,14 @@ struct BridgeAudioPool {
BridgeAudioPool() noexcept
: filename(),
data(nullptr),
size(0),
shm(shm_t_INIT) {}
size(0)
#ifdef CARLA_PROPER_CPP11_SUPPORT
, shm(shm_t_INIT) {}
#else
{
carla_shm_init(shm);
}
#endif

~BridgeAudioPool() noexcept
{
@@ -159,10 +165,16 @@ struct BridgeRtControl : public CarlaRingBuffer<StackBuffer> {

BridgeRtControl()
: filename(),
data(nullptr),
shm(shm_t_INIT) {}
data(nullptr)
#ifdef CARLA_PROPER_CPP11_SUPPORT
, shm(shm_t_INIT) {}
#else
{
carla_shm_init(shm);
}
#endif

~BridgeRtControl()
~BridgeRtControl() noexcept override
{
// should be cleared by now
CARLA_SAFE_ASSERT(data == nullptr);
@@ -237,10 +249,16 @@ struct BridgeNonRtControl : public CarlaRingBuffer<BigStackBuffer> {
BridgeNonRtControl() noexcept
: mutex(),
filename(),
data(nullptr),
shm(shm_t_INIT) {}
data(nullptr)
#ifdef CARLA_PROPER_CPP11_SUPPORT
, shm(shm_t_INIT) {}
#else
{
carla_shm_init(shm);
}
#endif

~BridgeNonRtControl() noexcept
~BridgeNonRtControl() noexcept override
{
// should be cleared by now
CARLA_SAFE_ASSERT(data == nullptr);


+ 1
- 1
source/backend/plugin/JucePlugin.cpp View File

@@ -247,7 +247,7 @@ public:

{
const ScopedSingleProcessLocker spl(this, true);
fInstance->setStateInformation(data, dataSize);
fInstance->setStateInformation(data, static_cast<int>(dataSize));
}

#ifdef BUILD_BRIDGE


+ 3
- 1
source/modules/jackbridge/JackBridge2.cpp View File

@@ -101,8 +101,10 @@ bool jackbridge_sem_post(void* sem) noexcept

bool jackbridge_sem_timedwait(void* sem, int secs) noexcept
{
CARLA_SAFE_ASSERT_RETURN(secs > 0, false);

#ifdef CARLA_OS_MAC
alarm(secs);
alarm(static_cast<uint>(secs));
try {
return (sem_wait((sem_t*)sem) == 0);
} CARLA_SAFE_EXCEPTION_RETURN("sem_wait", false);


+ 1
- 1
source/utils/CarlaBridgeUtils.hpp View File

@@ -115,7 +115,7 @@ struct BridgeSemaphore {

// needs to be 64bit aligned
struct BridgeTimeInfo {
bool playing : 64; // 8 bytes
uint64_t playing;
uint64_t frame;
uint64_t usecs;
uint32_t valid;


+ 2
- 2
source/utils/CarlaLv2Utils.hpp View File

@@ -26,7 +26,7 @@
#endif

// disable -Wdocumentation for LV2 headers
#if defined(__clang__)
#if defined(__clang__) && (__clang_major__ * 100 + __clang_minor__) > 300
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
#endif
@@ -71,7 +71,7 @@
#include "sratom/sratom.h"

// enable -Wdocumentation again
#if defined(__clang__)
#if defined(__clang__) && (__clang_major__ * 100 + __clang_minor__) > 300
# pragma clang diagnostic pop
#endif



+ 17
- 3
source/utils/CarlaRingBuffer.hpp View File

@@ -75,8 +75,13 @@ struct BigStackBuffer {
uint8_t buf[size];
};

#define HeapBuffer_INIT {0, 0, 0, 0, false, nullptr}
#define StackBuffer_INIT {0, 0, 0, false, {0}}
#ifdef CARLA_PROPER_CPP11_SUPPORT
# define HeapBuffer_INIT {0, 0, 0, 0, false, nullptr}
# define StackBuffer_INIT {0, 0, 0, false, {0}}
#else
# define HeapBuffer_INIT
# define StackBuffer_INIT
#endif

// -----------------------------------------------------------------------
// CarlaRingBuffer templated class
@@ -387,7 +392,12 @@ class CarlaHeapRingBuffer : public CarlaRingBuffer<HeapBuffer>
{
public:
CarlaHeapRingBuffer() noexcept
: fHeapBuffer(HeapBuffer_INIT) {}
: fHeapBuffer(HeapBuffer_INIT)
{
#ifndef CARLA_PROPER_CPP11_SUPPORT
carla_zeroStruct(fHeapBuffer);
#endif
}

~CarlaHeapRingBuffer() noexcept override
{
@@ -440,7 +450,11 @@ public:
CarlaStackRingBuffer() noexcept
: fStackBuffer(StackBuffer_INIT)
{
#ifdef CARLA_PROPER_CPP11_SUPPORT
setRingBuffer(&fStackBuffer, false);
#else
setRingBuffer(&fStackBuffer, true);
#endif
}

private:


+ 9
- 2
source/utils/LinkedList.hpp View File

@@ -67,8 +67,15 @@ protected:

AbstractLinkedList() noexcept
: kDataSize(sizeof(Data)),
fCount(0),
fQueue({&fQueue, &fQueue}) {}
fCount(0)
#ifdef CARLA_PROPER_CPP11_SUPPORT
, fQueue({&fQueue, &fQueue}) {}
#else
{
fQueue.next = &fQueue;
fQueue.prev = &fQueue;
}
#endif

public:
virtual ~AbstractLinkedList() noexcept


+ 16
- 4
source/utils/Lv2AtomRingBuffer.hpp View File

@@ -31,15 +31,27 @@ public:
Lv2AtomRingBuffer() noexcept
: fMutex(),
fHeapBuffer(HeapBuffer_INIT),
fNeedsDataDelete(true),
fRetAtom{{0,0}, {0}} {}
fNeedsDataDelete(true)
#ifdef CARLA_PROPER_CPP11_SUPPORT
, fRetAtom{{0,0}, {0}} {}
#else
{
carla_zeroStruct(fHeapBuffer);
}
#endif

Lv2AtomRingBuffer(Lv2AtomRingBuffer& ringBuf, uint8_t buf[]) noexcept
: fMutex(),
fHeapBuffer(HeapBuffer_INIT),
fNeedsDataDelete(false),
fRetAtom{{0,0}, {0}}
fNeedsDataDelete(false)
#ifdef CARLA_PROPER_CPP11_SUPPORT
, fRetAtom{{0,0}, {0}}
{
#else
{
carla_zeroStruct(fHeapBuffer);
#endif

fHeapBuffer.buf = buf;
fHeapBuffer.size = ringBuf.fHeapBuffer.size;



Loading…
Cancel
Save