Browse Source

Fix some warnings triggered by gcc-8

tags/v1.9.12
falkTX 7 years ago
parent
commit
d73c0788cc
15 changed files with 102 additions and 38 deletions
  1. +1
    -1
      source/Makefile.mk
  2. +5
    -0
      source/backend/CarlaEngine.hpp
  3. +5
    -0
      source/backend/CarlaHost.h
  4. +10
    -0
      source/backend/CarlaHostCommon.cpp
  5. +1
    -1
      source/backend/CarlaStandalone.cpp
  6. +15
    -2
      source/backend/engine/CarlaEngineData.cpp
  7. +1
    -1
      source/backend/plugin/CarlaPluginDSSI.cpp
  8. +2
    -0
      source/backend/plugin/CarlaPluginFluidSynth.cpp
  9. +1
    -1
      source/backend/plugin/CarlaPluginLV2.cpp
  10. +3
    -3
      source/backend/plugin/CarlaPluginVST2.cpp
  11. +7
    -0
      source/bridges-plugin/CarlaBridgeSingleLV2.cpp
  12. +12
    -12
      source/includes/lv2/atom-util.h
  13. +2
    -2
      source/modules/lilv/lilv-0.24.0/lilv/lilv.h
  14. +6
    -0
      source/plugin/carla-lv2.cpp
  15. +31
    -15
      source/utils/CarlaLv2Utils.hpp

+ 1
- 1
source/Makefile.mk View File

@@ -160,7 +160,7 @@ endif
# Strict test build # Strict test build


ifeq ($(TESTBUILD),true) ifeq ($(TESTBUILD),true)
BASE_FLAGS += -Werror -Wabi -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-declarations
BASE_FLAGS += -Werror -Wabi=98 -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-declarations
BASE_FLAGS += -Woverlength-strings -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wundef -Wuninitialized -Wunused BASE_FLAGS += -Woverlength-strings -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wundef -Wuninitialized -Wunused
BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing
BASE_FLAGS += -Wstrict-overflow -fstrict-overflow BASE_FLAGS += -Wstrict-overflow -fstrict-overflow


+ 5
- 0
source/backend/CarlaEngine.hpp View File

@@ -289,6 +289,11 @@ struct CARLA_API EngineTimeInfoBBT {
double ticksPerBeat; double ticksPerBeat;
double beatsPerMinute; double beatsPerMinute;


/*!
* Clear.
*/
void clear() noexcept;

#ifndef DOXYGEN #ifndef DOXYGEN
EngineTimeInfoBBT() noexcept; EngineTimeInfoBBT() noexcept;
EngineTimeInfoBBT(const EngineTimeInfoBBT&) noexcept; EngineTimeInfoBBT(const EngineTimeInfoBBT&) noexcept;


+ 5
- 0
source/backend/CarlaHost.h View File

@@ -264,6 +264,11 @@ typedef struct _CarlaTransportInfo {
* C++ constructor. * C++ constructor.
*/ */
CARLA_API _CarlaTransportInfo() noexcept; CARLA_API _CarlaTransportInfo() noexcept;

/*!
* Clear struct contents.
*/
CARLA_API void clear() noexcept;
#endif #endif


} CarlaTransportInfo; } CarlaTransportInfo;


+ 10
- 0
source/backend/CarlaHostCommon.cpp View File

@@ -96,6 +96,16 @@ _CarlaTransportInfo::_CarlaTransportInfo() noexcept
tick(0), tick(0),
bpm(0.0) {} bpm(0.0) {}


void _CarlaTransportInfo::clear() noexcept
{
playing = false;
frame = 0;
bar = 0;
beat = 0;
tick = 0;
bpm = 0.0;
}

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


const char* carla_get_library_filename() const char* carla_get_library_filename()


+ 1
- 1
source/backend/CarlaStandalone.cpp View File

@@ -857,7 +857,7 @@ uint64_t carla_get_current_transport_frame()
const CarlaTransportInfo* carla_get_transport_info() const CarlaTransportInfo* carla_get_transport_info()
{ {
static CarlaTransportInfo retTransInfo; static CarlaTransportInfo retTransInfo;
carla_zeroStruct(retTransInfo);
retTransInfo.clear();


CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(), &retTransInfo); CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr && gStandalone.engine->isRunning(), &retTransInfo);




