Changed maybe unused into comments or macros

This commit is contained in:
Paul Ferrand 2020-03-11 00:18:18 +01:00 committed by Paul Fd
parent 0b90ab722f
commit a26fc7a1fb
40 changed files with 83 additions and 59 deletions

View file

@ -30,7 +30,7 @@ public:
output.resize(state.range(0)); output.resize(state.range(0));
} }
void TearDown(const ::benchmark::State &state[[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -5,6 +5,7 @@
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#include "SIMDHelpers.h" #include "SIMDHelpers.h"
#include "Macros.h"
#include <benchmark/benchmark.h> #include <benchmark/benchmark.h>
#include <random> #include <random>
#include <numeric> #include <numeric>
@ -24,8 +25,8 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); 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<float> input; std::vector<float> input;

View file

@ -9,11 +9,11 @@
class Clock : public benchmark::Fixture { class Clock : public benchmark::Fixture {
public: 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 */) {
} }

View file

@ -24,7 +24,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -23,7 +23,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -25,7 +25,7 @@ public:
sfz::cumsum<float, false>(input, absl::MakeSpan(input)); sfz::cumsum<float, false>(input, absl::MakeSpan(input));
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -26,7 +26,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -23,7 +23,7 @@ public:
sfz::cumsum<float, false>(input, absl::MakeSpan(input)); sfz::cumsum<float, false>(input, absl::MakeSpan(input));
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -32,7 +32,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); 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 { }; std::random_device rd { };

View file

@ -35,7 +35,7 @@ public:
std::generate(inputRight.begin(), inputRight.end(), [&]() { return dist(gen); }); 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 { }; std::random_device rd { };

View file

@ -18,7 +18,7 @@
class FileFixture : public benchmark::Fixture { class FileFixture : public benchmark::Fixture {
public: public:
void SetUp(const ::benchmark::State& state [[maybe_unused]]) { void SetUp(const ::benchmark::State& state) {
filePath1 = getPath() / "sample1.flac"; filePath1 = getPath() / "sample1.flac";
filePath2 = getPath() / "sample2.flac"; filePath2 = getPath() / "sample2.flac";
filePath3 = getPath() / "sample3.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() ghc::filesystem::path getPath()

View file

@ -24,7 +24,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); 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); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -28,7 +28,7 @@ public:
absl::c_generate(floatJumps, [&]() { return dist(gen); }); absl::c_generate(floatJumps, [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -10,11 +10,11 @@
class Logger : public benchmark::Fixture { class Logger : public benchmark::Fixture {
public: 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 */) {
} }

View file

@ -30,7 +30,7 @@ public:
absl::c_generate(jumps, [&]() { return dist(gen); }); absl::c_generate(jumps, [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -36,7 +36,7 @@ public:
}); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -26,7 +26,7 @@ public:
std::generate(source.begin(), source.end(), [&]() { return dist(gen); }); std::generate(source.begin(), source.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -23,7 +23,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -23,7 +23,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -26,7 +26,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -26,7 +26,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -33,7 +33,7 @@ public:
span2 = absl::MakeSpan(temp2); span2 = absl::MakeSpan(temp2);
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -14,7 +14,7 @@ constexpr int bigNumber { 2399132 };
class IterOffset : public benchmark::Fixture { class IterOffset : public benchmark::Fixture {
public: public:
void SetUp(const ::benchmark::State& state [[maybe_unused]]) { void SetUp(const ::benchmark::State& /* state */) {
std::random_device rd { }; std::random_device rd { };
std::mt19937 gen { rd() }; std::mt19937 gen { rd() };
std::uniform_real_distribution<float> dist { 0.001f, 1.0f }; std::uniform_real_distribution<float> dist { 0.001f, 1.0f };
@ -28,7 +28,7 @@ public:
sfz::cumsum<int>(jumps, absl::MakeSpan(offsets)); sfz::cumsum<int>(jumps, absl::MakeSpan(offsets));
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -33,7 +33,7 @@ public:
output = std::make_unique<sfz::AudioBuffer<float>>(sndfile.channels(), sndfile.frames()); output = std::make_unique<sfz::AudioBuffer<float>>(sndfile.channels(), sndfile.frames());
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }
ghc::filesystem::path getPath() ghc::filesystem::path getPath()

View file

@ -206,7 +206,7 @@ public:
sndfile.readf(interleavedBuffer->data(), sndfile.frames()); sndfile.readf(interleavedBuffer->data(), sndfile.frames());
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) void TearDown(const ::benchmark::State& /* state */)
{ {
} }

View file

@ -78,7 +78,7 @@ public:
output = std::make_unique<sfz::AudioBuffer<float>>(sndfile.channels(), numFrames * 4); output = std::make_unique<sfz::AudioBuffer<float>>(sndfile.channels(), numFrames * 4);
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }
ghc::filesystem::path getPath() ghc::filesystem::path getPath()

View file

@ -29,7 +29,7 @@ public:
absl::c_generate(jumps, [&]() { return dist(gen); }); absl::c_generate(jumps, [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -24,7 +24,7 @@ public:
std::generate(input.begin(), input.end(), [&]() { return dist(gen); }); std::generate(input.begin(), input.end(), [&]() { return dist(gen); });
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -17,7 +17,7 @@
class FileFixture : public benchmark::Fixture { class FileFixture : public benchmark::Fixture {
public: public:
void SetUp(const ::benchmark::State& state [[maybe_unused]]) { void SetUp(const ::benchmark::State& state) {
filePath1 = getPath() / "sample1.wav"; filePath1 = getPath() / "sample1.wav";
filePath2 = getPath() / "sample2.wav"; filePath2 = getPath() / "sample2.wav";
filePath3 = getPath() / "sample3.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() ghc::filesystem::path getPath()

View file

@ -37,7 +37,7 @@ public:
span3 = absl::MakeSpan(temp3); span3 = absl::MakeSpan(temp3);
} }
void TearDown(const ::benchmark::State& state [[maybe_unused]]) { void TearDown(const ::benchmark::State& /* state */) {
} }

View file

@ -22,6 +22,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "sfizz/Synth.h" #include "sfizz/Synth.h"
#include "sfizz/Macros.h"
#include <absl/flags/parse.h> #include <absl/flags/parse.h>
#include <absl/flags/flag.h> #include <absl/flags/flag.h>
#include <absl/types/span.h> #include <absl/types/span.h>
@ -70,9 +71,9 @@ constexpr int buildAndCenterPitch(uint8_t firstByte, uint8_t secondByte)
} }
} }
static std::atomic<bool> keepRunning [[maybe_unused]] { true }; static std::atomic<bool> keepRunning { true };
int process(jack_nframes_t numFrames, void* arg [[maybe_unused]]) int process(jack_nframes_t numFrames, void* arg)
{ {
auto synth = reinterpret_cast<sfz::Synth*>(arg); auto synth = reinterpret_cast<sfz::Synth*>(arg);
@ -129,7 +130,7 @@ int process(jack_nframes_t numFrames, void* arg [[maybe_unused]])
return 0; return 0;
} }
int sampleBlockChanged(jack_nframes_t nframes, void* arg [[maybe_unused]]) int sampleBlockChanged(jack_nframes_t nframes, void* arg)
{ {
if (arg == nullptr) if (arg == nullptr)
return 0; return 0;
@ -140,7 +141,7 @@ int sampleBlockChanged(jack_nframes_t nframes, void* arg [[maybe_unused]])
return 0; return 0;
} }
int sampleRateChanged(jack_nframes_t nframes, void* arg [[maybe_unused]]) int sampleRateChanged(jack_nframes_t nframes, void* arg)
{ {
if (arg == nullptr) if (arg == nullptr)
return 0; return 0;
@ -153,10 +154,11 @@ int sampleRateChanged(jack_nframes_t nframes, void* arg [[maybe_unused]])
static bool shouldClose { false }; static bool shouldClose { false };
static void done(int sig [[maybe_unused]]) static void done(int sig)
{ {
std::cout << "Signal received" << '\n'; std::cout << "Signal received" << '\n';
shouldClose = true; shouldClose = true;
UNUSED(sig);
// if (client != nullptr) // if (client != nullptr)
// exit(0); // exit(0);

View file

@ -26,6 +26,7 @@
#pragma once #pragma once
#include "Config.h" #include "Config.h"
#include "Defaults.h" #include "Defaults.h"
#include "Macros.h"
#include "LeakDetector.h" #include "LeakDetector.h"
#include "SfzHelpers.h" #include "SfzHelpers.h"
#include <absl/types/optional.h> #include <absl/types/optional.h>
@ -134,8 +135,9 @@ struct EGDescription
* @param velocity * @param velocity
* @return float * @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)); return Default::egPercentRange.clamp(ccSwitchedValue(ccValues, ccStart, start));
} }
/** /**

9
src/sfizz/Macros.h Normal file
View file

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

View file

@ -5,6 +5,7 @@
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#include "MidiState.h" #include "MidiState.h"
#include "Macros.h"
#include "Debug.h" #include "Debug.h"
sfz::MidiState::MidiState() 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(noteNumber >= 0 && noteNumber <= 127);
ASSERT(velocity >= 0 && velocity <= 127); ASSERT(velocity >= 0 && velocity <= 127);
UNUSED(velocity);
if (noteNumber >= 0 && noteNumber < 128) { if (noteNumber >= 0 && noteNumber < 128) {
if (activeNotes > 0) if (activeNotes > 0)
activeNotes--; activeNotes--;

View file

@ -7,6 +7,7 @@
#include "Region.h" #include "Region.h"
#include "Defaults.h" #include "Defaults.h"
#include "MathHelpers.h" #include "MathHelpers.h"
#include "Macros.h"
#include "Debug.h" #include "Debug.h"
#include "Opcode.h" #include "Opcode.h"
#include "StringViewHelpers.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); 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 (keyswitchRange.containsWithEnd(noteNumber)) {
if (keyswitchDown && *keyswitchDown == noteNumber) if (keyswitchDown && *keyswitchDown == noteNumber)

View file

@ -29,10 +29,10 @@
#include <arm_neon.h> #include <arm_neon.h>
using Type = float; using Type = float;
[[maybe_unused]] constexpr uintptr_t TypeAlignment { 4 }; constexpr uintptr_t TypeAlignment { 4 };
[[maybe_unused]] constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 }; constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 };
[[maybe_unused]] constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) }; constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) };
[[maybe_unused]] constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 }; constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 };
float* nextAligned(const float* ptr) float* nextAligned(const float* ptr)
{ {

View file

@ -16,10 +16,10 @@
#include "mathfuns/sse_mathfun.h" #include "mathfuns/sse_mathfun.h"
using Type = float; using Type = float;
[[maybe_unused]] constexpr uintptr_t TypeAlignment { 4 }; constexpr uintptr_t TypeAlignment { 4 };
[[maybe_unused]] constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 }; constexpr uintptr_t TypeAlignmentMask { TypeAlignment - 1 };
[[maybe_unused]] constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) }; constexpr uintptr_t ByteAlignment { TypeAlignment * sizeof(Type) };
[[maybe_unused]] constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 }; constexpr uintptr_t ByteAlignmentMask { ByteAlignment - 1 };
struct AlignmentSentinels { struct AlignmentSentinels {
float* nextAligned; float* nextAligned;

View file

@ -8,6 +8,7 @@
#include "AtomicGuard.h" #include "AtomicGuard.h"
#include "Config.h" #include "Config.h"
#include "Debug.h" #include "Debug.h"
#include "Macros.h"
#include "MidiState.h" #include "MidiState.h"
#include "ScopedFTZ.h" #include "ScopedFTZ.h"
#include "StringViewHelpers.h" #include "StringViewHelpers.h"
@ -589,10 +590,11 @@ void sfz::Synth::noteOn(int delay, int noteNumber, uint8_t velocity) noexcept
noteOnDispatch(delay, noteNumber, velocity); 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 < 128);
ASSERT(noteNumber >= 0); ASSERT(noteNumber >= 0);
UNUSED(velocity);
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration }; ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
resources.midiState.noteOffEvent(delay, noteNumber, velocity); resources.midiState.noteOffEvent(delay, noteNumber, velocity);

View file

@ -4,6 +4,7 @@
// license. You should have receive a LICENSE.md file along with the code. // 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 // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#include "Macros.h"
#include "Voice.h" #include "Voice.h"
#include "AudioSpan.h" #include "AudioSpan.h"
#include "Config.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) if (region == nullptr)
return; return;
@ -207,14 +209,18 @@ void sfz::Voice::registerPitchWheel(int delay, int pitch) noexcept
pitchBendEnvelope.registerEvent(delay, static_cast<float>(pitch)); pitchBendEnvelope.registerEvent(delay, static_cast<float>(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 // 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 // TODO
UNUSED(delay);
UNUSED(secondsPerQuarter);
} }
void sfz::Voice::setSampleRate(float sampleRate) noexcept void sfz::Voice::setSampleRate(float sampleRate) noexcept

View file

@ -5,10 +5,10 @@
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#include "Config.h" #include "Config.h"
#include "Macros.h"
#include "Synth.h" #include "Synth.h"
#include "sfizz.h" #include "sfizz.h"
#define UNUSED(x) (void)(x)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif