From a26fc7a1fb462d70a6f8c23f315828ab9ec35b52 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Wed, 11 Mar 2020 00:18:18 +0100 Subject: [PATCH] Changed maybe unused into comments or macros --- benchmarks/BM_ADSR.cpp | 2 +- benchmarks/BM_add.cpp | 5 +++-- benchmarks/BM_clock.cpp | 4 ++-- benchmarks/BM_copy.cpp | 2 +- benchmarks/BM_cumsum.cpp | 2 +- benchmarks/BM_diff.cpp | 2 +- benchmarks/BM_divide.cpp | 2 +- benchmarks/BM_envelopes.cpp | 2 +- benchmarks/BM_filterModulation.cpp | 2 +- benchmarks/BM_filterStereoMono.cpp | 2 +- benchmarks/BM_flacfile.cpp | 4 ++-- benchmarks/BM_gain.cpp | 4 ++-- benchmarks/BM_interpolationCast.cpp | 2 +- benchmarks/BM_logger.cpp | 4 ++-- benchmarks/BM_looping.cpp | 2 +- benchmarks/BM_maps.cpp | 2 +- benchmarks/BM_mathfuns.cpp | 2 +- benchmarks/BM_mean.cpp | 2 +- benchmarks/BM_meanSquared.cpp | 2 +- benchmarks/BM_multiplyAdd.cpp | 2 +- benchmarks/BM_multiplyAddFixedGain.cpp | 2 +- benchmarks/BM_pan.cpp | 2 +- benchmarks/BM_pointerIterationOrOffsets.cpp | 4 ++-- benchmarks/BM_readChunk.cpp | 2 +- benchmarks/BM_resample.cpp | 2 +- benchmarks/BM_resampleChunk.cpp | 2 +- benchmarks/BM_saturating.cpp | 2 +- benchmarks/BM_subtract.cpp | 2 +- benchmarks/BM_wavfile.cpp | 4 ++-- benchmarks/BM_widthPos.cpp | 2 +- clients/jack_client.cpp | 12 +++++++----- src/sfizz/EGDescription.h | 4 +++- src/sfizz/Macros.h | 9 +++++++++ src/sfizz/MidiState.cpp | 5 +++-- src/sfizz/Region.cpp | 3 ++- src/sfizz/SIMDNEON.cpp | 8 ++++---- src/sfizz/SIMDSSE.cpp | 8 ++++---- src/sfizz/Synth.cpp | 4 +++- src/sfizz/Voice.cpp | 12 +++++++++--- src/sfizz/sfizz_wrapper.cpp | 2 +- 40 files changed, 83 insertions(+), 59 deletions(-) create mode 100644 src/sfizz/Macros.h diff --git a/benchmarks/BM_ADSR.cpp b/benchmarks/BM_ADSR.cpp index c74735b6..4b781070 100644 --- a/benchmarks/BM_ADSR.cpp +++ b/benchmarks/BM_ADSR.cpp @@ -30,7 +30,7 @@ public: output.resize(state.range(0)); } - void TearDown(const ::benchmark::State &state[[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_add.cpp b/benchmarks/BM_add.cpp index 9a78a9e2..893b2392 100644 --- a/benchmarks/BM_add.cpp +++ b/benchmarks/BM_add.cpp @@ -5,6 +5,7 @@ // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz #include "SIMDHelpers.h" +#include "Macros.h" #include #include #include @@ -24,8 +25,8 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { - + void TearDown(const ::benchmark::State& state) { + UNUSED(state); } std::vector input; diff --git a/benchmarks/BM_clock.cpp b/benchmarks/BM_clock.cpp index e1a263a3..ea4028b7 100644 --- a/benchmarks/BM_clock.cpp +++ b/benchmarks/BM_clock.cpp @@ -9,11 +9,11 @@ class Clock : public benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state) { + void SetUp(const ::benchmark::State& /* state */) { } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_copy.cpp b/benchmarks/BM_copy.cpp index e3c8a5b5..20d4f088 100644 --- a/benchmarks/BM_copy.cpp +++ b/benchmarks/BM_copy.cpp @@ -24,7 +24,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_cumsum.cpp b/benchmarks/BM_cumsum.cpp index 9b3523e6..c8626848 100644 --- a/benchmarks/BM_cumsum.cpp +++ b/benchmarks/BM_cumsum.cpp @@ -23,7 +23,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_diff.cpp b/benchmarks/BM_diff.cpp index 44fcfe03..af50441d 100644 --- a/benchmarks/BM_diff.cpp +++ b/benchmarks/BM_diff.cpp @@ -25,7 +25,7 @@ public: sfz::cumsum(input, absl::MakeSpan(input)); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_divide.cpp b/benchmarks/BM_divide.cpp index 370c0e33..b4fed561 100644 --- a/benchmarks/BM_divide.cpp +++ b/benchmarks/BM_divide.cpp @@ -26,7 +26,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_envelopes.cpp b/benchmarks/BM_envelopes.cpp index 63b9582d..67ec5dcf 100644 --- a/benchmarks/BM_envelopes.cpp +++ b/benchmarks/BM_envelopes.cpp @@ -23,7 +23,7 @@ public: sfz::cumsum(input, absl::MakeSpan(input)); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_filterModulation.cpp b/benchmarks/BM_filterModulation.cpp index e03a3d5e..9326e21f 100644 --- a/benchmarks/BM_filterModulation.cpp +++ b/benchmarks/BM_filterModulation.cpp @@ -32,7 +32,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } std::random_device rd { }; diff --git a/benchmarks/BM_filterStereoMono.cpp b/benchmarks/BM_filterStereoMono.cpp index 40ab97ba..16185812 100644 --- a/benchmarks/BM_filterStereoMono.cpp +++ b/benchmarks/BM_filterStereoMono.cpp @@ -35,7 +35,7 @@ public: std::generate(inputRight.begin(), inputRight.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } std::random_device rd { }; diff --git a/benchmarks/BM_flacfile.cpp b/benchmarks/BM_flacfile.cpp index f13c2323..e6fbd18e 100644 --- a/benchmarks/BM_flacfile.cpp +++ b/benchmarks/BM_flacfile.cpp @@ -18,7 +18,7 @@ class FileFixture : public benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state [[maybe_unused]]) { + void SetUp(const ::benchmark::State& state) { filePath1 = getPath() / "sample1.flac"; filePath2 = getPath() / "sample2.flac"; filePath3 = getPath() / "sample3.flac"; @@ -32,7 +32,7 @@ public: } } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } ghc::filesystem::path getPath() diff --git a/benchmarks/BM_gain.cpp b/benchmarks/BM_gain.cpp index 0aafea1e..cb355f1f 100644 --- a/benchmarks/BM_gain.cpp +++ b/benchmarks/BM_gain.cpp @@ -24,7 +24,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } @@ -46,7 +46,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_interpolationCast.cpp b/benchmarks/BM_interpolationCast.cpp index 409bd62d..ea12845a 100644 --- a/benchmarks/BM_interpolationCast.cpp +++ b/benchmarks/BM_interpolationCast.cpp @@ -28,7 +28,7 @@ public: absl::c_generate(floatJumps, [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_logger.cpp b/benchmarks/BM_logger.cpp index a52bef57..0a1dc12e 100644 --- a/benchmarks/BM_logger.cpp +++ b/benchmarks/BM_logger.cpp @@ -10,11 +10,11 @@ class Logger : public benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state) { + void SetUp(const ::benchmark::State& /* state */) { } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_looping.cpp b/benchmarks/BM_looping.cpp index 7558a8ce..6a465ffc 100644 --- a/benchmarks/BM_looping.cpp +++ b/benchmarks/BM_looping.cpp @@ -30,7 +30,7 @@ public: absl::c_generate(jumps, [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_maps.cpp b/benchmarks/BM_maps.cpp index 88edd380..d15d5419 100644 --- a/benchmarks/BM_maps.cpp +++ b/benchmarks/BM_maps.cpp @@ -36,7 +36,7 @@ public: }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_mathfuns.cpp b/benchmarks/BM_mathfuns.cpp index 245a283f..aa11b966 100644 --- a/benchmarks/BM_mathfuns.cpp +++ b/benchmarks/BM_mathfuns.cpp @@ -26,7 +26,7 @@ public: std::generate(source.begin(), source.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_mean.cpp b/benchmarks/BM_mean.cpp index 38df9d08..5ea0cc93 100644 --- a/benchmarks/BM_mean.cpp +++ b/benchmarks/BM_mean.cpp @@ -23,7 +23,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_meanSquared.cpp b/benchmarks/BM_meanSquared.cpp index e1741f5f..41468cc0 100644 --- a/benchmarks/BM_meanSquared.cpp +++ b/benchmarks/BM_meanSquared.cpp @@ -23,7 +23,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_multiplyAdd.cpp b/benchmarks/BM_multiplyAdd.cpp index 9f70897b..4bb01e3b 100644 --- a/benchmarks/BM_multiplyAdd.cpp +++ b/benchmarks/BM_multiplyAdd.cpp @@ -26,7 +26,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_multiplyAddFixedGain.cpp b/benchmarks/BM_multiplyAddFixedGain.cpp index 919516b2..e05635ba 100644 --- a/benchmarks/BM_multiplyAddFixedGain.cpp +++ b/benchmarks/BM_multiplyAddFixedGain.cpp @@ -26,7 +26,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_pan.cpp b/benchmarks/BM_pan.cpp index b3f522e8..130f466e 100644 --- a/benchmarks/BM_pan.cpp +++ b/benchmarks/BM_pan.cpp @@ -33,7 +33,7 @@ public: span2 = absl::MakeSpan(temp2); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_pointerIterationOrOffsets.cpp b/benchmarks/BM_pointerIterationOrOffsets.cpp index 58fc2b32..0e157af9 100644 --- a/benchmarks/BM_pointerIterationOrOffsets.cpp +++ b/benchmarks/BM_pointerIterationOrOffsets.cpp @@ -14,7 +14,7 @@ constexpr int bigNumber { 2399132 }; class IterOffset : public benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state [[maybe_unused]]) { + void SetUp(const ::benchmark::State& /* state */) { std::random_device rd { }; std::mt19937 gen { rd() }; std::uniform_real_distribution dist { 0.001f, 1.0f }; @@ -28,7 +28,7 @@ public: sfz::cumsum(jumps, absl::MakeSpan(offsets)); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_readChunk.cpp b/benchmarks/BM_readChunk.cpp index 9d2a2823..9ee46ffe 100644 --- a/benchmarks/BM_readChunk.cpp +++ b/benchmarks/BM_readChunk.cpp @@ -33,7 +33,7 @@ public: output = std::make_unique>(sndfile.channels(), sndfile.frames()); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } ghc::filesystem::path getPath() diff --git a/benchmarks/BM_resample.cpp b/benchmarks/BM_resample.cpp index f3d763ca..17233b78 100644 --- a/benchmarks/BM_resample.cpp +++ b/benchmarks/BM_resample.cpp @@ -206,7 +206,7 @@ public: sndfile.readf(interleavedBuffer->data(), sndfile.frames()); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_resampleChunk.cpp b/benchmarks/BM_resampleChunk.cpp index 189af8b5..b5c37905 100644 --- a/benchmarks/BM_resampleChunk.cpp +++ b/benchmarks/BM_resampleChunk.cpp @@ -78,7 +78,7 @@ public: output = std::make_unique>(sndfile.channels(), numFrames * 4); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } ghc::filesystem::path getPath() diff --git a/benchmarks/BM_saturating.cpp b/benchmarks/BM_saturating.cpp index c69ad18b..d6bb2427 100644 --- a/benchmarks/BM_saturating.cpp +++ b/benchmarks/BM_saturating.cpp @@ -29,7 +29,7 @@ public: absl::c_generate(jumps, [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_subtract.cpp b/benchmarks/BM_subtract.cpp index 3bfd75d1..afc8fc95 100644 --- a/benchmarks/BM_subtract.cpp +++ b/benchmarks/BM_subtract.cpp @@ -24,7 +24,7 @@ public: std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/benchmarks/BM_wavfile.cpp b/benchmarks/BM_wavfile.cpp index badc4e5d..d7d590c2 100644 --- a/benchmarks/BM_wavfile.cpp +++ b/benchmarks/BM_wavfile.cpp @@ -17,7 +17,7 @@ class FileFixture : public benchmark::Fixture { public: - void SetUp(const ::benchmark::State& state [[maybe_unused]]) { + void SetUp(const ::benchmark::State& state) { filePath1 = getPath() / "sample1.wav"; filePath2 = getPath() / "sample2.wav"; filePath3 = getPath() / "sample3.wav"; @@ -31,7 +31,7 @@ public: } } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } ghc::filesystem::path getPath() diff --git a/benchmarks/BM_widthPos.cpp b/benchmarks/BM_widthPos.cpp index 312a029a..1ab9fa7d 100644 --- a/benchmarks/BM_widthPos.cpp +++ b/benchmarks/BM_widthPos.cpp @@ -37,7 +37,7 @@ public: span3 = absl::MakeSpan(temp3); } - void TearDown(const ::benchmark::State& state [[maybe_unused]]) { + void TearDown(const ::benchmark::State& /* state */) { } diff --git a/clients/jack_client.cpp b/clients/jack_client.cpp index 7aee82d2..f8ad63f8 100644 --- a/clients/jack_client.cpp +++ b/clients/jack_client.cpp @@ -22,6 +22,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sfizz/Synth.h" +#include "sfizz/Macros.h" #include #include #include @@ -70,9 +71,9 @@ constexpr int buildAndCenterPitch(uint8_t firstByte, uint8_t secondByte) } } -static std::atomic keepRunning [[maybe_unused]] { true }; +static std::atomic keepRunning { true }; -int process(jack_nframes_t numFrames, void* arg [[maybe_unused]]) +int process(jack_nframes_t numFrames, void* arg) { auto synth = reinterpret_cast(arg); @@ -129,7 +130,7 @@ int process(jack_nframes_t numFrames, void* arg [[maybe_unused]]) return 0; } -int sampleBlockChanged(jack_nframes_t nframes, void* arg [[maybe_unused]]) +int sampleBlockChanged(jack_nframes_t nframes, void* arg) { if (arg == nullptr) return 0; @@ -140,7 +141,7 @@ int sampleBlockChanged(jack_nframes_t nframes, void* arg [[maybe_unused]]) return 0; } -int sampleRateChanged(jack_nframes_t nframes, void* arg [[maybe_unused]]) +int sampleRateChanged(jack_nframes_t nframes, void* arg) { if (arg == nullptr) return 0; @@ -153,10 +154,11 @@ int sampleRateChanged(jack_nframes_t nframes, void* arg [[maybe_unused]]) static bool shouldClose { false }; -static void done(int sig [[maybe_unused]]) +static void done(int sig) { std::cout << "Signal received" << '\n'; shouldClose = true; + UNUSED(sig); // if (client != nullptr) // exit(0); diff --git a/src/sfizz/EGDescription.h b/src/sfizz/EGDescription.h index afaa32c8..f9c422f7 100644 --- a/src/sfizz/EGDescription.h +++ b/src/sfizz/EGDescription.h @@ -26,6 +26,7 @@ #pragma once #include "Config.h" #include "Defaults.h" +#include "Macros.h" #include "LeakDetector.h" #include "SfzHelpers.h" #include @@ -134,8 +135,9 @@ struct EGDescription * @param velocity * @return float */ - float getStart(const SfzCCArray &ccValues, uint8_t velocity [[maybe_unused]]) const noexcept + float getStart(const SfzCCArray &ccValues, uint8_t velocity) const noexcept { + UNUSED(velocity); return Default::egPercentRange.clamp(ccSwitchedValue(ccValues, ccStart, start)); } /** diff --git a/src/sfizz/Macros.h b/src/sfizz/Macros.h new file mode 100644 index 00000000..bf0d9fbb --- /dev/null +++ b/src/sfizz/Macros.h @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: BSD-2-Clause + +// This code is part of the sfizz library and is licensed under a BSD 2-clause +// license. You should have receive a LICENSE.md file along with the code. +// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz + +#pragma once + +#define UNUSED(x) (void)(x) diff --git a/src/sfizz/MidiState.cpp b/src/sfizz/MidiState.cpp index d128c6e3..0c812af4 100644 --- a/src/sfizz/MidiState.cpp +++ b/src/sfizz/MidiState.cpp @@ -5,6 +5,7 @@ // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz #include "MidiState.h" +#include "Macros.h" #include "Debug.h" sfz::MidiState::MidiState() @@ -25,11 +26,11 @@ void sfz::MidiState::noteOnEvent(int delay, int noteNumber, uint8_t velocity) no } -void sfz::MidiState::noteOffEvent(int delay, int noteNumber, uint8_t velocity [[maybe_unused]]) noexcept +void sfz::MidiState::noteOffEvent(int delay, int noteNumber, uint8_t velocity) noexcept { ASSERT(noteNumber >= 0 && noteNumber <= 127); ASSERT(velocity >= 0 && velocity <= 127); - + UNUSED(velocity); if (noteNumber >= 0 && noteNumber < 128) { if (activeNotes > 0) activeNotes--; diff --git a/src/sfizz/Region.cpp b/src/sfizz/Region.cpp index d9651eca..10c5415a 100644 --- a/src/sfizz/Region.cpp +++ b/src/sfizz/Region.cpp @@ -7,6 +7,7 @@ #include "Region.h" #include "Defaults.h" #include "MathHelpers.h" +#include "Macros.h" #include "Debug.h" #include "Opcode.h" #include "StringViewHelpers.h" @@ -817,7 +818,7 @@ bool sfz::Region::registerNoteOn(int noteNumber, uint8_t velocity, float randVal return keyOk && velOk && randOk && (attackTrigger || firstLegatoNote || notFirstLegatoNote); } -bool sfz::Region::registerNoteOff(int noteNumber, uint8_t velocity [[maybe_unused]], float randValue) noexcept +bool sfz::Region::registerNoteOff(int noteNumber, uint8_t velocity, float randValue) noexcept { if (keyswitchRange.containsWithEnd(noteNumber)) { if (keyswitchDown && *keyswitchDown == noteNumber) diff --git a/src/sfizz/SIMDNEON.cpp b/src/sfizz/SIMDNEON.cpp index eb79cf7f..d5212904 100644 --- a/src/sfizz/SIMDNEON.cpp +++ b/src/sfizz/SIMDNEON.cpp @@ -29,10 +29,10 @@ #include using Type = float; -[[maybe_unused]] constexpr uintptr_t TypeAlignment { 4 }; -[[maybe_unused]] constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 }; -[[maybe_unused]] constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) }; -[[maybe_unused]] constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 }; +constexpr uintptr_t TypeAlignment { 4 }; +constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 }; +constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) }; +constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 }; float* nextAligned(const float* ptr) { diff --git a/src/sfizz/SIMDSSE.cpp b/src/sfizz/SIMDSSE.cpp index bec05f09..2eda8969 100644 --- a/src/sfizz/SIMDSSE.cpp +++ b/src/sfizz/SIMDSSE.cpp @@ -16,10 +16,10 @@ #include "mathfuns/sse_mathfun.h" using Type = float; -[[maybe_unused]] constexpr uintptr_t TypeAlignment { 4 }; -[[maybe_unused]] constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 }; -[[maybe_unused]] constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) }; -[[maybe_unused]] constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 }; +constexpr uintptr_t TypeAlignment { 4 }; +constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 }; +constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) }; +constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 }; struct AlignmentSentinels { float* nextAligned; diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index a5f5b36f..b02ebd00 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -8,6 +8,7 @@ #include "AtomicGuard.h" #include "Config.h" #include "Debug.h" +#include "Macros.h" #include "MidiState.h" #include "ScopedFTZ.h" #include "StringViewHelpers.h" @@ -589,10 +590,11 @@ void sfz::Synth::noteOn(int delay, int noteNumber, uint8_t velocity) noexcept noteOnDispatch(delay, noteNumber, velocity); } -void sfz::Synth::noteOff(int delay, int noteNumber, uint8_t velocity [[maybe_unused]]) noexcept +void sfz::Synth::noteOff(int delay, int noteNumber, uint8_t velocity) noexcept { ASSERT(noteNumber < 128); ASSERT(noteNumber >= 0); + UNUSED(velocity); ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration }; resources.midiState.noteOffEvent(delay, noteNumber, velocity); diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 149003c5..e6bb2f94 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -4,6 +4,7 @@ // license. You should have receive a LICENSE.md file along with the code. // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz +#include "Macros.h" #include "Voice.h" #include "AudioSpan.h" #include "Config.h" @@ -129,8 +130,9 @@ void sfz::Voice::release(int delay, bool fastRelease) noexcept } } -void sfz::Voice::registerNoteOff(int delay, int noteNumber, uint8_t velocity [[maybe_unused]]) noexcept +void sfz::Voice::registerNoteOff(int delay, int noteNumber, uint8_t velocity) noexcept { + UNUSED(velocity); if (region == nullptr) return; @@ -207,14 +209,18 @@ void sfz::Voice::registerPitchWheel(int delay, int pitch) noexcept pitchBendEnvelope.registerEvent(delay, static_cast(pitch)); } -void sfz::Voice::registerAftertouch(int delay [[maybe_unused]], uint8_t aftertouch [[maybe_unused]]) noexcept +void sfz::Voice::registerAftertouch(int delay, uint8_t aftertouch) noexcept { // TODO + UNUSED(delay); + UNUSED(aftertouch); } -void sfz::Voice::registerTempo(int delay [[maybe_unused]], float secondsPerQuarter [[maybe_unused]]) noexcept +void sfz::Voice::registerTempo(int delay, float secondsPerQuarter) noexcept { // TODO + UNUSED(delay); + UNUSED(secondsPerQuarter); } void sfz::Voice::setSampleRate(float sampleRate) noexcept diff --git a/src/sfizz/sfizz_wrapper.cpp b/src/sfizz/sfizz_wrapper.cpp index 7168e510..32ab355a 100644 --- a/src/sfizz/sfizz_wrapper.cpp +++ b/src/sfizz/sfizz_wrapper.cpp @@ -5,10 +5,10 @@ // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz #include "Config.h" +#include "Macros.h" #include "Synth.h" #include "sfizz.h" -#define UNUSED(x) (void)(x) #ifdef __cplusplus extern "C" { #endif