+ 15
- 2
source/backend/engine/CarlaEngineData.cpp View File

@@ -315,6 +315,19 @@ EngineTimeInfoBBT::EngineTimeInfoBBT(const EngineTimeInfoBBT& bbt) noexcept
ticksPerBeat(bbt.ticksPerBeat), ticksPerBeat(bbt.ticksPerBeat),
beatsPerMinute(bbt.beatsPerMinute) {} beatsPerMinute(bbt.beatsPerMinute) {}


void EngineTimeInfoBBT::clear() noexcept
{
valid = false;
bar = 0;
beat = 0;
tick = 0.0;
barStartTick = 0.0;
beatsPerBar = 0.0f;
beatType = 0.0f;
ticksPerBeat = 0.0;
beatsPerMinute = 0.0;
}

// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// EngineTimeInfo // EngineTimeInfo


@@ -329,7 +342,7 @@ void EngineTimeInfo::clear() noexcept
playing = false; playing = false;
frame = 0; frame = 0;
usecs = 0; usecs = 0;
carla_zeroStruct(bbt);
bbt.clear();
} }


EngineTimeInfo::EngineTimeInfo(const EngineTimeInfo& info) noexcept EngineTimeInfo::EngineTimeInfo(const EngineTimeInfo& info) noexcept
@@ -345,7 +358,7 @@ EngineTimeInfo& EngineTimeInfo::operator=(const EngineTimeInfo& info) noexcept
usecs = info.usecs; usecs = info.usecs;
bbt.valid = info.bbt.valid; bbt.valid = info.bbt.valid;
bbt.bar = info.bbt.bar; bbt.bar = info.bbt.bar;
bbt.tick = info.bbt.tick;
bbt.beat = info.bbt.beat;
bbt.tick = info.bbt.tick; bbt.tick = info.bbt.tick;
bbt.barStartTick = info.bbt.barStartTick; bbt.barStartTick = info.bbt.barStartTick;
bbt.beatsPerBar = info.bbt.beatsPerBar; bbt.beatsPerBar = info.bbt.beatsPerBar;


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

@@ -2214,7 +2214,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(std::strcmp(msgport, ourport) == 0,); CARLA_SAFE_ASSERT_RETURN(std::strcmp(msgport, ourport) == 0,);
} }


const lo_arg* const* const argv(static_cast<const lo_arg* const* const>(argvx));
const lo_arg* const* const argv(static_cast<const lo_arg* const*>(argvx));


if (std::strcmp(method, "configure") == 0) if (std::strcmp(method, "configure") == 0)
return handleOscMessageConfigure(argc, argv, types); return handleOscMessageConfigure(argc, argv, types);


+ 2
- 0
source/backend/plugin/CarlaPluginFluidSynth.cpp View File

@@ -329,6 +329,7 @@ public:
std::strncpy(strBuf, "Triangle wave", STR_MAX); std::strncpy(strBuf, "Triangle wave", STR_MAX);
return; return;
} }
break;
case FluidSynthInterpolation: case FluidSynthInterpolation:
switch (scalePointId) switch (scalePointId)
{ {
@@ -345,6 +346,7 @@ public:
std::strncpy(strBuf, "Seventh-order", STR_MAX); std::strncpy(strBuf, "Seventh-order", STR_MAX);
return; return;
} }
break;
} }


CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf);


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

@@ -2941,7 +2941,7 @@ public:


pData->postRtEvents.trySplice(); pData->postRtEvents.trySplice();


carla_copyStruct(fLastTimeInfo, timeInfo);
fLastTimeInfo = timeInfo;
} }


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


+ 3
- 3
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -1139,7 +1139,7 @@ public:
if (fFirstActive || ! fLastTimeInfo.compareIgnoringRollingFrames(timeInfo, fBufferSize)) if (fFirstActive || ! fLastTimeInfo.compareIgnoringRollingFrames(timeInfo, fBufferSize))
{ {
fTimeInfo.flags |= kVstTransportChanged; fTimeInfo.flags |= kVstTransportChanged;
carla_copyStruct(fLastTimeInfo, timeInfo);
fLastTimeInfo = timeInfo;
} }


