From 80ee358523929fa2dc3a517d8ed9f6f1858dba68 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 03:07:07 +0200 Subject: [PATCH 1/7] Fix the class-memaccess warning --- src/sfizz/modulations/ModKey.cpp | 14 ++++++++--- src/sfizz/modulations/ModKey.h | 41 ++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/sfizz/modulations/ModKey.cpp b/src/sfizz/modulations/ModKey.cpp index 9750070c..051a4f8e 100644 --- a/src/sfizz/modulations/ModKey.cpp +++ b/src/sfizz/modulations/ModKey.cpp @@ -15,18 +15,26 @@ ModKey::Parameters::Parameters() noexcept // zero-fill the structure // 1. this ensures that non-used values will be always 0 // 2. this makes the object memcmp-comparable - std::memset(this, 0, sizeof(*this)); + std::memset( + static_cast(this), + 0, sizeof(RawParameters)); } ModKey::Parameters::Parameters(const Parameters& other) noexcept { - std::memcpy(this, &other, sizeof(*this)); + std::memcpy( + static_cast(this), + static_cast(&other), + sizeof(RawParameters)); } ModKey::Parameters& ModKey::Parameters::operator=(const Parameters& other) noexcept { if (this != &other) - std::memcpy(this, &other, sizeof(*this)); + std::memcpy( + static_cast(this), + static_cast(&other), + sizeof(RawParameters)); return *this; } diff --git a/src/sfizz/modulations/ModKey.h b/src/sfizz/modulations/ModKey.h index e3f484c4..ce16c7a2 100644 --- a/src/sfizz/modulations/ModKey.h +++ b/src/sfizz/modulations/ModKey.h @@ -42,24 +42,7 @@ public: bool isTarget() const noexcept; std::string toString() const; - struct Parameters { - Parameters() noexcept; - Parameters(const Parameters& other) noexcept; - Parameters& operator=(const Parameters& other) noexcept; - - Parameters(Parameters&&) = delete; - Parameters &operator=(Parameters&&) = delete; - - bool operator==(const Parameters& other) const noexcept - { - return std::memcmp(this, &other, sizeof(*this)) == 0; - } - - bool operator!=(const Parameters& other) const noexcept - { - return std::memcmp(this, &other, sizeof(*this)) != 0; - } - + struct RawParameters { union { //! Parameters if this key identifies a CC source struct { uint16_t cc; uint8_t curve, smooth; float step; }; @@ -71,6 +54,28 @@ public: }; }; + struct Parameters : RawParameters { + Parameters() noexcept; + Parameters(const Parameters& other) noexcept; + Parameters& operator=(const Parameters& other) noexcept; + + Parameters(Parameters&&) = delete; + Parameters &operator=(Parameters&&) = delete; + + bool operator==(const Parameters& other) const noexcept + { + return std::memcmp( + static_cast(this), + static_cast(&other), + sizeof(RawParameters)) == 0; + } + + bool operator!=(const Parameters& other) const noexcept + { + return !operator==(other); + } + }; + public: bool operator==(const ModKey &other) const noexcept { From 68d4e65ea53eb2b92d936c4e5da70b0d79eca5d5 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 16:15:41 +0200 Subject: [PATCH 2/7] Locally ignored "-Wmultichar" not working on gcc, make global --- cmake/SfizzConfig.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/SfizzConfig.cmake b/cmake/SfizzConfig.cmake index 95b0adaa..2b2cdd4a 100644 --- a/cmake/SfizzConfig.cmake +++ b/cmake/SfizzConfig.cmake @@ -57,6 +57,7 @@ endif() if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") add_compile_options(-Wall) add_compile_options(-Wextra) + add_compile_options(-Wno-multichar) add_compile_options(-Werror=return-type) if (SFIZZ_SYSTEM_PROCESSOR MATCHES "^(i.86|x86_64)$") add_compile_options(-msse2) From 6af2bc5bc09c065efeab91524a6f14d89f26b310 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 16:17:01 +0200 Subject: [PATCH 3/7] Remove some functions no longer used --- editor/tools/layout-maker/sources/reader.cpp | 61 -------------------- 1 file changed, 61 deletions(-) diff --git a/editor/tools/layout-maker/sources/reader.cpp b/editor/tools/layout-maker/sources/reader.cpp index 788f93d7..5890951b 100644 --- a/editor/tools/layout-maker/sources/reader.cpp +++ b/editor/tools/layout-maker/sources/reader.cpp @@ -86,67 +86,6 @@ static int consume_real_token(TokenList::iterator &tok_it, TokenList::iterator t return std::stod(text); } -static void consume_image_properties(LayoutImage &image, TokenList::iterator &tok_it, TokenList::iterator tok_end) -{ - for (bool have = true; have;) { - if (try_consume_next_token("xywh", tok_it, tok_end)) { - ensure_next_token("{", tok_it, tok_end); - image.x = consume_int_token(tok_it, tok_end); - image.y = consume_int_token(tok_it, tok_end); - image.w = consume_int_token(tok_it, tok_end); - image.h = consume_int_token(tok_it, tok_end); - ensure_next_token("}", tok_it, tok_end); - } - else - have = false; - } -} - -// static void consume_layout_item_properties(LayoutItem &item, TokenList::iterator &tok_it, TokenList::iterator tok_end) -// { -// ensure_next_token("{", tok_it, tok_end); -// for (std::string text; (text = consume_next_token(tok_it, tok_end)) != "}";) { -// if (text == "open" || text == "selected") -// ; // skip -// else if (text == "label") -// item.label = consume_any_string(tok_it, tok_end); -// else if (text == "xywh") { -// ensure_next_token("{", tok_it, tok_end); -// item.x = consume_int_token(tok_it, tok_end); -// item.y = consume_int_token(tok_it, tok_end); -// item.w = consume_int_token(tok_it, tok_end); -// item.h = consume_int_token(tok_it, tok_end); -// ensure_next_token("}", tok_it, tok_end); -// } -// else if (text == "box") -// item.box = consume_next_token(tok_it, tok_end); -// else if (text == "labelfont") -// item.labelfont = consume_int_token(tok_it, tok_end); -// else if (text == "labelsize") -// item.labelsize = consume_int_token(tok_it, tok_end); -// else if (text == "labeltype") -// item.labeltype = consume_any_string(tok_it, tok_end); -// else if (text == "align") -// item.align = consume_int_token(tok_it, tok_end); -// else if (text == "type") -// item.type = consume_any_string(tok_it, tok_end); -// else if (text == "callback") -// item.callback = consume_any_string(tok_it, tok_end); -// else if (text == "class") -// item.classname = consume_any_string(tok_it, tok_end); -// else if (text == "minimum") -// item.minimum = consume_real_token(tok_it, tok_end); -// else if (text == "maximum") -// item.maximum = consume_real_token(tok_it, tok_end); -// else if (text == "step") -// item.step = consume_real_token(tok_it, tok_end); -// else if (text == "image") { -// item.image.filepath = consume_any_string(tok_it, tok_end); -// consume_image_properties(item.image, tok_it, tok_end); -// } -// } -// } - static void consume_layout_item_properties(LayoutItem &item, TokenList::iterator &tok_it, TokenList::iterator tok_end) { ensure_next_token("{", tok_it, tok_end); From 0f426786d23f433dacbdc027eaaffb283e9e57e9 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 16:41:50 +0200 Subject: [PATCH 4/7] Update vstgui to eliminate the CRect warning --- editor/external/vstgui4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/external/vstgui4 b/editor/external/vstgui4 index a8a546b8..dbb9a427 160000 --- a/editor/external/vstgui4 +++ b/editor/external/vstgui4 @@ -1 +1 @@ -Subproject commit a8a546b89ebef7e263125b2f5859a3a365884cc6 +Subproject commit dbb9a42742eb42826f2fe15bd047bae0adb13b58 From c17a3f855441dadc262decf89234b227ea42b7a0 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 16:44:11 +0200 Subject: [PATCH 5/7] Eliminate -Wparentheses in LV2 --- lv2/lv2/atom/util.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lv2/lv2/atom/util.h b/lv2/lv2/atom/util.h index 051a3cb2..9c372aab 100644 --- a/lv2/lv2/atom/util.h +++ b/lv2/lv2/atom/util.h @@ -122,13 +122,13 @@ lv2_atom_sequence_next(const LV2_Atom_Event* i) @endcode */ #define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \ - for (LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(&(seq)->body); \ + for (LV2_Atom_Event* iter = lv2_atom_sequence_begin(&(seq)->body); \ !lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \ (iter) = lv2_atom_sequence_next(iter)) /** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */ #define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \ - for (LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(body); \ + for (LV2_Atom_Event* iter = lv2_atom_sequence_begin(body); \ !lv2_atom_sequence_is_end(body, size, (iter)); \ (iter) = lv2_atom_sequence_next(iter)) @@ -219,13 +219,13 @@ lv2_atom_tuple_next(const LV2_Atom* i) @endcode */ #define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \ - for (LV2_Atom* (iter) = lv2_atom_tuple_begin(tuple); \ + for (LV2_Atom* iter = lv2_atom_tuple_begin(tuple); \ !lv2_atom_tuple_is_end(LV2_ATOM_BODY(tuple), (tuple)->atom.size, (iter)); \ (iter) = lv2_atom_tuple_next(iter)) /** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */ #define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \ - for (LV2_Atom* (iter) = (LV2_Atom*)(body); \ + for (LV2_Atom* iter = (LV2_Atom*)(body); \ !lv2_atom_tuple_is_end(body, size, (iter)); \ (iter) = lv2_atom_tuple_next(iter)) @@ -275,13 +275,13 @@ lv2_atom_object_next(const LV2_Atom_Property_Body* i) @endcode */ #define LV2_ATOM_OBJECT_FOREACH(obj, iter) \ - for (LV2_Atom_Property_Body* (iter) = lv2_atom_object_begin(&(obj)->body); \ + for (LV2_Atom_Property_Body* iter = lv2_atom_object_begin(&(obj)->body); \ !lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \ (iter) = lv2_atom_object_next(iter)) /** Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body. */ #define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter) \ - for (LV2_Atom_Property_Body* (iter) = lv2_atom_object_begin(body); \ + for (LV2_Atom_Property_Body* iter = lv2_atom_object_begin(body); \ !lv2_atom_object_is_end(body, size, (iter)); \ (iter) = lv2_atom_object_next(iter)) From 191a23232777f899f7424168f41a9b335bdebb13 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 17:13:04 +0200 Subject: [PATCH 6/7] Eliminate a warning with win32 format --- editor/src/editor/Editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/src/editor/Editor.cpp b/editor/src/editor/Editor.cpp index b936065f..ed235ecc 100644 --- a/editor/src/editor/Editor.cpp +++ b/editor/src/editor/Editor.cpp @@ -590,7 +590,7 @@ void Editor::Impl::createFrameContents() for (int log2value = 10; log2value <= 16; ++log2value) { int value = 1 << log2value; char text[256]; - sprintf(text, "%lu kB", value / 1024 * sizeof(float)); + sprintf(text, "%lu kB", static_cast(value / 1024 * sizeof(float))); text[sizeof(text) - 1] = '\0'; preloadSizeSlider_->addEntry(text, value); } From 7a39d6c7cf2e5ee5ffd22d4e3edd267c3dd56ea1 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sat, 10 Oct 2020 17:15:45 +0200 Subject: [PATCH 7/7] Eliminate more warnings from Steinberg VST --- vst/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vst/CMakeLists.txt b/vst/CMakeLists.txt index cddf56b2..ecbbab4a 100644 --- a/vst/CMakeLists.txt +++ b/vst/CMakeLists.txt @@ -108,7 +108,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") "-Wno-unknown-pragmas" "-Wno-unused-function" "-Wno-unused-parameter" - "-Wno-unused-variable") + "-Wno-unused-variable" + "-Wno-format") endif() # To help debugging the link only @@ -292,7 +293,8 @@ elseif(SFIZZ_AU) "-Wno-unknown-pragmas" "-Wno-unused-function" "-Wno-unused-parameter" - "-Wno-unused-variable") + "-Wno-unused-variable" + "-Wno-format") endif() # Installation