Browse Source

Fix CarlaBackend.h for ANSI (pedantic)

tags/1.9.6
falkTX 11 years ago
parent
commit
bc2c5b2659
3 changed files with 90 additions and 69 deletions
  1. +48
    -48
      source/backend/CarlaBackend.h
  2. +40
    -19
      source/tests/Makefile
  3. +2
    -2
      source/tests/ansi-pedantic-test.c

+ 48
- 48
source/backend/CarlaBackend.h View File

@@ -51,23 +51,23 @@ CARLA_BACKEND_START_NAMESPACE
/*!
* Maximum default number of loadable plugins.
*/
const uint MAX_DEFAULT_PLUGINS = 99;
static const uint MAX_DEFAULT_PLUGINS = 99;

/*!
* Maximum number of loadable plugins in rack mode.
*/
const uint MAX_RACK_PLUGINS = 16;
static const uint MAX_RACK_PLUGINS = 16;

/*!
* Maximum number of loadable plugins in patchbay mode.
*/
const uint MAX_PATCHBAY_PLUGINS = 255;
static const uint MAX_PATCHBAY_PLUGINS = 255;

/*!
* Maximum default number of parameters allowed.
* @see ENGINE_OPTION_MAX_PARAMETERS
*/
const uint MAX_DEFAULT_PARAMETERS = 200;
static const uint MAX_DEFAULT_PARAMETERS = 200;

/* ------------------------------------------------------------------------------------------------------------
* Engine Driver Device Hints */
@@ -83,25 +83,25 @@ const uint MAX_DEFAULT_PARAMETERS = 200;
/*!
* Engine driver device has custom control-panel.
*/
const uint ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1;
static const uint ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1;

/*!
* Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
* @see ENGINE_OPTION_AUDIO_NUM_PERIODS
*/
const uint ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2;
static const uint ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2;

/*!
* Engine driver device can change buffer-size on the fly.
* @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
*/
const uint ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4;
static const uint ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4;

/*!
* Engine driver device can change sample-rate on the fly.
* @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
*/
const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;
static const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;

/** @} */

@@ -120,53 +120,53 @@ const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;
* Plugin is a bridge.
* This hint is required because "bridge" itself is not a plugin type.
*/
const uint PLUGIN_IS_BRIDGE = 0x001;
static const uint PLUGIN_IS_BRIDGE = 0x001;

/*!
* Plugin is hard real-time safe.
*/
const uint PLUGIN_IS_RTSAFE = 0x002;
static const uint PLUGIN_IS_RTSAFE = 0x002;

/*!
* Plugin is a synth (produces sound).
*/
const uint PLUGIN_IS_SYNTH = 0x004;
static const uint PLUGIN_IS_SYNTH = 0x004;

/*!
* Plugin has its own custom UI.
* @see CarlaPlugin::showCustomUI() and carla_show_custom_ui()
*/
const uint PLUGIN_HAS_CUSTOM_UI = 0x008;
static const uint PLUGIN_HAS_CUSTOM_UI = 0x008;

/*!
* Plugin can use internal Dry/Wet control.
*/
const uint PLUGIN_CAN_DRYWET = 0x010;
static const uint PLUGIN_CAN_DRYWET = 0x010;

/*!
* Plugin can use internal Volume control.
*/
const uint PLUGIN_CAN_VOLUME = 0x020;
static const uint PLUGIN_CAN_VOLUME = 0x020;

/*!
* Plugin can use internal (Stereo) Balance controls.
*/
const uint PLUGIN_CAN_BALANCE = 0x040;
static const uint PLUGIN_CAN_BALANCE = 0x040;

/*!
* Plugin can use internal (Mono) Panning control.
*/
const uint PLUGIN_CAN_PANNING = 0x080;
static const uint PLUGIN_CAN_PANNING = 0x080;