if (timeInfo.playing) if (timeInfo.playing)
@@ -2491,10 +2491,10 @@ private:
const int32_t chunkSize = fxbSwap(set[39]); const int32_t chunkSize = fxbSwap(set[39]);
CARLA_SAFE_ASSERT_RETURN(chunkSize > 0, false); CARLA_SAFE_ASSERT_RETURN(chunkSize > 0, false);


if (static_cast<const std::size_t>(chunkSize + 160) > dataSize)
if (static_cast<std::size_t>(chunkSize + 160) > dataSize)
return false; return false;


setChunkData(&set[40], static_cast<const std::size_t>(chunkSize));
setChunkData(&set[40], static_cast<std::size_t>(chunkSize));
return true; return true;
} }




+ 7
- 0
source/bridges-plugin/CarlaBridgeSingleLV2.cpp View File

@@ -29,6 +29,13 @@


#include "water/files/File.h" #include "water/files/File.h"


template<>
void Lv2PluginBaseClass<CarlaBackend::EngineTimeInfo>::clearTimeData() noexcept
{
fLastPositionData.clear();
fTimeInfo.clear();
}

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


CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


+ 12
- 12
source/includes/lv2/atom-util.h View File

@@ -130,15 +130,15 @@ lv2_atom_sequence_next(const LV2_Atom_Event* i)
@endcode @endcode
*/ */
#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \ #define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \
for (const LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(&(seq)->body); \
for (const LV2_Atom_Event* iter = lv2_atom_sequence_begin(&(seq)->body); \
!lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \ !lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \
(iter) = lv2_atom_sequence_next(iter))
iter = lv2_atom_sequence_next(iter))


/** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */ /** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */
#define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \ #define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \
for (const LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(body); \
for (const LV2_Atom_Event* iter = lv2_atom_sequence_begin(body); \
!lv2_atom_sequence_is_end(body, size, (iter)); \ !lv2_atom_sequence_is_end(body, size, (iter)); \
(iter) = lv2_atom_sequence_next(iter))
iter = lv2_atom_sequence_next(iter))


/** /**
@} @}
@@ -227,15 +227,15 @@ lv2_atom_tuple_next(const LV2_Atom* i)
@endcode @endcode
*/ */
#define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \ #define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \
for (const LV2_Atom* (iter) = lv2_atom_tuple_begin(tuple); \
for (const LV2_Atom* iter = lv2_atom_tuple_begin(tuple); \
!lv2_atom_tuple_is_end(LV2_ATOM_BODY_CONST(tuple), (tuple)->atom.size, (iter)); \ !lv2_atom_tuple_is_end(LV2_ATOM_BODY_CONST(tuple), (tuple)->atom.size, (iter)); \
(iter) = lv2_atom_tuple_next(iter))
iter = lv2_atom_tuple_next(iter))


/** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */ /** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */
#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \ #define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \
for (const LV2_Atom* (iter) = (const LV2_Atom*)body; \
for (const LV2_Atom* iter = (const LV2_Atom*)body; \
!lv2_atom_tuple_is_end(body, size, (iter)); \ !lv2_atom_tuple_is_end(body, size, (iter)); \
(iter) = lv2_atom_tuple_next(iter))
iter = lv2_atom_tuple_next(iter))


/** /**
@} @}
@@ -283,15 +283,15 @@ lv2_atom_object_next(const LV2_Atom_Property_Body* i)
@endcode @endcode
*/ */
#define LV2_ATOM_OBJECT_FOREACH(obj, iter) \ #define LV2_ATOM_OBJECT_FOREACH(obj, iter) \
for (const LV2_Atom_Property_Body* (iter) = lv2_atom_object_begin(&(obj)->body); \
for (const LV2_Atom_Property_Body* iter = lv2_atom_object_begin(&(obj)->body); \
!lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \ !lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \
(iter) = lv2_atom_object_next(iter))
iter = lv2_atom_object_next(iter))


/** Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body. */ /** Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body. */
#define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter) \ #define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter) \
for (const LV2_Atom_Property_Body* (iter) = lv2_atom_object_begin(body); \
for (const LV2_Atom_Property_Body* iter = lv2_atom_object_begin(body); \
!lv2_atom_object_is_end(body, size, (iter)); \ !lv2_atom_object_is_end(body, size, (iter)); \
(iter) = lv2_atom_object_next(iter))
iter = lv2_atom_object_next(iter))


