diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 5510a7821..a7e98f0b1 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -331,8 +331,10 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, const void* const extra, const uint options) { CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish"); +#ifndef BUILD_BRIDGE CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextPluginId <= pData->maxPluginNumber, "Invalid engine internal data"); +#endif CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERR(btype != BINARY_NONE, "Invalid plugin binary mode"); CARLA_SAFE_ASSERT_RETURN_ERR(ptype != PLUGIN_NONE, "Invalid plugin type"); @@ -364,7 +366,9 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, return false; } +#ifndef BUILD_BRIDGE CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins[id].plugin == nullptr, "Invalid engine internal data"); +#endif } CarlaPlugin::Initializer initializer = { @@ -728,8 +732,10 @@ bool CarlaEngine::addPlugin(const PluginType ptype, const char* const filename, bool CarlaEngine::removePlugin(const uint id) { CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish"); +#ifndef BUILD_BRIDGE CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data"); +#endif CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id"); carla_debug("CarlaEngine::removePlugin(%i)", id); @@ -775,8 +781,10 @@ bool CarlaEngine::removePlugin(const uint id) bool CarlaEngine::removeAllPlugins() { CARLA_SAFE_ASSERT_RETURN_ERR(pData->isIdling == 0, "An operation is still being processed, please wait for it to finish"); +#ifndef BUILD_BRIDGE CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextPluginId == pData->maxPluginNumber, "Invalid engine internal data"); +#endif CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data"); carla_debug("CarlaEngine::removeAllPlugins()"); @@ -955,8 +963,10 @@ bool CarlaEngine::switchPlugins(const uint idA, const uint idB) noexcept CarlaPlugin* CarlaEngine::getPlugin(const uint id) const noexcept { +#ifndef BUILD_BRIDGE CARLA_SAFE_ASSERT_RETURN_ERRN(pData->plugins != nullptr, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERRN(pData->curPluginCount != 0, "Invalid engine internal data"); +#endif CARLA_SAFE_ASSERT_RETURN_ERRN(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data"); CARLA_SAFE_ASSERT_RETURN_ERRN(id < pData->curPluginCount, "Invalid plugin Id"); diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 5f5d26f14..70cbaf4da 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -58,7 +58,7 @@ public: fLatencyCallback(cb) {} protected: - void setLatency(const uint32_t samples) noexcept + void setLatency(const uint32_t samples) noexcept override { if (getLatency() == samples) return; @@ -1286,7 +1286,7 @@ protected: return nullptr; } - void latencyChanged(const uint32_t samples) noexcept + void latencyChanged(const uint32_t samples) noexcept override { const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); diff --git a/source/backend/engine/CarlaEngineInternal.cpp b/source/backend/engine/CarlaEngineInternal.cpp index 796566953..7b83e9d46 100644 --- a/source/backend/engine/CarlaEngineInternal.cpp +++ b/source/backend/engine/CarlaEngineInternal.cpp @@ -509,8 +509,10 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName) void CarlaEngine::ProtectedData::close() { CARLA_SAFE_ASSERT(name.isNotEmpty()); +#ifndef BUILD_BRIDGE CARLA_SAFE_ASSERT(plugins != nullptr); CARLA_SAFE_ASSERT(nextPluginId == maxPluginNumber); +#endif CARLA_SAFE_ASSERT(nextAction.opcode == kEnginePostActionNull); aboutToClose = true; @@ -642,8 +644,7 @@ void CarlaEngine::ProtectedData::doNextPluginAction(const bool unlock) noexcept // PendingRtEventsRunner PendingRtEventsRunner::PendingRtEventsRunner(CarlaEngine* const engine, const uint32_t frames) noexcept - : pData(engine->pData), - numFrames(frames) + : pData(engine->pData) { pData->time.preProcess(frames); } diff --git a/source/backend/engine/CarlaEngineInternal.hpp b/source/backend/engine/CarlaEngineInternal.hpp index 923e90ea0..74110ec2f 100644 --- a/source/backend/engine/CarlaEngineInternal.hpp +++ b/source/backend/engine/CarlaEngineInternal.hpp @@ -284,7 +284,6 @@ public: private: CarlaEngine::ProtectedData* const pData; - const uint32_t numFrames; CARLA_PREVENT_HEAP_ALLOCATION CARLA_DECLARE_NON_COPY_CLASS(PendingRtEventsRunner) diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index c97d4d8bc..553f0a596 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -43,7 +43,6 @@ CARLA_BACKEND_START_NAMESPACE static const ParameterData kParameterDataNull = { PARAMETER_UNKNOWN, 0x0, PARAMETER_NULL, -1, -1, 0 }; static const ParameterRanges kParameterRangesNull = { 0.0f, 0.0f, 1.0f, 0.01f, 0.0001f, 0.1f }; static const MidiProgramData kMidiProgramDataNull = { 0, 0, nullptr }; -static const CustomData kCustomDataNull = { nullptr, nullptr, nullptr }; static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr }; static /* */ CustomData kCustomDataFallbackNC = { nullptr, nullptr, nullptr }; diff --git a/source/bridges-ui/CarlaBridgeToolkitQt.cpp b/source/bridges-ui/CarlaBridgeToolkitQt.cpp index e5627eab2..22da606ed 100644 --- a/source/bridges-ui/CarlaBridgeToolkitQt.cpp +++ b/source/bridges-ui/CarlaBridgeToolkitQt.cpp @@ -48,7 +48,14 @@ static char* qargv[0] = {}; class CarlaBridgeToolkitQt: public QObject, public CarlaBridgeToolkit { +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif Q_OBJECT +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic pop +#endif public: CarlaBridgeToolkitQt(CarlaBridgeUI* const u) diff --git a/source/bridges-ui/CarlaBridgeUI-LV2.cpp b/source/bridges-ui/CarlaBridgeUI-LV2.cpp index bae69baf7..b54e934aa 100644 --- a/source/bridges-ui/CarlaBridgeUI-LV2.cpp +++ b/source/bridges-ui/CarlaBridgeUI-LV2.cpp @@ -36,9 +36,6 @@ CARLA_BRIDGE_START_NAMESPACE static double gSampleRate = 44100.0; -// Maximum default buffer size -const unsigned int MAX_DEFAULT_BUFFER_SIZE = 8192; // 0x2000 - // LV2 URI Map Ids const uint32_t CARLA_URI_MAP_ID_NULL = 0; const uint32_t CARLA_URI_MAP_ID_ATOM_BLANK = 1; @@ -565,7 +562,7 @@ public: fDescriptor->port_event(fHandle, portIndex, lv2_atom_total_size(atom), CARLA_URI_MAP_ID_ATOM_TRANSFER_EVENT, atom); } - void dspURIDReceived(const LV2_URID urid, const char* const uri) + void dspURIDReceived(const LV2_URID urid, const char* const uri) override { CARLA_SAFE_ASSERT_RETURN(urid == fCustomURIDs.size(),); CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0',); diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index a1ef87f8d..b41f96ec2 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -58,7 +58,6 @@ using juce::CharPointer_UTF8; using juce::File; -using juce::String; using juce::StringArray; CARLA_BACKEND_USE_NAMESPACE @@ -991,7 +990,7 @@ static void do_lv2_check(const char* const bundle, const bool doInit) Lilv::Plugin lilvPlugin(lilv_plugins_get(lilvPlugins, it)); if (const char* const uri = lilvPlugin.get_uri().as_string()) - URIs.addIfNotAlreadyThere(String(uri)); + URIs.addIfNotAlreadyThere(juce::String(uri)); } if (URIs.size() == 0) @@ -1561,7 +1560,7 @@ static void do_juce_check(const char* const filename_, const char* const stype, static void do_fluidsynth_check(const char* const filename, const bool doInit) { #ifdef HAVE_FLUIDSYNTH - const String jfilename = String(CharPointer_UTF8(filename)); + const juce::String jfilename = juce::String(CharPointer_UTF8(filename)); const File file(jfilename); if (! file.existsAsFile()) @@ -1651,7 +1650,7 @@ static void do_fluidsynth_check(const char* const filename, const bool doInit) static void do_linuxsampler_check(const char* const filename, const char* const stype, const bool doInit) { #ifdef HAVE_LINUXSAMPLER - const String jfilename = String(CharPointer_UTF8(filename)); + const juce::String jfilename = juce::String(CharPointer_UTF8(filename)); const File file(jfilename); if (! file.existsAsFile()) diff --git a/source/modules/dgl/Makefile b/source/modules/dgl/Makefile index ddebc9717..87ec72d24 100644 --- a/source/modules/dgl/Makefile +++ b/source/modules/dgl/Makefile @@ -16,7 +16,7 @@ BUILD_CXX_FLAGS += $(DGL_FLAGS) -Isrc BUILD_CXX_FLAGS += -Wno-type-limits -fpermissive # needed by stb_image -BUILD_CXX_FLAGS += -Wno-misleading-indentation -Wno-shift-negative-value +BUILD_CXX_FLAGS += -Wno-shift-negative-value # ---------------------------------------------------------------------------------------------------------------------------- diff --git a/source/modules/dgl/src/NanoVG.cpp b/source/modules/dgl/src/NanoVG.cpp index 0fcb29f9a..ee4add07f 100644 --- a/source/modules/dgl/src/NanoVG.cpp +++ b/source/modules/dgl/src/NanoVG.cpp @@ -972,8 +972,17 @@ END_NAMESPACE_DGL #undef final +#if defined(__GNUC__) && (__GNUC__ >= 5) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wno-misleading-indentation" +#endif + extern "C" { #include "nanovg/nanovg.c" } +#if defined(__GNUC__) && (__GNUC__ >= 5) +# pragma GCC diagnostic pop +#endif + // ----------------------------------------------------------------------- diff --git a/source/modules/hylia/hylia.cpp b/source/modules/hylia/hylia.cpp index 609b3fe9e..534e163e7 100644 --- a/source/modules/hylia/hylia.cpp +++ b/source/modules/hylia/hylia.cpp @@ -17,7 +17,17 @@ #include "hylia.h" +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-local-typedef" +#endif + #include "AudioEngine.hpp" + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + #include "ableton/link/HostTimeFilter.hpp" #include diff --git a/source/modules/juce_audio_formats/Makefile b/source/modules/juce_audio_formats/Makefile index a484a097b..ae152fcb0 100644 --- a/source/modules/juce_audio_formats/Makefile +++ b/source/modules/juce_audio_formats/Makefile @@ -11,7 +11,7 @@ include ../Makefile.mk # ---------------------------------------------------------------------------------------------------------------------------- BUILD_CXX_FLAGS += $(JUCE_AUDIO_FORMATS_FLAGS) -I.. -BUILD_CXX_FLAGS += -Wno-misleading-indentation -DHAVE_LROUND +# BUILD_CXX_FLAGS += -Wno-misleading-indentation -DHAVE_LROUND # ---------------------------------------------------------------------------------------------------------------------------- diff --git a/source/native-plugins/Makefile b/source/native-plugins/Makefile index c4bc741cc..618148413 100644 --- a/source/native-plugins/Makefile +++ b/source/native-plugins/Makefile @@ -31,7 +31,7 @@ endif # EXPERIMENTAL_PLUGINS ifeq ($(HAVE_ZYN_DEPS),true) ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) -Izynaddsubfx -Izynaddsubfx/rtosc -ZYN_CXX_FLAGS += -Wno-misleading-indentation -Wno-shift-negative-value -fpermissive +# ZYN_CXX_FLAGS += -Wno-misleading-indentation -Wno-shift-negative-value ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml zlib) ZYN_LD_FLAGS = $(LINK_FLAGS) ZYN_LD_FLAGS += $(shell pkg-config --libs liblo) diff --git a/source/native-plugins/zynaddsubfx-src.cpp b/source/native-plugins/zynaddsubfx-src.cpp index 79e2d16d8..60aa4c307 100644 --- a/source/native-plugins/zynaddsubfx-src.cpp +++ b/source/native-plugins/zynaddsubfx-src.cpp @@ -44,6 +44,13 @@ extern "C" { #include "zynaddsubfx/rtosc/rtosc.c" } +// ignore some compiler warnings +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +# pragma clang diagnostic ignored "-Wunused-private-field" +#endif + // rtosc includes #include "zynaddsubfx/rtosc/cpp/automations.cpp" #include "zynaddsubfx/rtosc/cpp/midimapper.cpp" @@ -530,6 +537,10 @@ extern "C" { #include "zynaddsubfx/globals.cpp" +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + // Dummy variables and functions for linking purposes namespace zyncarla { class WavFile; diff --git a/source/native-plugins/zynaddsubfx-ui.cpp b/source/native-plugins/zynaddsubfx-ui.cpp index aa9e9a5b2..893fa4858 100644 --- a/source/native-plugins/zynaddsubfx-ui.cpp +++ b/source/native-plugins/zynaddsubfx-ui.cpp @@ -45,6 +45,16 @@ extern "C" { #include "zynaddsubfx/rtosc/rtosc.c" } +// ignore some compiler warnings +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +# pragma clang diagnostic ignored "-Wunused-private-field" +#elif defined(__GNUC__) && (__GNUC__ >= 7) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif + // rtosc c++ includes #include "zynaddsubfx/rtosc/cpp/midimapper.cpp" #include "zynaddsubfx/rtosc/cpp/miditable.cpp" @@ -58,11 +68,6 @@ extern "C" { #undef static #include "zynaddsubfx/rtosc/cpp/undo-history.cpp" -#if defined(__GNUC__) && (__GNUC__ >= 7) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" -#endif - // zynaddsubfx ui includes #include "zynaddsubfx/UI/NioUI.cpp" #include "zynaddsubfx/UI/WidgetPDial.cpp" @@ -109,7 +114,9 @@ extern "C" { #include "zynaddsubfx/UI/VirKeyboard.cpp" #include "zynaddsubfx/UI/guimain.cpp" -#if defined(__GNUC__) && (__GNUC__ >= 7) +#if defined(__clang__) +# pragma clang diagnostic pop +#elif defined(__GNUC__) && (__GNUC__ >= 7) # pragma GCC diagnostic pop #endif diff --git a/source/theme/CarlaStyle.hpp b/source/theme/CarlaStyle.hpp index 4011db593..321845ca2 100644 --- a/source/theme/CarlaStyle.hpp +++ b/source/theme/CarlaStyle.hpp @@ -43,7 +43,14 @@ class CarlaStylePrivate; class CarlaStyle : public QCommonStyle { +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif Q_OBJECT +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic pop +#endif public: CarlaStyle(); diff --git a/source/theme/CarlaStyleAnimations.hpp b/source/theme/CarlaStyleAnimations.hpp index 09623a244..261845015 100644 --- a/source/theme/CarlaStyleAnimations.hpp +++ b/source/theme/CarlaStyleAnimations.hpp @@ -33,7 +33,14 @@ class CarlaStyleAnimation : public QAbstractAnimation { +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif Q_OBJECT +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic pop +#endif public: CarlaStyleAnimation(QObject* target) @@ -122,7 +129,14 @@ private: class CarlaProgressStyleAnimation : public CarlaStyleAnimation { +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif Q_OBJECT +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic pop +#endif public: CarlaProgressStyleAnimation(int speed, QObject* target) diff --git a/source/theme/CarlaStylePrivate.hpp b/source/theme/CarlaStylePrivate.hpp index 01cc74641..00d3297c8 100644 --- a/source/theme/CarlaStylePrivate.hpp +++ b/source/theme/CarlaStylePrivate.hpp @@ -27,7 +27,14 @@ class QStyleAnimation; class CarlaStylePrivate : public QObject { +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif Q_OBJECT +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang__) +# pragma clang diagnostic pop +#endif public: enum { diff --git a/source/utils/CarlaPluginUI.cpp b/source/utils/CarlaPluginUI.cpp index 67029e820..d2de91437 100644 --- a/source/utils/CarlaPluginUI.cpp +++ b/source/utils/CarlaPluginUI.cpp @@ -519,12 +519,12 @@ public: XSetTransientForHint(fDisplay, fWindow, static_cast(winId)); } - void* getPtr() const noexcept + void* getPtr() const noexcept override { return (void*)fWindow; } - void* getDisplay() const noexcept + void* getDisplay() const noexcept override { return fDisplay; } diff --git a/source/utils/CarlaRingBuffer.hpp b/source/utils/CarlaRingBuffer.hpp index 00c9b8375..caf7cbbe7 100644 --- a/source/utils/CarlaRingBuffer.hpp +++ b/source/utils/CarlaRingBuffer.hpp @@ -140,10 +140,7 @@ public: return true; } - bool isDataAvailableForReading() const noexcept - { - return (fBuffer != nullptr && fBuffer->buf != nullptr && fBuffer->head != fBuffer->tail); - } + bool isDataAvailableForReading() const noexcept; bool isEmpty() const noexcept { @@ -425,6 +422,18 @@ private: CARLA_DECLARE_NON_COPY_CLASS(CarlaRingBufferControl) }; +template +inline bool CarlaRingBufferControl::isDataAvailableForReading() const noexcept +{ + return (fBuffer != nullptr && fBuffer->head != fBuffer->tail); +} + +template <> +inline bool CarlaRingBufferControl::isDataAvailableForReading() const noexcept +{ + return (fBuffer != nullptr && fBuffer->buf != nullptr && fBuffer->head != fBuffer->tail); +} + // ----------------------------------------------------------------------- // CarlaRingBuffer using heap space