/*!
* Plugin needs a constant, fixed-size audio buffer.
*/
const uint PLUGIN_NEEDS_FIXED_BUFFERS = 0x100;
static const uint PLUGIN_NEEDS_FIXED_BUFFERS = 0x100;

/*!
* Plugin needs all UI events in a single/main thread.
*/
const uint PLUGIN_NEEDS_SINGLE_THREAD = 0x200;
static const uint PLUGIN_NEEDS_SINGLE_THREAD = 0x200;

/** @} */

@@ -184,53 +184,53 @@ const uint PLUGIN_NEEDS_SINGLE_THREAD = 0x200;
/*!
* Use constant/fixed-size audio buffers.
*/
const uint PLUGIN_OPTION_FIXED_BUFFERS = 0x001;
static const uint PLUGIN_OPTION_FIXED_BUFFERS = 0x001;

/*!
* Force mono plugin as stereo.
*/
const uint PLUGIN_OPTION_FORCE_STEREO = 0x002;
static const uint PLUGIN_OPTION_FORCE_STEREO = 0x002;

/*!
* Map MIDI programs to plugin programs.
*/
const uint PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004;
static const uint PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004;

/*!
* Use chunks to save and restore data instead of parameter values.
*/
const uint PLUGIN_OPTION_USE_CHUNKS = 0x008;
static const uint PLUGIN_OPTION_USE_CHUNKS = 0x008;

/*!
* Send MIDI control change events.
*/
const uint PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010;
static const uint PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010;

/*!
* Send MIDI channel pressure events.
*/
const uint PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020;
static const uint PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020;

/*!
* Send MIDI note after-touch events.
*/
const uint PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040;
static const uint PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040;

/*!
* Send MIDI pitch-bend events.
*/
const uint PLUGIN_OPTION_SEND_PITCHBEND = 0x080;
static const uint PLUGIN_OPTION_SEND_PITCHBEND = 0x080;

/*!
* Send MIDI all-sounds/notes-off events, single note-offs otherwise.
*/
const uint PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100;
static const uint PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100;

/*!
* Send MIDI bank/program changes.
* @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
*/
const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;
static const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;

/** @} */

@@ -249,51 +249,51 @@ const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;
* Parameter value is boolean.
* It's always at either minimum or maximum value.
*/
const uint PARAMETER_IS_BOOLEAN = 0x001;
static const uint PARAMETER_IS_BOOLEAN = 0x001;

/*!
* Parameter value is integer.
*/
const uint PARAMETER_IS_INTEGER = 0x002;
static const uint PARAMETER_IS_INTEGER = 0x002;

/*!
* Parameter value is logarithmic.
*/
const uint PARAMETER_IS_LOGARITHMIC = 0x004;
static const uint PARAMETER_IS_LOGARITHMIC = 0x004;

/*!
* Parameter is enabled.
* It can be viewed, changed and stored.
*/
const uint PARAMETER_IS_ENABLED = 0x010;
static const uint PARAMETER_IS_ENABLED = 0x010;

/*!
* Parameter is automable (real-time safe).
*/
const uint PARAMETER_IS_AUTOMABLE = 0x020;
static const uint PARAMETER_IS_AUTOMABLE = 0x020;

/*!
* Parameter is read-only.
* It cannot be changed.
*/
const uint PARAMETER_IS_READ_ONLY = 0x040;
static const uint PARAMETER_IS_READ_ONLY = 0x040;

/*!
* Parameter needs sample rate to work.
* Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
*/
const uint PARAMETER_USES_SAMPLERATE = 0x100;
static const uint PARAMETER_USES_SAMPLERATE = 0x100;

/*!
* Parameter uses scale points to define internal values in a meaningful way.
*/
const uint PARAMETER_USES_SCALEPOINTS = 0x200;
static const uint PARAMETER_USES_SCALEPOINTS = 0x200;

/*!
* Parameter uses custom text for displaying its value.
* @see CarlaPlugin::getParameterText() and carla_get_parameter_text()
*/
const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;
static const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;