/** /**
@} @}


+ 2
- 2
source/modules/lilv/lilv-0.24.0/lilv/lilv.h View File

@@ -353,9 +353,9 @@ lilv_node_as_bool(const LilvNode* value);
@endcode @endcode
*/ */
#define LILV_FOREACH(colltype, iter, collection) \ #define LILV_FOREACH(colltype, iter, collection) \
for (LilvIter* (iter) = lilv_ ## colltype ## _begin(collection); \
for (LilvIter* iter = lilv_ ## colltype ## _begin(collection); \
!lilv_ ## colltype ## _is_end(collection, iter); \ !lilv_ ## colltype ## _is_end(collection, iter); \
(iter) = lilv_ ## colltype ## _next(collection, iter))
iter = lilv_ ## colltype ## _next(collection, iter))


/* LilvPluginClasses */ /* LilvPluginClasses */




+ 6
- 0
source/plugin/carla-lv2.cpp View File

@@ -25,6 +25,12 @@


#include "water/files/File.h" #include "water/files/File.h"


template<>
void Lv2PluginBaseClass<NativeTimeInfo>::clearTimeData() noexcept
{
fLastPositionData.clear();
carla_zeroStruct(fTimeInfo);
}


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// Carla Internal Plugin API exposed as LV2 plugin // Carla Internal Plugin API exposed as LV2 plugin


+ 31
- 15
source/utils/CarlaLv2Utils.hpp View File

@@ -646,8 +646,7 @@ public:


fWorker = worker; fWorker = worker;


carla_zeroStruct(fTimeInfo);
carla_zeroStruct(fLastPositionData);
clearTimeData();
} }


virtual ~Lv2PluginBaseClass() {} virtual ~Lv2PluginBaseClass() {}
@@ -1137,6 +1136,19 @@ protected:
virtual void handleBufferSizeChanged(const uint32_t bufferSize) = 0; virtual void handleBufferSizeChanged(const uint32_t bufferSize) = 0;
virtual void handleSampleRateChanged(const double sampleRate) = 0; virtual void handleSampleRateChanged(const double sampleRate) = 0;


void resetTimeInfo() noexcept
{
clearTimeData();

// hosts may not send all values, resulting on some invalid data
fTimeInfo.bbt.bar = 1;
fTimeInfo.bbt.beat = 1;
fTimeInfo.bbt.beatsPerBar = 4;
fTimeInfo.bbt.beatType = 4;
fTimeInfo.bbt.ticksPerBeat = fLastPositionData.ticksPerBeat = 960.0;
fTimeInfo.bbt.beatsPerMinute = fLastPositionData.beatsPerMinute = 120.0;
}

// LV2 host data // LV2 host data
bool fIsActive : 1; bool fIsActive : 1;
bool fIsOffline : 1; bool fIsOffline : 1;
@@ -1172,21 +1184,21 @@ protected:
frame(0), frame(0),
speed(0.0), speed(0.0),
ticksPerBeat(-1.0) {} ticksPerBeat(-1.0) {}
} fLastPositionData;


void resetTimeInfo()
{
carla_zeroStruct(fLastPositionData);
carla_zeroStruct(fTimeInfo);
void clear()
{
bar = -1;
bar_f = -1.0f;
barBeat = -1.0f;
beatUnit = 0;
beatsPerBar = 0.0f;
beatsPerMinute = -1.0;
frame = 0;
speed = 0.0;
ticksPerBeat = -1.0;
}


// hosts may not send all values, resulting on some invalid data
fTimeInfo.bbt.bar = 1;
fTimeInfo.bbt.beat = 1;
fTimeInfo.bbt.beatsPerBar = 4;
fTimeInfo.bbt.beatType = 4;
fTimeInfo.bbt.ticksPerBeat = fLastPositionData.ticksPerBeat = 960.0;
fTimeInfo.bbt.beatsPerMinute = fLastPositionData.beatsPerMinute = 120.0;
}
} fLastPositionData;


// Port stuff // Port stuff
struct Ports { struct Ports {
@@ -1546,6 +1558,10 @@ private:


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


void clearTimeData() noexcept;

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

CARLA_DECLARE_NON_COPY_STRUCT(Lv2PluginBaseClass) CARLA_DECLARE_NON_COPY_STRUCT(Lv2PluginBaseClass)
}; };




Loading…
Cancel
Save