Browse Source

Fix a bunch of clang warnings

tags/1.9.8
falkTX 7 years ago
parent
commit
05b361127a
20 changed files with 115 additions and 29 deletions
  1. +10
    -0
      source/backend/engine/CarlaEngine.cpp
  2. +2
    -2
      source/backend/engine/CarlaEngineBridge.cpp
  3. +3
    -2
      source/backend/engine/CarlaEngineInternal.cpp
  4. +0
    -1
      source/backend/engine/CarlaEngineInternal.hpp
  5. +0
    -1
      source/backend/plugin/CarlaPlugin.cpp
  6. +7
    -0
      source/bridges-ui/CarlaBridgeToolkitQt.cpp
  7. +1
    -4
      source/bridges-ui/CarlaBridgeUI-LV2.cpp
  8. +3
    -4
      source/discovery/carla-discovery.cpp
  9. +1
    -1
      source/modules/dgl/Makefile
  10. +9
    -0
      source/modules/dgl/src/NanoVG.cpp
  11. +10
    -0
      source/modules/hylia/hylia.cpp
  12. +1
    -1
      source/modules/juce_audio_formats/Makefile
  13. +1
    -1
      source/native-plugins/Makefile
  14. +11
    -0
      source/native-plugins/zynaddsubfx-src.cpp
  15. +13
    -6
      source/native-plugins/zynaddsubfx-ui.cpp
  16. +7
    -0
      source/theme/CarlaStyle.hpp
  17. +14
    -0
      source/theme/CarlaStyleAnimations.hpp
  18. +7
    -0
      source/theme/CarlaStylePrivate.hpp
  19. +2
    -2
      source/utils/CarlaPluginUI.cpp
  20. +13
    -4
      source/utils/CarlaRingBuffer.hpp

+ 10
- 0
source/backend/engine/CarlaEngine.cpp View File

@@ -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");



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

@@ -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);



+ 3
- 2
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -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);
}


+ 0
- 1
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -284,7 +284,6 @@ public:

private:
CarlaEngine::ProtectedData* const pData;
const uint32_t numFrames;

CARLA_PREVENT_HEAP_ALLOCATION
CARLA_DECLARE_NON_COPY_CLASS(PendingRtEventsRunner)


+ 0
- 1
source/backend/plugin/CarlaPlugin.cpp View File

@@ -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 };


+ 7
- 0
source/bridges-ui/CarlaBridgeToolkitQt.cpp View File

@@ -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)


+ 1
- 4
source/bridges-ui/CarlaBridgeUI-LV2.cpp View File

@@ -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',);


+ 3
- 4
source/discovery/carla-discovery.cpp View File

@@ -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())


+ 1
- 1
source/modules/dgl/Makefile View File

@@ -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

# ----------------------------------------------------------------------------------------------------------------------------



+ 9
- 0
source/modules/dgl/src/NanoVG.cpp View File

@@ -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

// -----------------------------------------------------------------------

+ 10
- 0
source/modules/hylia/hylia.cpp View File

@@ -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 <chrono>



+ 1
- 1
source/modules/juce_audio_formats/Makefile View File

@@ -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

# ----------------------------------------------------------------------------------------------------------------------------



+ 1
- 1
source/native-plugins/Makefile View File

@@ -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)


+ 11
- 0
source/native-plugins/zynaddsubfx-src.cpp View File

@@ -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;


+ 13
- 6
source/native-plugins/zynaddsubfx-ui.cpp View File

@@ -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



+ 7
- 0
source/theme/CarlaStyle.hpp View File

@@ -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();


+ 14
- 0
source/theme/CarlaStyleAnimations.hpp View File

@@ -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)


+ 7
- 0
source/theme/CarlaStylePrivate.hpp View File

@@ -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 {


+ 2
- 2
source/utils/CarlaPluginUI.cpp View File

@@ -519,12 +519,12 @@ public:
XSetTransientForHint(fDisplay, fWindow, static_cast<Window>(winId));
}

void* getPtr() const noexcept
void* getPtr() const noexcept override
{
return (void*)fWindow;
}

void* getDisplay() const noexcept
void* getDisplay() const noexcept override
{
return fDisplay;
}


+ 13
- 4
source/utils/CarlaRingBuffer.hpp View File

@@ -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 <class BufferStruct>
inline bool CarlaRingBufferControl<BufferStruct>::isDataAvailableForReading() const noexcept
{
return (fBuffer != nullptr && fBuffer->head != fBuffer->tail);
}

template <>
inline bool CarlaRingBufferControl<HeapBuffer>::isDataAvailableForReading() const noexcept
{
return (fBuffer != nullptr && fBuffer->buf != nullptr && fBuffer->head != fBuffer->tail);
}

// -----------------------------------------------------------------------
// CarlaRingBuffer using heap space



Loading…
Cancel
Save