/** @} */

@@ -311,22 +311,22 @@ const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;
* Patchbay port is input.
* When this hint is not set, port is assumed to be output.
*/
const uint PATCHBAY_PORT_IS_INPUT = 0x1;
static const uint PATCHBAY_PORT_IS_INPUT = 0x1;

/*!
* Patchbay port is of Audio type.
*/
const uint PATCHBAY_PORT_TYPE_AUDIO = 0x2;
static const uint PATCHBAY_PORT_TYPE_AUDIO = 0x2;

/*!
* Patchbay port is of CV type (Control Voltage).
*/
const uint PATCHBAY_PORT_TYPE_CV = 0x4;
static const uint PATCHBAY_PORT_TYPE_CV = 0x4;

/*!
* Patchbay port is of MIDI type.
*/
const uint PATCHBAY_PORT_TYPE_MIDI = 0x8;
static const uint PATCHBAY_PORT_TYPE_MIDI = 0x8;

/** @} */

@@ -345,17 +345,17 @@ const uint PATCHBAY_PORT_TYPE_MIDI = 0x8;
* Boolean string type URI.
* Only "true" and "false" are valid values.
*/
const char* const CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean";
static const char* const CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean";

/*!
* Chunk type URI.
*/
const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk";
static const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk";

/*!
* String type URI.
*/
const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string";
static const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string";

/** @} */

@@ -373,22 +373,22 @@ const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/str
/*!
* Plugin options key.
*/
const char* const CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions";
static const char* const CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions";

/*!
* UI position key.
*/
const char* const CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition";
static const char* const CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition";

/*!
* UI size key.
*/
const char* const CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize";
static const char* const CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize";

/*!
* UI visible key.
*/
const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible";
static const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible";

/** @} */



+ 40
- 19
source/tests/Makefile View File

@@ -6,6 +6,11 @@

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

CLANG ?= clang
CXXLANG ?= clang++

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

BASE_FLAGS = -Wall -Wextra -Werror -pipe -DREAL_BUILD -DDEBUG -O0 -g
BASE_FLAGS += -I. -I../backend -I../includes -I../modules -I../utils
BASE_FLAGS += -Wcast-align -Wcast-qual -Wconversion -Wmissing-declarations -Wsign-conversion
@@ -19,7 +24,7 @@ endif
# --------------------------------------------------------------

ANSI_FLAGS = $(BASE_FLAGS) -DBUILD_ANSI_TEST
ANSI_FLAGS += -ansi -pedantic -pedantic-errors -Waggregate-return
# ANSI_FLAGS += -ansi -pedantic -pedantic-errors -Waggregate-return
# ANSI_FLAGS += -L../backend -lcarla_standalone2

# --------------------------------------------------------------
@@ -44,20 +49,24 @@ endif

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

TARGETS = ansi-pedantic-test_c89
TARGETS = ansi-pedantic-test_c_ansi
TARGETS += ansi-pedantic-test_c89
TARGETS += ansi-pedantic-test_c99
TARGETS += ansi-pedantic-test_c11
TARGETS += ansi-pedantic-test_clang
TARGETS += ansi-pedantic-test_cxx_ansi
TARGETS += ansi-pedantic-test_cxx03
TARGETS += ansi-pedantic-test_cxx11
TARGETS += ansi-pedantic-test_cxxlang
TARGETS += CarlaRingBuffer
TARGETS += CarlaString
TARGETS += CarlaUtils1
ifneq ($(WIN32),true)
TARGETS += CarlaUtils2
endif
TARGETS += CarlaUtils3
TARGETS += CarlaUtils4
TARGETS += Exceptions
# TARGETS += CarlaUtils1
# ifneq ($(WIN32),true)
# TARGETS += CarlaUtils2
# endif
# TARGETS += CarlaUtils3
# TARGETS += CarlaUtils4
# TARGETS += Exceptions
TARGETS += Print
TARGETS += RDF

