diff --git a/source/Makefile.mk b/source/Makefile.mk index afd5a4fb4..8b205a34c 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -41,30 +41,33 @@ endif # -------------------------------------------------------------- # Common build and link flags -BASE_FLAGS = -Wall -Wextra -Wcast-qual -Wconversion -pipe -DREAL_BUILD +BASE_FLAGS = -Wall -Wextra -pipe -DREAL_BUILD BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections ifeq ($(TESTBUILD),true) -# TODO: check which ones are valid on OSX -BASE_FLAGS += -Wcast-align -Wredundant-decls -Wshadow -BASE_FLAGS += -Wmissing-declarations -Wstrict-overflow -Wundef -Wwrite-strings -fstrict-overflow -Wsuggest-attribute=noreturn -Wunsafe-loop-optimizations -BASE_FLAGS += -Werror +BASE_FLAGS += -Werror -Wcast-align -Wcast-qual -Wconversion -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wunsafe-loop-optimizations -Wwrite-strings +CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes +CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual +ifeq ($(LINUX),true) CFLAGS += -isystem /opt/kxstudio/include -CFLAGS += -Wstrict-prototypes -Wmissing-prototypes CXXFLAGS += -isystem /opt/kxstudio/include -CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual endif - -# -Wcast-align -Wredundant-decls -Wshadow -Wstrict-prototypes -Wmissing-prototypes -# -Wmissing-declarations -Wstrict-overflow -Wundef -Wwrite-strings -fstrict-overflow -Wsuggest-attribute=noreturn -Wunsafe-loop-optimizations -# -Wnon-virtual-dtor -Woverloaded-virtual -# -Werror - -# -Waggregate-return -Wsign-conversion +ifeq ($(MACOS),true) +CFLAGS += -isystem /opt/local/include/ +CXXFLAGS += -isystem /opt/local/include/ +endif +ifeq ($(WIN32),true) +CFLAGS += -isystem /opt/mingw32/include +CXXFLAGS += -isystem /opt/mingw32/include -isystem /opt/mingw32/include/qt4 +endif +endif ifneq ($(MACOS),true) BASE_FLAGS += -Wlogical-op +ifeq ($(TESTBUILD),true) +BASE_FLAGS += -Wmissing-declarations -Wsign-conversion -Wsuggest-attribute=noreturn +endif endif ifneq ($(WIN32),true) diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 97e170ab5..0c710ffc2 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1615,7 +1615,8 @@ bool CarlaEngine::patchbayConnect(const int portA, const int portB) connectionToId.portOut = portA; connectionToId.portIn = portB; - callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, rack->lastConnectionId, portA, portB, 0.0f, nullptr); + CARLA_SAFE_ASSERT(rack->lastConnectionId >= 0); + callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, static_cast(rack->lastConnectionId), portA, portB, 0.0f, nullptr); rack->usedConnections.append(connectionToId); rack->lastConnectionId++; @@ -1693,7 +1694,8 @@ bool CarlaEngine::patchbayDisconnect(const int connectionId) CARLA_SAFE_ASSERT_RETURN(false, false); } - callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connection.id, connection.portOut, connection.portIn, 0.0f, nullptr); + CARLA_SAFE_ASSERT(connection.id >= 0); + callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, static_cast(connection.id), connection.portOut, connection.portIn, 0.0f, nullptr); rack->usedConnections.remove(it); break; @@ -1917,7 +1919,7 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize) plugin->bufferSizeChanged(newBufferSize); } - callback(ENGINE_CALLBACK_BUFFER_SIZE_CHANGED, 0, newBufferSize, 0, 0.0f, nullptr); + callback(ENGINE_CALLBACK_BUFFER_SIZE_CHANGED, 0, static_cast(newBufferSize), 0, 0.0f, nullptr); } void CarlaEngine::sampleRateChanged(const double newSampleRate) diff --git a/source/backend/engine/CarlaEngineInternal.cpp b/source/backend/engine/CarlaEngineInternal.cpp index 73e6f6b9f..6f8c18871 100644 --- a/source/backend/engine/CarlaEngineInternal.cpp +++ b/source/backend/engine/CarlaEngineInternal.cpp @@ -699,10 +699,10 @@ void CarlaEngineProtectedData::processRack(float* inBufReal[2], float* outBuf[2] if (oldAudioInCount > 0) { - FloatVectorOperations::findMinAndMax(inBuf0, frames, tmpMin, tmpMax); + FloatVectorOperations::findMinAndMax(inBuf0, static_cast(frames), tmpMin, tmpMax); pluginData.insPeak[0] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); - FloatVectorOperations::findMinAndMax(inBuf1, frames, tmpMin, tmpMax); + FloatVectorOperations::findMinAndMax(inBuf1, static_cast(frames), tmpMin, tmpMax); pluginData.insPeak[1] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); } else @@ -713,10 +713,10 @@ void CarlaEngineProtectedData::processRack(float* inBufReal[2], float* outBuf[2] if (plugin->getAudioOutCount() > 0) { - FloatVectorOperations::findMinAndMax(outBuf[0], frames, tmpMin, tmpMax); + FloatVectorOperations::findMinAndMax(outBuf[0], static_cast(frames), tmpMin, tmpMax); pluginData.outsPeak[0] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); - FloatVectorOperations::findMinAndMax(outBuf[1], frames, tmpMin, tmpMax); + FloatVectorOperations::findMinAndMax(outBuf[1], static_cast(frames), tmpMin, tmpMax); pluginData.outsPeak[1] = carla_max(std::abs(tmpMin), std::abs(tmpMax), 1.0f); } else @@ -786,10 +786,10 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 { bool first = true; - for (LinkedList::Itenerator it = rack->connectedIns[0].begin(); it.valid(); it.next()) + for (LinkedList::Itenerator it = rack->connectedIns[0].begin(); it.valid(); it.next()) { - const uint& port(it.getValue()); - CARLA_SAFE_ASSERT_CONTINUE(port < inCount); + const int& port(it.getValue()); + CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast(inCount)); if (first) { @@ -814,10 +814,10 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 { bool first = true; - for (LinkedList::Itenerator it = rack->connectedIns[1].begin(); it.valid(); it.next()) + for (LinkedList::Itenerator it = rack->connectedIns[1].begin(); it.valid(); it.next()) { - const uint& port(it.getValue()); - CARLA_SAFE_ASSERT_CONTINUE(port < inCount); + const int& port(it.getValue()); + CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast(inCount)); if (first) { @@ -843,10 +843,10 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 // connect output buffers if (rack->connectedOuts[0].count() != 0) { - for (LinkedList::Itenerator it = rack->connectedOuts[0].begin(); it.valid(); it.next()) + for (LinkedList::Itenerator it = rack->connectedOuts[0].begin(); it.valid(); it.next()) { - const uint& port(it.getValue()); - CARLA_SAFE_ASSERT_CONTINUE(port < outCount); + const int& port(it.getValue()); + CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast(outCount)); FLOAT_ADD(outBuf[port], rack->out[0], nframes); } @@ -854,10 +854,10 @@ void CarlaEngineProtectedData::processRackFull(float** const inBuf, const uint32 if (rack->connectedOuts[1].count() != 0) { - for (LinkedList::Itenerator it = rack->connectedOuts[1].begin(); it.valid(); it.next()) + for (LinkedList::Itenerator it = rack->connectedOuts[1].begin(); it.valid(); it.next()) { - const uint& port(it.getValue()); - CARLA_SAFE_ASSERT_CONTINUE(port < outCount); + const int& port(it.getValue()); + CARLA_SAFE_ASSERT_CONTINUE(port >= 0 && port < static_cast(outCount)); FLOAT_ADD(outBuf[port], rack->out[1], nframes); } diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index 49d9d7ba3..37fff0554 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -85,8 +85,8 @@ struct EngineRackBuffers { float* out[2]; // connections stuff - LinkedList connectedIns[2]; - LinkedList connectedOuts[2]; + LinkedList connectedIns[2]; + LinkedList connectedOuts[2]; CarlaMutex connectLock; int lastConnectionId; diff --git a/source/includes/CarlaDefines.h b/source/includes/CarlaDefines.h index 5f83d3a42..11ce449c2 100644 --- a/source/includes/CarlaDefines.h +++ b/source/includes/CarlaDefines.h @@ -91,7 +91,7 @@ # define P_INTPTR "%i" # define P_UINTPTR "%x" # define P_SIZE "%u" -#elif __WORDSIZE == 64 +#elif defined(__WORDSIZE) && __WORDSIZE == 64 # define P_INT64 "%li" # define P_INTPTR "%li" # define P_UINTPTR "%lx" diff --git a/source/utils/CarlaMathUtils.hpp b/source/utils/CarlaMathUtils.hpp index 411e54975..435f9d60d 100644 --- a/source/utils/CarlaMathUtils.hpp +++ b/source/utils/CarlaMathUtils.hpp @@ -31,9 +31,9 @@ using juce::FloatVectorOperations; // Float operations #ifdef HAVE_JUCE -# define FLOAT_ADD(bufDst, bufSrc, frames) FloatVectorOperations::add(bufDst, bufSrc, frames) -# define FLOAT_COPY(bufDst, bufSrc, frames) FloatVectorOperations::copy(bufDst, bufSrc, frames) -# define FLOAT_CLEAR(buf, frames) FloatVectorOperations::clear(buf, frames) +# define FLOAT_ADD(bufDst, bufSrc, frames) FloatVectorOperations::add(bufDst, bufSrc, static_cast(frames)) +# define FLOAT_COPY(bufDst, bufSrc, frames) FloatVectorOperations::copy(bufDst, bufSrc, static_cast(frames)) +# define FLOAT_CLEAR(buf, frames) FloatVectorOperations::clear(buf, static_cast(frames)) #else # define FLOAT_ADD(bufDst, bufSrc, frames) carla_addFloat(bufDst, bufSrc, frames) # define FLOAT_COPY(bufDst, bufSrc, frames) carla_copyFloat(bufDst, bufSrc, frames) diff --git a/source/utils/CarlaThread.hpp b/source/utils/CarlaThread.hpp index 21fbc3b11..5b426a052 100644 --- a/source/utils/CarlaThread.hpp +++ b/source/utils/CarlaThread.hpp @@ -88,7 +88,7 @@ public: if (pthread_create(&threadId, nullptr, _entryPoint, this) == 0) { -#if (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012 +#if defined(__GLIBC__) && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012 if (fName.isNotEmpty()) pthread_setname_np(threadId, fName.getBuffer()); #endif