@@ -65,6 +74,9 @@ all: $(TARGETS)

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

ansi-pedantic-test_c_ansi: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CC) $< $(ANSI_FLAGS) -ansi -pedantic -pedantic-errors -Wc++-compat -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_c89: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CC) $< $(ANSI_FLAGS) -std=c89 -pedantic -pedantic-errors -Wc++-compat -L../../bin -lcarla_standalone2 -o $@

@@ -74,24 +86,33 @@ ansi-pedantic-test_c99: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
ansi-pedantic-test_c11: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CC) $< $(ANSI_FLAGS) -std=c11 -pedantic -pedantic-errors -Wc++-compat -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_clang: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CLANG) $< $(ANSI_FLAGS) -ansi -pedantic -pedantic-errors -Wc++-compat -Weverything -Wno-padded -Wno-unknown-warning-option -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_cxx_ansi: ansi-pedantic-test.cpp ../backend/Carla*.h ../includes/*.h
$(CXX) $< $(ANSI_FLAGS) -ansi -pedantic -pedantic-errors -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_cxx03: ansi-pedantic-test.cpp ../backend/Carla*.h ../includes/*.h
$(CXX) $< $(ANSI_FLAGS) -std=c++11 -pedantic -pedantic-errors -L../../bin -lcarla_standalone2 -o $@
$(CXX) $< $(ANSI_FLAGS) -std=c++03 -pedantic -pedantic-errors -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_cxx11: ansi-pedantic-test.cpp ../backend/Carla*.h ../includes/*.h
$(CXX) $< $(ANSI_FLAGS) -std=c++11 -pedantic -pedantic-errors -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_cxxlang: ansi-pedantic-test.cpp ../backend/Carla*.h ../includes/*.h
$(CXXLANG) $< $(ANSI_FLAGS) -ansi -pedantic -pedantic-errors -Weverything -Wno-padded -Wno-unknown-warning-option -L../../bin -lcarla_standalone2 -o $@

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

CarlaRingBuffer: CarlaRingBuffer.cpp ../utils/CarlaRingBuffer.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

CarlaString: CarlaString.cpp ../utils/CarlaString.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

CarlaPipeUtils: CarlaPipeUtils.cpp
@@ -103,43 +124,43 @@ CarlaPipeUtils.exe: CarlaPipeUtils.cpp
CarlaUtils1: CarlaUtils1.cpp ../utils/*.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

CarlaUtils2: CarlaUtils2.cpp ../utils/*.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ \
../modules/juce_core.a ../modules/lilv.a -ldl -lpthread -lrt
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@

CarlaUtils3: CarlaUtils3.cpp ../utils/*.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ -ldl -lrt
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

CarlaUtils4: CarlaUtils4.cpp ../utils/CarlaStateUtils.cpp ../utils/*.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ \
../modules/juce_core.a -ldl -lpthread -lrt
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

Exceptions: Exceptions.cpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

Print: Print.cpp ../utils/CarlaUtils.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

RDF: RDF.cpp ../modules/ladspa_rdf.hpp ../modules/lv2_rdf.hpp
$(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@
ifneq ($(WIN32),true)
./$@ && valgrind --leak-check=full ./$@
set -e; ./$@ && valgrind --leak-check=full ./$@
endif

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


+ 2
- 2
source/tests/ansi-pedantic-test.c View File

@@ -124,8 +124,6 @@ int main(int argc, char* argv[])
EngineTimeInfo e6;
#endif

return 0;

/* unused C */
(void)argc;
(void)argv;
@@ -134,4 +132,6 @@ int main(int argc, char* argv[])
#ifdef __cplusplus
(void)e1; (void)e2; (void)e4; (void)e5; (void)e6;
#endif

return 0;
}

Loading…
Cancel
Save