diff --git a/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp new file mode 100644 index 0000000000..72888e2f49 --- /dev/null +++ b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.cpp @@ -0,0 +1,31 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +bool AudioPlayHead::canControlTransport() { return false; } +void AudioPlayHead::transportPlay ([[maybe_unused]] bool shouldStartPlaying) {} +void AudioPlayHead::transportRecord ([[maybe_unused]] bool shouldStartRecording) {} +void AudioPlayHead::transportRewind() {} + +} // namespace juce diff --git a/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h index 21222b7f33..3c47f85cb1 100644 --- a/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h +++ b/modules/juce_audio_basics/audio_play_head/juce_AudioPlayHead.h @@ -578,16 +578,16 @@ public: virtual Optional getPosition() const = 0; /** Returns true if this object can control the transport. */ - virtual bool canControlTransport() { return false; } + virtual bool canControlTransport(); /** Starts or stops the audio. */ - virtual void transportPlay (bool shouldStartPlaying) { ignoreUnused (shouldStartPlaying); } + virtual void transportPlay (bool shouldStartPlaying); /** Starts or stops recording the audio. */ - virtual void transportRecord (bool shouldStartRecording) { ignoreUnused (shouldStartRecording); } + virtual void transportRecord (bool shouldStartRecording); /** Rewinds the audio. */ - virtual void transportRewind() {} + virtual void transportRewind(); }; } // namespace juce diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp index d65a8f257a..2a576dc989 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -938,15 +938,13 @@ namespace #if JUCE_USE_VDSP_FRAMEWORK vDSP_vabs ((float*) src, 1, dest, 1, (vDSP_Length) num); #else - FloatVectorHelpers::signMask32 signMask; + [[maybe_unused]] FloatVectorHelpers::signMask32 signMask; signMask.i = 0x7fffffffUL; JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = std::abs (src[i]), Mode::bit_and (s, mask), JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mask = Mode::load1 (signMask.f);) - - ignoreUnused (signMask); #endif } @@ -956,7 +954,7 @@ namespace #if JUCE_USE_VDSP_FRAMEWORK vDSP_vabsD ((double*) src, 1, dest, 1, (vDSP_Length) num); #else - FloatVectorHelpers::signMask64 signMask; + [[maybe_unused]] FloatVectorHelpers::signMask64 signMask; signMask.i = 0x7fffffffffffffffULL; JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = std::abs (src[i]), @@ -964,8 +962,6 @@ namespace JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mask = Mode::load1 (signMask.d);) - - ignoreUnused (signMask); #endif } @@ -1456,7 +1452,7 @@ intptr_t JUCE_CALLTYPE FloatVectorOperations::getFpStatusRegister() noexcept return fpsr; } -void JUCE_CALLTYPE FloatVectorOperations::setFpStatusRegister (intptr_t fpsr) noexcept +void JUCE_CALLTYPE FloatVectorOperations::setFpStatusRegister ([[maybe_unused]] intptr_t fpsr) noexcept { #if JUCE_INTEL && JUCE_USE_SSE_INTRINSICS // the volatile keyword here is needed to workaround a bug in AppleClang 13.0 @@ -1481,11 +1477,10 @@ void JUCE_CALLTYPE FloatVectorOperations::setFpStatusRegister (intptr_t fpsr) no #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for getting the floating point status register for your platform #endif - ignoreUnused (fpsr); #endif } -void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnable) noexcept +void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode ([[maybe_unused]] bool shouldEnable) noexcept { #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) #if JUCE_USE_SSE_INTRINSICS @@ -1498,11 +1493,10 @@ void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnab #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for flush to zero mode on your platform #endif - ignoreUnused (shouldEnable); #endif } -void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (bool shouldDisable) noexcept +void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport ([[maybe_unused]] bool shouldDisable) noexcept { #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || (JUCE_64BIT && JUCE_ARM)) #if JUCE_USE_SSE_INTRINSICS @@ -1513,7 +1507,6 @@ void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport (bool setFpStatusRegister ((getFpStatusRegister() & (~mask)) | (shouldDisable ? mask : 0)); #else - ignoreUnused (shouldDisable); #if ! (defined (JUCE_INTEL) || defined (JUCE_ARM)) jassertfalse; // No support for disable denormals mode on your platform diff --git a/modules/juce_audio_basics/juce_audio_basics.cpp b/modules/juce_audio_basics/juce_audio_basics.cpp index 10f3a9bbca..570974762e 100644 --- a/modules/juce_audio_basics/juce_audio_basics.cpp +++ b/modules/juce_audio_basics/juce_audio_basics.cpp @@ -85,13 +85,16 @@ #include "sources/juce_ResamplingAudioSource.cpp" #include "sources/juce_ReverbAudioSource.cpp" #include "sources/juce_ToneGeneratorAudioSource.cpp" +#include "sources/juce_PositionableAudioSource.cpp" #include "synthesisers/juce_Synthesiser.cpp" +#include "audio_play_head/juce_AudioPlayHead.cpp" #include "midi/ump/juce_UMP.h" #include "midi/ump/juce_UMPUtils.cpp" #include "midi/ump/juce_UMPView.cpp" #include "midi/ump/juce_UMPSysEx7.cpp" #include "midi/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp" +#include "midi/ump/juce_UMPIterator.cpp" #if JUCE_UNIT_TESTS #include "utilities/juce_ADSR_test.cpp" diff --git a/modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp new file mode 100644 index 0000000000..0ba7ce0758 --- /dev/null +++ b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.cpp @@ -0,0 +1,37 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ +namespace universal_midi_packets +{ + +Iterator::Iterator (const uint32_t* ptr, [[maybe_unused]] size_t bytes) noexcept + : view (ptr) + #if JUCE_DEBUG + , bytesRemaining (bytes) + #endif +{ +} + +} // namespace universal_midi_packets +} // namespace juce diff --git a/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h index b4dcea9a34..eba6202956 100644 --- a/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h +++ b/modules/juce_audio_basics/midi/ump/juce_UMPIterator.h @@ -43,14 +43,7 @@ public: Iterator() noexcept = default; /** Creates an iterator pointing at `ptr`. */ - explicit Iterator (const uint32_t* ptr, size_t bytes) noexcept - : view (ptr) - #if JUCE_DEBUG - , bytesRemaining (bytes) - #endif - { - ignoreUnused (bytes); - } + explicit Iterator (const uint32_t* ptr, size_t bytes) noexcept; using difference_type = std::iterator_traits::difference_type; using value_type = View; @@ -124,7 +117,7 @@ private: #endif }; -} -} +} // namespace universal_midi_packets +} // namespace juce #endif diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp index 576b8b3816..87f3df39f7 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp @@ -853,6 +853,14 @@ void MPEInstrument::releaseAllNotes() notes.clear(); } +//============================================================================== +void MPEInstrument::Listener::noteAdded ([[maybe_unused]] MPENote newNote) {} +void MPEInstrument::Listener::notePressureChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::notePitchbendChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::noteTimbreChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::noteKeyStateChanged ([[maybe_unused]] MPENote changedNote) {} +void MPEInstrument::Listener::noteReleased ([[maybe_unused]] MPENote finishedNote) {} +void MPEInstrument::Listener::zoneLayoutChanged() {} //============================================================================== //============================================================================== diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.h b/modules/juce_audio_basics/mpe/juce_MPEInstrument.h index 2919574133..e7993c1d12 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.h +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.h @@ -265,12 +265,12 @@ public: /** Implement this callback to be informed whenever a new expressive MIDI note is triggered. */ - virtual void noteAdded (MPENote newNote) { ignoreUnused (newNote); } + virtual void noteAdded (MPENote newNote); /** Implement this callback to be informed whenever a currently playing MPE note's pressure value changes. */ - virtual void notePressureChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void notePressureChanged (MPENote changedNote); /** Implement this callback to be informed whenever a currently playing MPE note's pitchbend value changes. @@ -279,12 +279,12 @@ public: master channel pitchbend event, or if both occur simultaneously. Call MPENote::getFrequencyInHertz to get the effective note frequency. */ - virtual void notePitchbendChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void notePitchbendChanged (MPENote changedNote); /** Implement this callback to be informed whenever a currently playing MPE note's timbre value changes. */ - virtual void noteTimbreChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void noteTimbreChanged (MPENote changedNote); /** Implement this callback to be informed whether a currently playing MPE note's key state (whether the key is down and/or the note is @@ -293,19 +293,19 @@ public: Note: If the key state changes to MPENote::off, noteReleased is called instead. */ - virtual void noteKeyStateChanged (MPENote changedNote) { ignoreUnused (changedNote); } + virtual void noteKeyStateChanged (MPENote changedNote); /** Implement this callback to be informed whenever an MPE note is released (either by a note-off message, or by a sustain/sostenuto pedal release for a note that already received a note-off), and should therefore stop playing. */ - virtual void noteReleased (MPENote finishedNote) { ignoreUnused (finishedNote); } + virtual void noteReleased (MPENote finishedNote); /** Implement this callback to be informed whenever the MPE zone layout or legacy mode settings of this instrument have been changed. */ - virtual void zoneLayoutChanged() {} + virtual void zoneLayoutChanged(); }; //============================================================================== diff --git a/modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp new file mode 100644 index 0000000000..d7fbe37532 --- /dev/null +++ b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.cpp @@ -0,0 +1,28 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + The code included in this file is provided under the terms of the ISC license + http://www.isc.org/downloads/software-support-policy/isc-license. Permission + To use, copy, modify, and/or distribute this software for any purpose with or + without fee is hereby granted provided that the above copyright notice and + this permission notice appear in all copies. + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +void PositionableAudioSource::setLooping ([[maybe_unused]] bool shouldLoop) {} + +} // namespace juce diff --git a/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h index 1898bbbcfd..6fb6691eaf 100644 --- a/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h +++ b/modules/juce_audio_basics/sources/juce_PositionableAudioSource.h @@ -70,7 +70,7 @@ public: virtual bool isLooping() const = 0; /** Tells the source whether you'd like it to play in a loop. */ - virtual void setLooping (bool shouldLoop) { ignoreUnused (shouldLoop); } + virtual void setLooping (bool shouldLoop); }; } // namespace juce diff --git a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp index cfeb6a0928..f9aaff23f0 100644 --- a/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp +++ b/modules/juce_audio_basics/synthesisers/juce_Synthesiser.cpp @@ -482,15 +482,14 @@ void Synthesiser::handleSostenutoPedal (int midiChannel, bool isDown) } } -void Synthesiser::handleSoftPedal (int midiChannel, bool /*isDown*/) +void Synthesiser::handleSoftPedal ([[maybe_unused]] int midiChannel, bool /*isDown*/) { - ignoreUnused (midiChannel); jassert (midiChannel > 0 && midiChannel <= 16); } -void Synthesiser::handleProgramChange (int midiChannel, int programNumber) +void Synthesiser::handleProgramChange ([[maybe_unused]] int midiChannel, + [[maybe_unused]] int programNumber) { - ignoreUnused (midiChannel, programNumber); jassert (midiChannel > 0 && midiChannel <= 16); } diff --git a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp index 45a83d2b40..6381728606 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.cpp @@ -23,6 +23,14 @@ namespace juce { +void AudioIODeviceCallback::audioDeviceIOCallbackWithContext ([[maybe_unused]] const float* const* inputChannelData, + [[maybe_unused]] int numInputChannels, + [[maybe_unused]] float* const* outputChannelData, + [[maybe_unused]] int numOutputChannels, + [[maybe_unused]] int numSamples, + [[maybe_unused]] const AudioIODeviceCallbackContext& context) {} + +//============================================================================== AudioIODevice::AudioIODevice (const String& deviceName, const String& deviceTypeName) : name (deviceName), typeName (deviceTypeName) { diff --git a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h index 086054f788..1405f7e29d 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h +++ b/modules/juce_audio_devices/audio_io/juce_AudioIODevice.h @@ -98,10 +98,7 @@ public: float* const* outputChannelData, int numOutputChannels, int numSamples, - const AudioIODeviceCallbackContext& context) - { - ignoreUnused (inputChannelData, numInputChannels, outputChannelData, numOutputChannels, numSamples, context); - } + const AudioIODeviceCallbackContext& context); /** Called to indicate that the device is about to start calling back. @@ -129,7 +126,6 @@ public: virtual void audioDeviceError (const String& errorMessage); }; - //============================================================================== /** Base class for an audio device with synchronised input and output channels. diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp index 47b7fae7c0..b2baf8c1a1 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp @@ -23,6 +23,12 @@ namespace juce { +void MidiInputCallback::handlePartialSysexMessage ([[maybe_unused]] MidiInput* source, + [[maybe_unused]] const uint8* messageData, + [[maybe_unused]] int numBytesSoFar, + [[maybe_unused]] double timestamp) {} + +//============================================================================== MidiOutput::MidiOutput (const String& deviceName, const String& deviceIdentifier) : Thread ("midi out"), deviceInfo (deviceName, deviceIdentifier) { diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h index 814cb7d85d..5dab3f9258 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h @@ -225,10 +225,7 @@ public: virtual void handlePartialSysexMessage (MidiInput* source, const uint8* messageData, int numBytesSoFar, - double timestamp) - { - ignoreUnused (source, messageData, numBytesSoFar, timestamp); - } + double timestamp); }; //============================================================================== diff --git a/modules/juce_audio_devices/native/juce_android_Oboe.cpp b/modules/juce_audio_devices/native/juce_android_Oboe.cpp index 5bedb1791a..78d12683fd 100644 --- a/modules/juce_audio_devices/native/juce_android_Oboe.cpp +++ b/modules/juce_audio_devices/native/juce_android_Oboe.cpp @@ -596,8 +596,7 @@ private: { if (stream != nullptr) { - oboe::Result result = stream->close(); - ignoreUnused (result); + [[maybe_unused]] oboe::Result result = stream->close(); JUCE_OBOE_LOG ("Requested Oboe stream close with result: " + getOboeString (result)); } } @@ -693,14 +692,15 @@ private: } // Not strictly required as these should not change, but recommended by Google anyway - void checkStreamSetup (OboeStream* stream, int deviceId, int numChannels, int expectedSampleRate, - int expectedBufferSize, oboe::AudioFormat format) + void checkStreamSetup (OboeStream* stream, + [[maybe_unused]] int deviceId, + [[maybe_unused]] int numChannels, + [[maybe_unused]] int expectedSampleRate, + [[maybe_unused]] int expectedBufferSize, + oboe::AudioFormat format) { - if (auto* nativeStream = stream != nullptr ? stream->getNativeStream() : nullptr) + if ([[maybe_unused]] auto* nativeStream = stream != nullptr ? stream->getNativeStream() : nullptr) { - ignoreUnused (deviceId, numChannels, sampleRate, expectedBufferSize); - ignoreUnused (streamFormat, bitDepth); - jassert (numChannels == 0 || numChannels == nativeStream->getChannelCount()); jassert (expectedSampleRate == 0 || expectedSampleRate == nativeStream->getSampleRate()); jassert (format == nativeStream->getFormat()); @@ -860,10 +860,8 @@ private: return oboe::DataCallbackResult::Continue; } - void printStreamDebugInfo (oboe::AudioStream* stream) + void printStreamDebugInfo ([[maybe_unused]] oboe::AudioStream* stream) { - ignoreUnused (stream); - JUCE_OBOE_LOG ("\nUses AAudio = " + (stream != nullptr ? String ((int) stream->usesAAudio()) : String ("?")) + "\nDirection = " + (stream != nullptr ? getOboeString (stream->getDirection()) : String ("?")) + "\nSharingMode = " + (stream != nullptr ? getOboeString (stream->getSharingMode()) : String ("?")) @@ -928,10 +926,8 @@ private: return time.tv_sec * oboe::kNanosPerSecond + time.tv_nsec; } - void onErrorBeforeClose (oboe::AudioStream* stream, oboe::Result error) override + void onErrorBeforeClose (oboe::AudioStream* stream, [[maybe_unused]] oboe::Result error) override { - ignoreUnused (error); - // only output stream should be the master stream receiving callbacks jassert (stream->getDirection() == oboe::Direction::Output); @@ -1167,10 +1163,8 @@ public: JUCE_OBOE_LOG ("-----InputDevices:"); - for (auto& device : inputDevices) + for ([[maybe_unused]] auto& device : inputDevices) { - ignoreUnused (device); - JUCE_OBOE_LOG ("name = " << device.name); JUCE_OBOE_LOG ("id = " << String (device.id)); JUCE_OBOE_LOG ("sample rates size = " << String (device.sampleRates.size())); @@ -1179,10 +1173,8 @@ public: JUCE_OBOE_LOG ("-----OutputDevices:"); - for (auto& device : outputDevices) + for ([[maybe_unused]] auto& device : outputDevices) { - ignoreUnused (device); - JUCE_OBOE_LOG ("name = " << device.name); JUCE_OBOE_LOG ("id = " << String (device.id)); JUCE_OBOE_LOG ("sample rates size = " << String (device.sampleRates.size())); @@ -1392,17 +1384,15 @@ public: return oboe::DataCallbackResult::Continue; } - void onErrorBeforeClose (oboe::AudioStream*, oboe::Result error) override + void onErrorBeforeClose (oboe::AudioStream*, [[maybe_unused]] oboe::Result error) override { JUCE_OBOE_LOG ("OboeRealtimeThread: Oboe stream onErrorBeforeClose(): " + getOboeString (error)); - ignoreUnused (error); jassertfalse; // Should never get here! } - void onErrorAfterClose (oboe::AudioStream*, oboe::Result error) override + void onErrorAfterClose (oboe::AudioStream*, [[maybe_unused]] oboe::Result error) override { JUCE_OBOE_LOG ("OboeRealtimeThread: Oboe stream onErrorAfterClose(): " + getOboeString (error)); - ignoreUnused (error); jassertfalse; // Should never get here! } diff --git a/modules/juce_audio_devices/native/juce_ios_Audio.cpp b/modules/juce_audio_devices/native/juce_ios_Audio.cpp index 6fa620f295..edf1db75dd 100644 --- a/modules/juce_audio_devices/native/juce_ios_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_ios_Audio.cpp @@ -579,16 +579,15 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater impl.fillHostCallbackInfo (callbackInfo); Boolean hostIsPlaying = NO; - OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, - &hostIsPlaying, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr); + [[maybe_unused]] OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, + &hostIsPlaying, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr); - ignoreUnused (err); jassert (err == noErr); if (hostIsPlaying != shouldSartPlaying) @@ -604,15 +603,14 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater impl.fillHostCallbackInfo (callbackInfo); Boolean hostIsRecording = NO; - OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, - nullptr, - &hostIsRecording, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = callbackInfo.transportStateProc2 (callbackInfo.hostUserData, + nullptr, + &hostIsRecording, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr); jassert (err == noErr); if (hostIsRecording != shouldStartRecording) @@ -808,11 +806,9 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater void handleAudioUnitPropertyChange (AudioUnit, AudioUnitPropertyID propertyID, - AudioUnitScope scope, - AudioUnitElement element) + [[maybe_unused]] AudioUnitScope scope, + [[maybe_unused]] AudioUnitElement element) { - ignoreUnused (scope); - ignoreUnused (element); JUCE_IOS_AUDIO_LOG ("handleAudioUnitPropertyChange: propertyID: " << String (propertyID) << " scope: " << String (scope) << " element: " << String (element)); @@ -834,9 +830,8 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater { UInt32 connected; UInt32 dataSize = sizeof (connected); - OSStatus err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_IsInterAppConnected, - kAudioUnitScope_Global, 0, &connected, &dataSize); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = AudioUnitGetProperty (audioUnit, kAudioUnitProperty_IsInterAppConnected, + kAudioUnitScope_Global, 0, &connected, &dataSize); jassert (err == noErr); JUCE_IOS_AUDIO_LOG ("handleInterAppAudioConnectionChange: " << (connected ? "connected" @@ -1078,21 +1073,19 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater { zerostruct (callbackInfo); UInt32 dataSize = sizeof (HostCallbackInfo); - OSStatus err = AudioUnitGetProperty (audioUnit, - kAudioUnitProperty_HostCallbacks, - kAudioUnitScope_Global, - 0, - &callbackInfo, - &dataSize); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = AudioUnitGetProperty (audioUnit, + kAudioUnitProperty_HostCallbacks, + kAudioUnitScope_Global, + 0, + &callbackInfo, + &dataSize); jassert (err == noErr); } void handleAudioTransportEvent (AudioUnitRemoteControlEvent event) { - OSStatus err = AudioUnitSetProperty (audioUnit, kAudioOutputUnitProperty_RemoteControlToHost, - kAudioUnitScope_Global, 0, &event, sizeof (event)); - ignoreUnused (err); + [[maybe_unused]] OSStatus err = AudioUnitSetProperty (audioUnit, kAudioOutputUnitProperty_RemoteControlToHost, + kAudioUnitScope_Global, 0, &event, sizeof (event)); jassert (err == noErr); } diff --git a/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp b/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp index c1be61a398..4cce7016f9 100644 --- a/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp +++ b/modules/juce_audio_devices/native/juce_linux_JackAudio.cpp @@ -544,21 +544,19 @@ private: } } - static void infoShutdownCallback (jack_status_t code, const char* reason, void* arg) + static void infoShutdownCallback (jack_status_t code, [[maybe_unused]] const char* reason, void* arg) { jassertquiet (code == 0); JUCE_JACK_LOG ("Shutting down with message:"); JUCE_JACK_LOG (reason); - ignoreUnused (reason); shutdownCallback (arg); } - static void errorCallback (const char* msg) + static void errorCallback ([[maybe_unused]] const char* msg) { JUCE_JACK_LOG ("JackAudioIODevice::errorCallback " + String (msg)); - ignoreUnused (msg); } bool deviceIsOpen = false; diff --git a/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm b/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm index 7e1511de3f..fd61986e7a 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm +++ b/modules/juce_audio_devices/native/juce_mac_CoreMidi.mm @@ -29,7 +29,7 @@ namespace juce namespace CoreMidiHelpers { - static bool checkError (OSStatus err, int lineNum) + static bool checkError (OSStatus err, [[maybe_unused]] int lineNum) { if (err == noErr) return true; @@ -38,7 +38,6 @@ namespace CoreMidiHelpers Logger::writeToLog ("CoreMIDI error: " + String (lineNum) + " - " + String::toHexString ((int) err)); #endif - ignoreUnused (lineNum); return false; } diff --git a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp index 239804012c..017bee61e8 100644 --- a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp +++ b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp @@ -251,8 +251,8 @@ public: if (pOutputBuffer != nullptr) { JUCE_DS_LOG ("closing output: " + name); - HRESULT hr = pOutputBuffer->Stop(); - JUCE_DS_LOG_ERROR (hr); ignoreUnused (hr); + [[maybe_unused]] HRESULT hr = pOutputBuffer->Stop(); + JUCE_DS_LOG_ERROR (hr); pOutputBuffer->Release(); pOutputBuffer = nullptr; @@ -555,8 +555,8 @@ public: if (pInputBuffer != nullptr) { JUCE_DS_LOG ("closing input: " + name); - HRESULT hr = pInputBuffer->Stop(); - JUCE_DS_LOG_ERROR (hr); ignoreUnused (hr); + [[maybe_unused]] HRESULT hr = pInputBuffer->Stop(); + JUCE_DS_LOG_ERROR (hr); pInputBuffer->Release(); pInputBuffer = nullptr; diff --git a/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp b/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp index d20b6e02c9..b516cdbba9 100644 --- a/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp +++ b/modules/juce_audio_devices/native/juce_win32_WASAPI.cpp @@ -33,9 +33,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wlanguage-extension-token") namespace WasapiClasses { -static void logFailure (HRESULT hr) +static void logFailure ([[maybe_unused]] HRESULT hr) { - ignoreUnused (hr); jassert (hr != (HRESULT) 0x800401f0); // If you hit this, it means you're trying to call from // a thread which hasn't been initialised with CoInitialize(). diff --git a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp index 586f28497b..99eb16c13e 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp @@ -61,10 +61,8 @@ void AudioSourcePlayer::audioDeviceIOCallbackWithContext (const float* const* in float* const* outputChannelData, int totalNumOutputChannels, int numSamples, - const AudioIODeviceCallbackContext& context) + [[maybe_unused]] const AudioIODeviceCallbackContext& context) { - ignoreUnused (context); - // these should have been prepared by audioDeviceAboutToStart()... jassert (sampleRate > 0 && bufferSize > 0); diff --git a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp index 2d1ed97028..6974d048a9 100644 --- a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp @@ -721,8 +721,7 @@ private: { using namespace AiffFileHelpers; - const bool couldSeekOk = output->setPosition (headerPosition); - ignoreUnused (couldSeekOk); + [[maybe_unused]] const bool couldSeekOk = output->setPosition (headerPosition); // if this fails, you've given it an output stream that can't seek! It needs // to be able to seek back to write the header diff --git a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp index 66783df8fb..e743ae6682 100644 --- a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp @@ -496,8 +496,7 @@ public: packUint32 ((FLAC__uint32) info.total_samples, buffer + 14, 4); memcpy (buffer + 18, info.md5sum, 16); - const bool seekOk = output->setPosition (streamStartPos + 4); - ignoreUnused (seekOk); + [[maybe_unused]] const bool seekOk = output->setPosition (streamStartPos + 4); // if this fails, you've given it an output stream that can't seek! It needs // to be able to seek back to write the header diff --git a/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp index 1120b0ffc8..00f31082db 100644 --- a/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp @@ -112,8 +112,8 @@ private: if (cp.start (processArgs)) { - auto childOutput = cp.readAllProcessOutput(); - DBG (childOutput); ignoreUnused (childOutput); + [[maybe_unused]] auto childOutput = cp.readAllProcessOutput(); + DBG (childOutput); cp.waitForProcessToFinish (10000); return tempMP3.getFile().getSize() > 0; diff --git a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp index 8ce23321c6..cb7af04cc3 100644 --- a/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WindowsMediaAudioFormat.cpp @@ -262,7 +262,7 @@ private: void checkCoInitialiseCalled() { - ignoreUnused (CoInitialize (nullptr)); + [[maybe_unused]] const auto result = CoInitialize (nullptr); } void scanFileForDetails() diff --git a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp index 9e2bc3f0f3..c815fd631c 100644 --- a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp @@ -1499,11 +1499,10 @@ namespace AAXClasses friend void AAX_CALLBACK AAXClasses::algorithmProcessCallback (JUCEAlgorithmContext* const instancesBegin[], const void* const instancesEnd); void process (float* const* channels, const int numChans, const int bufferSize, - const bool bypass, AAX_IMIDINode* midiNodeIn, AAX_IMIDINode* midiNodesOut) + const bool bypass, [[maybe_unused]] AAX_IMIDINode* midiNodeIn, [[maybe_unused]] AAX_IMIDINode* midiNodesOut) { AudioBuffer buffer (channels, numChans, bufferSize); midiBuffer.clear(); - ignoreUnused (midiNodeIn, midiNodesOut); #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect { @@ -2391,7 +2390,7 @@ namespace AAXClasses return (AAX_STEM_FORMAT_INDEX (stemFormat) <= 12); } - static void getPlugInDescription (AAX_IEffectDescriptor& descriptor, const AAX_IFeatureInfo* featureInfo) + static void getPlugInDescription (AAX_IEffectDescriptor& descriptor, [[maybe_unused]] const AAX_IFeatureInfo* featureInfo) { PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; std::unique_ptr plugin (createPluginFilterOfType (AudioProcessor::wrapperType_AAX)); @@ -2424,7 +2423,6 @@ namespace AAXClasses #if JucePlugin_IsMidiEffect // MIDI effect plug-ins do not support any audio channels jassert (numInputBuses == 0 && numOutputBuses == 0); - ignoreUnused (featureInfo); if (auto* desc = descriptor.NewComponentDescriptor()) { diff --git a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm index 4e85f0e501..9ca1f91030 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -242,11 +242,9 @@ public: } //============================================================================== - bool BusCountWritable (AudioUnitScope scope) override + bool BusCountWritable ([[maybe_unused]] AudioUnitScope scope) override { #ifdef JucePlugin_PreferredChannelConfigurations - ignoreUnused (scope); - return false; #else bool isInput; @@ -774,11 +772,9 @@ public: } //============================================================================== - bool busIgnoresLayout (bool isInput, int busNr) const + bool busIgnoresLayout ([[maybe_unused]] bool isInput, [[maybe_unused]] int busNr) const { #ifdef JucePlugin_PreferredChannelConfigurations - ignoreUnused (isInput, busNr); - return true; #else if (const AudioProcessor::Bus* bus = juceFilter->getBus (isInput, busNr)) @@ -878,10 +874,9 @@ public: //============================================================================== // When parameters are discrete we need to use integer values. - float getMaximumParameterValue (AudioProcessorParameter* juceParam) + float getMaximumParameterValue ([[maybe_unused]] AudioProcessorParameter* juceParam) { #if JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE - ignoreUnused (juceParam); return 1.0f; #else return juceParam->isDiscrete() ? (float) (juceParam->getNumSteps() - 1) : 1.0f; @@ -1234,7 +1229,7 @@ public: if (newNumChannels == oldNumChannels) return true; - if (AudioProcessor::Bus* bus = juceFilter->getBus (info.isInput, info.busNr)) + if ([[maybe_unused]] AudioProcessor::Bus* bus = juceFilter->getBus (info.isInput, info.busNr)) { if (! MusicDeviceBase::ValidFormat (inScope, inElement, inNewFormat)) return false; @@ -1242,7 +1237,6 @@ public: #ifdef JucePlugin_PreferredChannelConfigurations short configs[][2] = {JucePlugin_PreferredChannelConfigurations}; - ignoreUnused (bus); return AudioUnitHelpers::isLayoutSupported (*juceFilter, info.isInput, info.busNr, newNumChannels, configs); #else return bus->isNumberOfChannelsSupported (newNumChannels); @@ -1395,7 +1389,11 @@ public: ComponentResult StopNote (MusicDeviceGroupID, NoteInstanceID, UInt32) override { return noErr; } //============================================================================== - OSStatus HandleMIDIEvent (UInt8 inStatus, UInt8 inChannel, UInt8 inData1, UInt8 inData2, UInt32 inStartFrame) override + OSStatus HandleMIDIEvent ([[maybe_unused]] UInt8 inStatus, + [[maybe_unused]] UInt8 inChannel, + [[maybe_unused]] UInt8 inData1, + [[maybe_unused]] UInt8 inData2, + [[maybe_unused]] UInt32 inStartFrame) override { #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect const juce::uint8 data[] = { (juce::uint8) (inStatus | inChannel), @@ -1406,20 +1404,17 @@ public: incomingEvents.addEvent (data, 3, (int) inStartFrame); return noErr; #else - ignoreUnused (inStatus, inChannel, inData1); - ignoreUnused (inData2, inStartFrame); return kAudioUnitErr_PropertyNotInUse; #endif } - OSStatus HandleSysEx (const UInt8* inData, UInt32 inLength) override + OSStatus HandleSysEx ([[maybe_unused]] const UInt8* inData, [[maybe_unused]] UInt32 inLength) override { #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect const ScopedLock sl (incomingMidiLock); incomingEvents.addEvent (inData, (int) inLength, 0); return noErr; #else - ignoreUnused (inData, inLength); return kAudioUnitErr_PropertyNotInUse; #endif } @@ -1950,7 +1945,7 @@ private: } } - void pushMidiOutput (UInt32 nFrames) noexcept + void pushMidiOutput ([[maybe_unused]] UInt32 nFrames) noexcept { MIDIPacket* end = nullptr; @@ -1979,7 +1974,6 @@ private: for (const auto metadata : midiEvents) { jassert (isPositiveAndBelow (metadata.samplePosition, nFrames)); - ignoreUnused (nFrames); add (metadata); diff --git a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm index f4486c112c..410d369e40 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm @@ -359,11 +359,9 @@ public: AudioProcessor& processor = getAudioProcessor(); - if (AudioProcessor::Bus* bus = processor.getBus (isInput, busIdx)) + if ([[maybe_unused]] AudioProcessor::Bus* bus = processor.getBus (isInput, busIdx)) { #ifdef JucePlugin_PreferredChannelConfigurations - ignoreUnused (bus); - short configs[][2] = {JucePlugin_PreferredChannelConfigurations}; if (! AudioUnitHelpers::isLayoutSupported (processor, isInput, busIdx, newNumChannels, configs)) @@ -603,10 +601,8 @@ public: }; //============================================================================== - void audioProcessorChanged (AudioProcessor* processor, const ChangeDetails& details) override + void audioProcessorChanged ([[maybe_unused]] AudioProcessor* processor, const ChangeDetails& details) override { - ignoreUnused (processor); - if (! details.programChanged) return; @@ -1109,10 +1105,9 @@ private: } // When parameters are discrete we need to use integer values. - float getMaximumParameterValue (AudioProcessorParameter* juceParam) const + float getMaximumParameterValue ([[maybe_unused]] AudioProcessorParameter* juceParam) const { #if JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE - ignoreUnused (juceParam); return 1.0f; #else return juceParam->isDiscrete() ? (float) (juceParam->getNumSteps() - 1) : 1.0f; @@ -1355,10 +1350,8 @@ private: } //============================================================================== - void processEvents (const AURenderEvent *__nullable realtimeEventListHead, int numParams, AUEventSampleTime startTime) + void processEvents (const AURenderEvent *__nullable realtimeEventListHead, [[maybe_unused]] int numParams, AUEventSampleTime startTime) { - ignoreUnused (numParams); - for (const AURenderEvent* event = realtimeEventListHead; event != nullptr; event = event->head.next) { switch (event->head.eventType) diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 884f7d40d6..e7bfc75857 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -386,13 +386,12 @@ public: return false; } - Image getIAAHostIcon (int size) + Image getIAAHostIcon ([[maybe_unused]] int size) { #if JUCE_IOS && JucePlugin_Enable_IAA if (auto device = dynamic_cast (deviceManager.getCurrentAudioDevice())) return device->getIcon (size); #else - ignoreUnused (size); #endif return {}; diff --git a/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp b/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp index 74b5ec56a2..5d7d3768c0 100644 --- a/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/Unity/juce_Unity_Wrapper.cpp @@ -158,10 +158,8 @@ private: return std::make_unique (Image (this)); } - void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, Image::BitmapData::ReadWriteMode mode) override + void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, [[maybe_unused]] Image::BitmapData::ReadWriteMode mode) override { - ignoreUnused (mode); - const auto offset = (size_t) x * (size_t) pixelStride + (size_t) y * (size_t) lineStride; bitmap.data = imageData + offset; bitmap.size = (size_t) (lineStride * height) - offset; @@ -568,7 +566,6 @@ static UnityAudioEffectDefinition getEffectDefinition() result.setPosition = [] (UnityAudioEffectState* state, unsigned int pos) { ignoreUnused (state, pos); - return 0; }; diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp index 1cee5c001c..5988ef6325 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp @@ -962,14 +962,12 @@ public: , public Timer #endif { - EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor, float initialScale) + EditorCompWrapper (JuceVSTWrapper& w, AudioProcessorEditor& editor, [[maybe_unused]] float initialScale) : wrapper (w) { editor.setOpaque (true); #if ! JUCE_MAC editor.setScaleFactor (initialScale); - #else - ignoreUnused (initialScale); #endif addAndMakeVisible (editor); @@ -1714,13 +1712,12 @@ private: return 0; } - pointer_sized_int handlePreAudioProcessingEvents (VstOpCodeArguments args) + pointer_sized_int handlePreAudioProcessingEvents ([[maybe_unused]] VstOpCodeArguments args) { #if JucePlugin_WantsMidiInput || JucePlugin_IsMidiEffect VSTMidiEventList::addEventsToMidiBuffer ((Vst2::VstEvents*) args.ptr, midiEvents); return 1; #else - ignoreUnused (args); return 0; #endif } @@ -2013,7 +2010,7 @@ private: return 0; } - pointer_sized_int handleSetContentScaleFactor (float scale, bool force = false) + pointer_sized_int handleSetContentScaleFactor ([[maybe_unused]] float scale, [[maybe_unused]] bool force = false) { checkWhetherMessageThreadIsCorrect(); #if JUCE_LINUX || JUCE_BSD @@ -2030,9 +2027,6 @@ private: if (editorComp != nullptr) editorComp->setContentScaleFactor (editorScaleFactor); } - - #else - ignoreUnused (scale, force); #endif return 1; diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm index 8e3fab4124..2c13881a5a 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.mm @@ -80,7 +80,7 @@ void initialiseMacVST() } JUCE_API void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, bool isNSView); -void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, bool isNSView) +void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, [[maybe_unused]] bool isNSView) { JUCE_AUTORELEASEPOOL { @@ -161,7 +161,6 @@ void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, } #endif - ignoreUnused (isNSView); NSView* parentView = [(NSView*) parentWindowOrView retain]; #if JucePlugin_EditorRequiresKeyboardFocus @@ -183,7 +182,7 @@ void* attachComponentToWindowRefVST (Component* comp, void* parentWindowOrView, } JUCE_API void detachComponentFromWindowRefVST (Component* comp, void* window, bool isNSView); -void detachComponentFromWindowRefVST (Component* comp, void* window, bool isNSView) +void detachComponentFromWindowRefVST (Component* comp, void* window, [[maybe_unused]] bool isNSView) { JUCE_AUTORELEASEPOOL { @@ -232,14 +231,13 @@ void detachComponentFromWindowRefVST (Component* comp, void* window, bool isNSVi } #endif - ignoreUnused (isNSView); comp->removeFromDesktop(); [(id) window release]; } } JUCE_API void setNativeHostWindowSizeVST (void* window, Component* component, int newWidth, int newHeight, bool isNSView); -void setNativeHostWindowSizeVST (void* window, Component* component, int newWidth, int newHeight, bool isNSView) +void setNativeHostWindowSizeVST (void* window, Component* component, int newWidth, int newHeight, [[maybe_unused]] bool isNSView) { JUCE_AUTORELEASEPOOL { @@ -260,8 +258,6 @@ void setNativeHostWindowSizeVST (void* window, Component* component, int newWidt } #endif - ignoreUnused (isNSView); - if (NSView* hostView = (NSView*) window) { const int dx = newWidth - component->getWidth(); @@ -277,10 +273,10 @@ void setNativeHostWindowSizeVST (void* window, Component* component, int newWidt } JUCE_API void checkWindowVisibilityVST (void* window, Component* comp, bool isNSView); -void checkWindowVisibilityVST (void* window, Component* comp, bool isNSView) +void checkWindowVisibilityVST ([[maybe_unused]] void* window, + [[maybe_unused]] Component* comp, + [[maybe_unused]] bool isNSView) { - ignoreUnused (window, comp, isNSView); - #if ! JUCE_64BIT if (! isNSView) comp->setVisible ([((NSWindow*) window) isVisible]); @@ -288,7 +284,7 @@ void checkWindowVisibilityVST (void* window, Component* comp, bool isNSView) } JUCE_API bool forwardCurrentKeyEventToHostVST (Component* comp, bool isNSView); -bool forwardCurrentKeyEventToHostVST (Component* comp, bool isNSView) +bool forwardCurrentKeyEventToHostVST ([[maybe_unused]] Component* comp, [[maybe_unused]] bool isNSView) { #if ! JUCE_64BIT if (! isNSView) @@ -300,7 +296,6 @@ bool forwardCurrentKeyEventToHostVST (Component* comp, bool isNSView) } #endif - ignoreUnused (comp, isNSView); return false; } diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 5e2c974973..2aae192862 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -1075,14 +1075,15 @@ public: } //============================================================================== - tresult PLUGIN_API getMidiControllerAssignment (Steinberg::int32 /*busIndex*/, Steinberg::int16 channel, - Vst::CtrlNumber midiControllerNumber, Vst::ParamID& resultID) override + tresult PLUGIN_API getMidiControllerAssignment ([[maybe_unused]] Steinberg::int32 busIndex, + [[maybe_unused]] Steinberg::int16 channel, + [[maybe_unused]] Vst::CtrlNumber midiControllerNumber, + [[maybe_unused]] Vst::ParamID& resultID) override { #if JUCE_VST3_EMULATE_MIDI_CC_WITH_PARAMETERS resultID = midiControllerToParameter[channel][midiControllerNumber]; return kResultTrue; // Returning false makes some hosts stop asking for further MIDI Controller Assignments #else - ignoreUnused (channel, midiControllerNumber, resultID); return kResultFalse; #endif } @@ -1991,7 +1992,7 @@ private: return kResultFalse; } - tresult PLUGIN_API setContentScaleFactor (const Steinberg::IPlugViewContentScaleSupport::ScaleFactor factor) override + tresult PLUGIN_API setContentScaleFactor ([[maybe_unused]] const Steinberg::IPlugViewContentScaleSupport::ScaleFactor factor) override { #if ! JUCE_MAC const auto scaleToApply = [&] @@ -2016,7 +2017,6 @@ private: return kResultTrue; #else - ignoreUnused (factor); return kResultFalse; #endif } @@ -2427,9 +2427,8 @@ public: #ifdef JucePlugin_PreferredChannelConfigurations short configs[][2] = { JucePlugin_PreferredChannelConfigurations }; - const int numConfigs = numElementsInArray (configs); + [[maybe_unused]] const int numConfigs = numElementsInArray (configs); - ignoreUnused (numConfigs); jassert (numConfigs > 0 && (configs[0][0] > 0 || configs[0][1] > 0)); pluginInstance->setPlayConfigDetails (configs[0][0], configs[0][1], 44100.0, 1024); diff --git a/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp b/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp index 0c2e7a1792..eb2b72602e 100644 --- a/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp +++ b/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp @@ -134,7 +134,10 @@ namespace juce #if JucePlugin_Build_VST bool JUCE_API handleManufacturerSpecificVST2Opcode (int32 index, pointer_sized_int value, void* ptr, float); - bool JUCE_API handleManufacturerSpecificVST2Opcode (int32 index, pointer_sized_int value, void* ptr, float) + bool JUCE_API handleManufacturerSpecificVST2Opcode ([[maybe_unused]] int32 index, + [[maybe_unused]] pointer_sized_int value, + [[maybe_unused]] void* ptr, + float) { #if VST3_REPLACEMENT_AVAILABLE if ((index == (int32) ByteOrder::bigEndianInt ("stCA") || index == (int32) ByteOrder::bigEndianInt ("stCa")) @@ -145,8 +148,6 @@ namespace juce ::memcpy (ptr, fuid, 16); return true; } - #else - ignoreUnused (index, value, ptr); #endif return false; } diff --git a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp index 9ba57bea46..3e5c029bf4 100644 --- a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp +++ b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp @@ -64,10 +64,8 @@ void AudioPluginFormatManager::addDefaultFormats() #if JUCE_DEBUG // you should only call this method once! - for (auto* format : formats) + for (auto* format [[maybe_unused]] : formats) { - ignoreUnused (format); - #if HAS_VST jassert (dynamic_cast (format) == nullptr); #endif diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index 359c238f7c..ef7b30ad05 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -179,14 +179,15 @@ namespace AudioUnitFormatHelpers return false; } - static bool getComponentDescFromFile (const String& fileOrIdentifier, AudioComponentDescription& desc, - String& name, String& version, String& manufacturer) + static bool getComponentDescFromFile ([[maybe_unused]] const String& fileOrIdentifier, + [[maybe_unused]] AudioComponentDescription& desc, + [[maybe_unused]] String& name, + [[maybe_unused]] String& version, + [[maybe_unused]] String& manufacturer) { zerostruct (desc); #if JUCE_IOS - ignoreUnused (fileOrIdentifier, name, version, manufacturer); - return false; #else const File file (fileOrIdentifier); @@ -434,7 +435,7 @@ namespace AudioUnitFormatHelpers } } -static bool hasARAExtension (AudioUnit audioUnit) +static bool hasARAExtension ([[maybe_unused]] AudioUnit audioUnit) { #if JUCE_PLUGINHOST_ARA UInt32 propertySize = sizeof (ARA::ARAAudioUnitFactory); @@ -449,8 +450,6 @@ static bool hasARAExtension (AudioUnit audioUnit) if ((status == noErr) && (propertySize == sizeof (ARA::ARAAudioUnitFactory)) && ! isWriteable) return true; - #else - ignoreUnused (audioUnit); #endif return false; @@ -465,7 +464,7 @@ using AudioUnitUniquePtr = std::unique_ptr, Aud using AudioUnitSharedPtr = std::shared_ptr>; using AudioUnitWeakPtr = std::weak_ptr>; -static std::shared_ptr getARAFactory (AudioUnitSharedPtr audioUnit) +static std::shared_ptr getARAFactory ([[maybe_unused]] AudioUnitSharedPtr audioUnit) { #if JUCE_PLUGINHOST_ARA jassert (audioUnit != nullptr); @@ -491,8 +490,6 @@ static std::shared_ptr getARAFactory (AudioUnitSharedPtr [owningAuPtr = std::move (audioUnit)]() {}); } } - #else - ignoreUnused (audioUnit); #endif return {}; @@ -2640,13 +2637,12 @@ public: } } - void embedViewController (JUCE_IOS_MAC_VIEW* pluginView, const CGSize& size) + void embedViewController (JUCE_IOS_MAC_VIEW* pluginView, [[maybe_unused]] const CGSize& size) { wrapper.setView (pluginView); waitingForViewCallback = false; #if JUCE_MAC - ignoreUnused (size); if (pluginView != nil) wrapper.resizeToFitView(); #else @@ -2682,7 +2678,7 @@ private: bool waitingForViewCallback = false; - bool createView (bool createGenericViewIfNeeded) + bool createView ([[maybe_unused]] bool createGenericViewIfNeeded) { JUCE_IOS_MAC_VIEW* pluginView = nil; UInt32 dataSize = 0; @@ -2756,8 +2752,6 @@ private: pluginView = [[AUGenericView alloc] initWithAudioUnit: plugin.audioUnit]; } - #else - ignoreUnused (createGenericViewIfNeeded); #endif wrapper.setView (pluginView); diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp index cec1528a45..6121dd84e8 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp @@ -384,10 +384,8 @@ public: void getCurrentProgramStateInformation (MemoryBlock& destData) override { getStateInformation (destData); } void setCurrentProgramStateInformation (const void* data, int sizeInBytes) override { setStateInformation (data, sizeInBytes); } - void setStateInformation (const void* data, int sizeInBytes) override + void setStateInformation (const void* data, [[maybe_unused]] int sizeInBytes) override { - ignoreUnused (sizeInBytes); - auto* p = static_cast (data); for (int i = 0; i < getParameters().size(); ++i) diff --git a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp index 933bad1d35..4ef7f4b3b5 100644 --- a/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LV2PluginFormat.cpp @@ -1278,10 +1278,8 @@ private: LV2_Options_Option* options, LV2_Worker_Schedule* schedule, LV2_Resize_Port_Resize* resize, - LV2_Log_Log* log) + [[maybe_unused]] LV2_Log_Log* log) { - ignoreUnused (log); - return { LV2_Feature { LV2_STATE__loadDefaultState, nullptr }, LV2_Feature { LV2_BUF_SIZE__boundedBlockLength, nullptr }, LV2_Feature { LV2_URID__map, map }, @@ -2873,11 +2871,10 @@ private: ports.forEachPort ([&] (const PortHeader& header) { - const auto emplaced = result.emplace (header.symbol, header.index); + [[maybe_unused]] const auto emplaced = result.emplace (header.symbol, header.index); // This will complain if there are duplicate port symbols. jassert (emplaced.second); - ignoreUnused (emplaced); }); return result; @@ -4884,10 +4881,8 @@ private: : freeWheelingPort->info.min; } - void pushMessage (MessageHeader header, uint32_t size, const void* data) + void pushMessage (MessageHeader header, [[maybe_unused]] uint32_t size, const void* data) { - ignoreUnused (size); - if (header.protocol == 0 || header.protocol == instance->urids.mLV2_UI__floatProtocol) { const auto value = readUnaligned (data); diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 43ec447636..3ebfbc661f 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -375,9 +375,8 @@ struct VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0 tresult PLUGIN_API setDirty (TBool) override; //============================================================================== - tresult PLUGIN_API requestOpenEditor (FIDString name) override + tresult PLUGIN_API requestOpenEditor ([[maybe_unused]] FIDString name) override { - ignoreUnused (name); jassertfalse; return kResultFalse; } @@ -1388,7 +1387,7 @@ static int compareWithString (Type (&charArray)[N], const String& str) } template -static void forEachARAFactory (IPluginFactory* pluginFactory, Callback&& cb) +static void forEachARAFactory ([[maybe_unused]] IPluginFactory* pluginFactory, [[maybe_unused]] Callback&& cb) { #if JUCE_PLUGINHOST_ARA && (JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX) const auto numClasses = pluginFactory->countClasses(); @@ -1404,12 +1403,11 @@ static void forEachARAFactory (IPluginFactory* pluginFactory, Callback&& cb) break; } } - #else - ignoreUnused (pluginFactory, cb); #endif } -static std::shared_ptr getARAFactory (Steinberg::IPluginFactory* pluginFactory, const String& pluginName) +static std::shared_ptr getARAFactory ([[maybe_unused]] Steinberg::IPluginFactory* pluginFactory, + [[maybe_unused]] const String& pluginName) { std::shared_ptr factory; @@ -1432,8 +1430,6 @@ static std::shared_ptr getARAFactory (Steinberg::IPluginF return true; }); - #else - ignoreUnused (pluginFactory, pluginName); #endif return factory; @@ -1667,8 +1663,8 @@ private: return; } - const auto attachedResult = view->attached ((void*) pluginHandle, defaultVST3WindowType); - ignoreUnused (warnOnFailure (attachedResult)); + [[maybe_unused]] const auto attachedResult = view->attached ((void*) pluginHandle, defaultVST3WindowType); + [[maybe_unused]] const auto warning = warnOnFailure (attachedResult); if (attachedResult == kResultOk) attachedCalled = true; @@ -1689,11 +1685,10 @@ private: { if (scaleInterface != nullptr) { - const auto result = scaleInterface->setContentScaleFactor ((Steinberg::IPlugViewContentScaleSupport::ScaleFactor) getEffectiveScale()); - ignoreUnused (result); + [[maybe_unused]] const auto result = scaleInterface->setContentScaleFactor ((Steinberg::IPlugViewContentScaleSupport::ScaleFactor) getEffectiveScale()); #if ! JUCE_MAC - ignoreUnused (warnOnFailure (result)); + [[maybe_unused]] const auto warning = warnOnFailure (result); #endif } } @@ -1885,8 +1880,7 @@ struct VST3ComponentHolder if (classIdx >= 0) { PClassInfo info; - bool success = (factory->getClassInfo (classIdx, &info) == kResultOk); - ignoreUnused (success); + [[maybe_unused]] bool success = (factory->getClassInfo (classIdx, &info) == kResultOk); jassert (success); VSTComSmartPtr pf2; @@ -3091,9 +3085,9 @@ public: } /** @note Not applicable to VST3 */ - void setCurrentProgramStateInformation (const void* data, int sizeInBytes) override + void setCurrentProgramStateInformation ([[maybe_unused]] const void* data, + [[maybe_unused]] int sizeInBytes) override { - ignoreUnused (data, sizeInBytes); } private: diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index f4bf5f7934..a8dc35d490 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -3028,10 +3028,8 @@ public: } //============================================================================== - void mouseDown (const MouseEvent& e) override + void mouseDown ([[maybe_unused]] const MouseEvent& e) override { - ignoreUnused (e); - #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD toFront (true); #endif diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp index b0ff4b67b4..ede5fbf954 100644 --- a/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/modules/juce_audio_processors/juce_audio_processors.cpp @@ -220,6 +220,7 @@ private: #include "utilities/juce_AudioProcessorValueTreeState.cpp" #include "utilities/juce_PluginHostType.cpp" #include "utilities/juce_NativeScaleFactorNotifier.cpp" +#include "utilities/juce_VSTCallbackHandler.cpp" #include "utilities/ARA/juce_ARA_utils.cpp" #include "format_types/juce_LV2PluginFormat.cpp" diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index 53aa9c3d83..f5815241ec 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -340,7 +340,7 @@ void AudioProcessor::removeListener (AudioProcessorListener* listenerToRemove) void AudioProcessor::setPlayConfigDetails (int newNumIns, int newNumOuts, double newSampleRate, int newBlockSize) { - bool success = true; + [[maybe_unused]] bool success = true; if (getTotalNumInputChannels() != newNumIns) success &= setChannelLayoutOfBus (true, 0, AudioChannelSet::canonicalChannelSet (newNumIns)); @@ -362,7 +362,6 @@ void AudioProcessor::setPlayConfigDetails (int newNumIns, int newNumOuts, double jassert (success && newNumIns == getTotalNumInputChannels() && newNumOuts == getTotalNumOutputChannels()); setRateAndBufferSizeDetails (newSampleRate, newBlockSize); - ignoreUnused (success); } void AudioProcessor::setRateAndBufferSizeDetails (double newSampleRate, int newBlockSize) noexcept @@ -442,10 +441,8 @@ void AudioProcessor::validateParameter (AudioProcessorParameter* param) #endif } -void AudioProcessor::checkForDuplicateTrimmedParamID (AudioProcessorParameter* param) +void AudioProcessor::checkForDuplicateTrimmedParamID ([[maybe_unused]] AudioProcessorParameter* param) { - ignoreUnused (param); - #if JUCE_DEBUG && ! JUCE_DISABLE_CAUTIOUS_PARAMETER_ID_CHECKING if (auto* withID = dynamic_cast (param)) { @@ -476,10 +473,8 @@ void AudioProcessor::checkForDuplicateTrimmedParamID (AudioProcessorParameter* p #endif } -void AudioProcessor::checkForDuplicateParamID (AudioProcessorParameter* param) +void AudioProcessor::checkForDuplicateParamID ([[maybe_unused]] AudioProcessorParameter* param) { - ignoreUnused (param); - #if JUCE_DEBUG if (auto* withID = dynamic_cast (param)) { @@ -491,10 +486,8 @@ void AudioProcessor::checkForDuplicateParamID (AudioProcessorParameter* param) #endif } -void AudioProcessor::checkForDuplicateGroupIDs (const AudioProcessorParameterGroup& newGroup) +void AudioProcessor::checkForDuplicateGroupIDs ([[maybe_unused]] const AudioProcessorParameterGroup& newGroup) { - ignoreUnused (newGroup); - #if JUCE_DEBUG auto groups = newGroup.getSubgroups (true); groups.add (&newGroup); @@ -598,10 +591,9 @@ void AudioProcessor::processBypassed (AudioBuffer& buffer, MidiBuffer void AudioProcessor::processBlockBypassed (AudioBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); } void AudioProcessor::processBlockBypassed (AudioBuffer& buffer, MidiBuffer& midi) { processBypassed (buffer, midi); } -void AudioProcessor::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) +void AudioProcessor::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] MidiBuffer& midiMessages) { - ignoreUnused (buffer, midiMessages); - // If you hit this assertion then either the caller called the double // precision version of processBlock on a processor which does not support it // (i.e. supportsDoublePrecisionProcessing() returns false), or the implementation @@ -1493,6 +1485,9 @@ AudioProcessorParameter* AudioProcessor::getParamChecked (int index) const return p; } +bool AudioProcessor::canAddBus ([[maybe_unused]] bool isInput) const { return false; } +bool AudioProcessor::canRemoveBus ([[maybe_unused]] bool isInput) const { return false; } + JUCE_END_IGNORE_WARNINGS_GCC_LIKE JUCE_END_IGNORE_WARNINGS_MSVC diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h index 2ea13dc9d6..b0acefa927 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h @@ -524,7 +524,7 @@ public: @see addBus */ - virtual bool canAddBus (bool isInput) const { ignoreUnused (isInput); return false; } + virtual bool canAddBus (bool isInput) const; /** Callback to query if the last bus can currently be removed. @@ -537,7 +537,7 @@ public: The default implementation will always return false. */ - virtual bool canRemoveBus (bool isInput) const { ignoreUnused (isInput); return false; } + virtual bool canRemoveBus (bool isInput) const; /** Dynamically request an additional bus. diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp index 3b88ccee00..7b20407cca 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp @@ -216,13 +216,11 @@ void AudioProcessorEditor::setScaleFactor (float newScale) typedef ComponentPeer* (*createUnityPeerFunctionType) (Component&); createUnityPeerFunctionType juce_createUnityPeerFn = nullptr; -ComponentPeer* AudioProcessorEditor::createNewPeer (int styleFlags, void* nativeWindow) +ComponentPeer* AudioProcessorEditor::createNewPeer ([[maybe_unused]] int styleFlags, + [[maybe_unused]] void* nativeWindow) { if (juce_createUnityPeerFn != nullptr) - { - ignoreUnused (styleFlags, nativeWindow); return juce_createUnityPeerFn (*this); - } return Component::createNewPeer (styleFlags, nativeWindow); } diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp index dc7414c5b3..6e819cda74 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARADocumentController.cpp @@ -834,138 +834,122 @@ ARAEditorView* ARADocumentControllerSpecialisation::doCreateEditorView() return new ARAEditorView (getDocumentController()); } -bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAvailable (const ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAvailable ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (audioSource, type); return false; } -ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioSourceContentGrade (const ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type) +ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioSourceContentGrade ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type) { // Overriding doIsAudioSourceContentAvailable() requires overriding // doGetAudioSourceContentGrade() accordingly! jassertfalse; - juce::ignoreUnused (audioSource, type); return ARA::kARAContentGradeInitial; } -ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioSourceContentReader (ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type, - const ARA::ARAContentTimeRange* range) +ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioSourceContentReader ([[maybe_unused]] ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type, + [[maybe_unused]] const ARA::ARAContentTimeRange* range) { // Overriding doIsAudioSourceContentAvailable() requires overriding // doCreateAudioSourceContentReader() accordingly! jassertfalse; - juce::ignoreUnused (audioSource, type, range); return nullptr; } -bool ARADocumentControllerSpecialisation::doIsAudioModificationContentAvailable (const ARA::PlugIn::AudioModification* audioModification, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsAudioModificationContentAvailable ([[maybe_unused]] const ARA::PlugIn::AudioModification* audioModification, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (audioModification, type); return false; } -ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioModificationContentGrade (const ARA::PlugIn::AudioModification* audioModification, - ARA::ARAContentType type) +ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetAudioModificationContentGrade ([[maybe_unused]] const ARA::PlugIn::AudioModification* audioModification, + [[maybe_unused]] ARA::ARAContentType type) { // Overriding doIsAudioModificationContentAvailable() requires overriding // doGetAudioModificationContentGrade() accordingly! jassertfalse; - juce::ignoreUnused (audioModification, type); return ARA::kARAContentGradeInitial; } -ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioModificationContentReader (ARA::PlugIn::AudioModification* audioModification, - ARA::ARAContentType type, - const ARA::ARAContentTimeRange* range) +ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreateAudioModificationContentReader ([[maybe_unused]] ARA::PlugIn::AudioModification* audioModification, + [[maybe_unused]] ARA::ARAContentType type, + [[maybe_unused]] const ARA::ARAContentTimeRange* range) { // Overriding doIsAudioModificationContentAvailable() requires overriding // doCreateAudioModificationContentReader() accordingly! jassertfalse; - juce::ignoreUnused (audioModification, type, range); return nullptr; } -bool ARADocumentControllerSpecialisation::doIsPlaybackRegionContentAvailable (const ARA::PlugIn::PlaybackRegion* playbackRegion, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsPlaybackRegionContentAvailable ([[maybe_unused]] const ARA::PlugIn::PlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (playbackRegion, type); return false; } -ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetPlaybackRegionContentGrade (const ARA::PlugIn::PlaybackRegion* playbackRegion, - ARA::ARAContentType type) +ARA::ARAContentGrade ARADocumentControllerSpecialisation::doGetPlaybackRegionContentGrade ([[maybe_unused]] const ARA::PlugIn::PlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::ARAContentType type) { // Overriding doIsPlaybackRegionContentAvailable() requires overriding // doGetPlaybackRegionContentGrade() accordingly! jassertfalse; - juce::ignoreUnused (playbackRegion, type); return ARA::kARAContentGradeInitial; } -ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreatePlaybackRegionContentReader (ARA::PlugIn::PlaybackRegion* playbackRegion, - ARA::ARAContentType type, - const ARA::ARAContentTimeRange* range) +ARA::PlugIn::ContentReader* ARADocumentControllerSpecialisation::doCreatePlaybackRegionContentReader ([[maybe_unused]] ARA::PlugIn::PlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::ARAContentType type, + [[maybe_unused]] const ARA::ARAContentTimeRange* range) { // Overriding doIsPlaybackRegionContentAvailable() requires overriding // doCreatePlaybackRegionContentReader() accordingly! jassertfalse; - juce::ignoreUnused (playbackRegion, type, range); return nullptr; } -bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAnalysisIncomplete (const ARA::PlugIn::AudioSource* audioSource, - ARA::ARAContentType type) +bool ARADocumentControllerSpecialisation::doIsAudioSourceContentAnalysisIncomplete ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAContentType type) { - juce::ignoreUnused (audioSource, type); return false; } -void ARADocumentControllerSpecialisation::doRequestAudioSourceContentAnalysis (ARA::PlugIn::AudioSource* audioSource, - std::vector const& contentTypes) +void ARADocumentControllerSpecialisation::doRequestAudioSourceContentAnalysis ([[maybe_unused]] ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] std::vector const& contentTypes) { - juce::ignoreUnused (audioSource, contentTypes); } ARA::ARAInt32 ARADocumentControllerSpecialisation::doGetProcessingAlgorithmsCount() { return 0; } const ARA::ARAProcessingAlgorithmProperties* - ARADocumentControllerSpecialisation::doGetProcessingAlgorithmProperties (ARA::ARAInt32 algorithmIndex) + ARADocumentControllerSpecialisation::doGetProcessingAlgorithmProperties ([[maybe_unused]] ARA::ARAInt32 algorithmIndex) { - juce::ignoreUnused (algorithmIndex); return nullptr; } -ARA::ARAInt32 ARADocumentControllerSpecialisation::doGetProcessingAlgorithmForAudioSource (const ARA::PlugIn::AudioSource* audioSource) +ARA::ARAInt32 ARADocumentControllerSpecialisation::doGetProcessingAlgorithmForAudioSource ([[maybe_unused]] const ARA::PlugIn::AudioSource* audioSource) { // doGetProcessingAlgorithmForAudioSource() must be implemented if the supported // algorithm count is greater than zero. if (getDocumentController()->getProcessingAlgorithmsCount() > 0) jassertfalse; - juce::ignoreUnused (audioSource); return 0; } -void ARADocumentControllerSpecialisation::doRequestProcessingAlgorithmForAudioSource (ARA::PlugIn::AudioSource* audioSource, - ARA::ARAInt32 algorithmIndex) +void ARADocumentControllerSpecialisation::doRequestProcessingAlgorithmForAudioSource ([[maybe_unused]] ARA::PlugIn::AudioSource* audioSource, + [[maybe_unused]] ARA::ARAInt32 algorithmIndex) { // doRequestProcessingAlgorithmForAudioSource() must be implemented if the supported // algorithm count is greater than zero. - if (getDocumentController()->getProcessingAlgorithmsCount() > 0) - jassertfalse; - - juce::ignoreUnused (audioSource, algorithmIndex); + jassert (getDocumentController()->getProcessingAlgorithmsCount() <= 0); } } // namespace juce diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp index 918aee434e..3db1433027 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.cpp @@ -196,4 +196,98 @@ void ARAPlaybackRegion::notifyContentChanged (ARAContentUpdateScopes scopeFlags, notifyARAHost); } +//============================================================================== +void ARADocumentListener::willBeginEditing ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didEndEditing ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::willNotifyModelUpdates ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didNotifyModelUpdates ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::willUpdateDocumentProperties ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARADocumentListener::didUpdateDocumentProperties ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didAddMusicalContextToDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARADocumentListener::willRemoveMusicalContextFromDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARADocumentListener::didReorderMusicalContextsInDocument ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didAddRegionSequenceToDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARADocumentListener::willRemoveRegionSequenceFromDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARADocumentListener::didReorderRegionSequencesInDocument ([[maybe_unused]] ARADocument* document) {} +void ARADocumentListener::didAddAudioSourceToDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAAudioSource* audioSource) {} +void ARADocumentListener::willRemoveAudioSourceFromDocument ([[maybe_unused]] ARADocument* document, + [[maybe_unused]] ARAAudioSource* audioSource) {} +void ARADocumentListener::willDestroyDocument ([[maybe_unused]] ARADocument* document) {} + +//============================================================================== +void ARAMusicalContextListener::willUpdateMusicalContextProperties ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAMusicalContextListener::didUpdateMusicalContextProperties ([[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARAMusicalContextListener::doUpdateMusicalContextContent ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAMusicalContextListener::didAddRegionSequenceToMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARAMusicalContextListener::willRemoveRegionSequenceFromMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext, + [[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARAMusicalContextListener::didReorderRegionSequencesInMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext) {} +void ARAMusicalContextListener::willDestroyMusicalContext ([[maybe_unused]] ARAMusicalContext* musicalContext) {} + +//============================================================================== +void ARAPlaybackRegionListener::willUpdatePlaybackRegionProperties ([[maybe_unused]] ARAPlaybackRegion* playbackRegion, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAPlaybackRegionListener::didUpdatePlaybackRegionProperties ([[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARAPlaybackRegionListener::didUpdatePlaybackRegionContent ([[maybe_unused]] ARAPlaybackRegion* playbackRegion, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAPlaybackRegionListener::willDestroyPlaybackRegion ([[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} + +//============================================================================== +void ARARegionSequenceListener::willUpdateRegionSequenceProperties ([[maybe_unused]] ARARegionSequence* regionSequence, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARARegionSequenceListener::didUpdateRegionSequenceProperties ([[maybe_unused]] ARARegionSequence* regionSequence) {} +void ARARegionSequenceListener::willRemovePlaybackRegionFromRegionSequence ([[maybe_unused]] ARARegionSequence* regionSequence, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARARegionSequenceListener::didAddPlaybackRegionToRegionSequence ([[maybe_unused]] ARARegionSequence* regionSequence, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARARegionSequenceListener::willDestroyRegionSequence ([[maybe_unused]] ARARegionSequence* regionSequence) {} + +//============================================================================== +void ARAAudioSourceListener::willUpdateAudioSourceProperties ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAAudioSourceListener::didUpdateAudioSourceProperties ([[maybe_unused]] ARAAudioSource* audioSource) {} +void ARAAudioSourceListener::doUpdateAudioSourceContent ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAAudioSourceListener::didUpdateAudioSourceAnalysisProgress ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARA::ARAAnalysisProgressState state, + [[maybe_unused]] float progress) {} +void ARAAudioSourceListener::willEnableAudioSourceSamplesAccess ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool enable) {} +void ARAAudioSourceListener::didEnableAudioSourceSamplesAccess ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool enable) {} +void ARAAudioSourceListener::willDeactivateAudioSourceForUndoHistory ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool deactivate) {} +void ARAAudioSourceListener::didDeactivateAudioSourceForUndoHistory ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] bool deactivate) {} +void ARAAudioSourceListener::didAddAudioModificationToAudioSource ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARAAudioModification* audioModification) {} +void ARAAudioSourceListener::willRemoveAudioModificationFromAudioSource ([[maybe_unused]] ARAAudioSource* audioSource, + [[maybe_unused]] ARAAudioModification* audioModification) {} +void ARAAudioSourceListener::willDestroyAudioSource ([[maybe_unused]] ARAAudioSource* audioSource) {} + +//============================================================================== +void ARAAudioModificationListener::willUpdateAudioModificationProperties ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARA::PlugIn::PropertiesPtr newProperties) {} +void ARAAudioModificationListener::didUpdateAudioModificationProperties ([[maybe_unused]] ARAAudioModification* audioModification) {} +void ARAAudioModificationListener::didUpdateAudioModificationContent ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARAContentUpdateScopes scopeFlags) {} +void ARAAudioModificationListener::willDeactivateAudioModificationForUndoHistory ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] bool deactivate) {} +void ARAAudioModificationListener::didDeactivateAudioModificationForUndoHistory ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] bool deactivate) {} +void ARAAudioModificationListener::didAddPlaybackRegionToAudioModification ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARAAudioModificationListener::willRemovePlaybackRegionFromAudioModification ([[maybe_unused]] ARAAudioModification* audioModification, + [[maybe_unused]] ARAPlaybackRegion* playbackRegion) {} +void ARAAudioModificationListener::willDestroyAudioModification ([[maybe_unused]] ARAAudioModification* audioModification) {} + } // namespace juce diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h index e5434e3c7b..2f3096f2f8 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAModelObjects.h @@ -181,76 +181,49 @@ public: /** Destructor */ virtual ~ARADocumentListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the document enters an editing state. @param document The document about to enter an editing state. */ - virtual void willBeginEditing (ARADocument* document) - { - ignoreUnused (document); - } + virtual void willBeginEditing (ARADocument* document); /** Called after the document exits an editing state. @param document The document about exit an editing state. */ - virtual void didEndEditing (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didEndEditing (ARADocument* document); /** Called before sending model updates do the host. @param document The document whose model updates are about to be sent. */ - virtual void willNotifyModelUpdates (ARADocument* document) - { - ignoreUnused (document); - } + virtual void willNotifyModelUpdates (ARADocument* document); /** Called after sending model updates do the host. @param document The document whose model updates have just been sent. */ - virtual void didNotifyModelUpdates (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didNotifyModelUpdates (ARADocument* document); /** Called before the document's properties are updated. @param document The document whose properties will be updated. @param newProperties The document properties that will be assigned to \p document. */ virtual void willUpdateDocumentProperties (ARADocument* document, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (document, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the document's properties are updated. @param document The document whose properties were updated. */ - virtual void didUpdateDocumentProperties (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didUpdateDocumentProperties (ARADocument* document); /** Called after a musical context is added to the document. @param document The document that \p musicalContext was added to. @param musicalContext The musical context that was added to \p document. */ - virtual void didAddMusicalContextToDocument (ARADocument* document, ARAMusicalContext* musicalContext) - { - ignoreUnused (document, musicalContext); - } + virtual void didAddMusicalContextToDocument (ARADocument* document, ARAMusicalContext* musicalContext); /** Called before a musical context is removed from the document. @param document The document that \p musicalContext will be removed from. @param musicalContext The musical context that will be removed from \p document. */ - virtual void willRemoveMusicalContextFromDocument (ARADocument* document, - ARAMusicalContext* musicalContext) - { - ignoreUnused (document, musicalContext); - } + virtual void willRemoveMusicalContextFromDocument (ARADocument* document, ARAMusicalContext* musicalContext); /** Called after the musical contexts are reordered in an ARA document @@ -259,29 +232,19 @@ public: @param document The document with reordered musical contexts. */ - virtual void didReorderMusicalContextsInDocument (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didReorderMusicalContextsInDocument (ARADocument* document); /** Called after a region sequence is added to the document. @param document The document that \p regionSequence was added to. @param regionSequence The region sequence that was added to \p document. */ - virtual void didAddRegionSequenceToDocument (ARADocument* document, ARARegionSequence* regionSequence) - { - ignoreUnused (document, regionSequence); - } + virtual void didAddRegionSequenceToDocument (ARADocument* document, ARARegionSequence* regionSequence); /** Called before a region sequence is removed from the document. @param document The document that \p regionSequence will be removed from. @param regionSequence The region sequence that will be removed from \p document. */ - virtual void willRemoveRegionSequenceFromDocument (ARADocument* document, - ARARegionSequence* regionSequence) - { - ignoreUnused (document, regionSequence); - } + virtual void willRemoveRegionSequenceFromDocument (ARADocument* document, ARARegionSequence* regionSequence); /** Called after the region sequences are reordered in an ARA document @@ -290,38 +253,24 @@ public: @param document The document with reordered region sequences. */ - virtual void didReorderRegionSequencesInDocument (ARADocument* document) - { - ignoreUnused (document); - } + virtual void didReorderRegionSequencesInDocument (ARADocument* document); /** Called after an audio source is added to the document. @param document The document that \p audioSource was added to. @param audioSource The audio source that was added to \p document. */ - virtual void didAddAudioSourceToDocument (ARADocument* document, ARAAudioSource* audioSource) - { - ignoreUnused (document, audioSource); - } + virtual void didAddAudioSourceToDocument (ARADocument* document, ARAAudioSource* audioSource); /** Called before an audio source is removed from the document. @param document The document that \p audioSource will be removed from . @param audioSource The audio source that will be removed from \p document. */ - virtual void willRemoveAudioSourceFromDocument (ARADocument* document, ARAAudioSource* audioSource) - { - ignoreUnused (document, audioSource); - } + virtual void willRemoveAudioSourceFromDocument (ARADocument* document, ARAAudioSource* audioSource); /** Called before the document is destroyed by the ARA host. @param document The document that will be destroyed. */ - virtual void willDestroyDocument (ARADocument* document) - { - ignoreUnused (document); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyDocument (ARADocument* document); }; //============================================================================== @@ -395,55 +344,36 @@ class JUCE_API ARAMusicalContextListener public: virtual ~ARAMusicalContextListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the musical context's properties are updated. @param musicalContext The musical context whose properties will be updated. @param newProperties The musical context properties that will be assigned to \p musicalContext. */ virtual void willUpdateMusicalContextProperties (ARAMusicalContext* musicalContext, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (musicalContext, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the musical context's properties are updated by the host. @param musicalContext The musical context whose properties were updated. */ - virtual void didUpdateMusicalContextProperties (ARAMusicalContext* musicalContext) - { - ignoreUnused (musicalContext); - } + virtual void didUpdateMusicalContextProperties (ARAMusicalContext* musicalContext); /** Called when the musical context's content (i.e tempo entries or chords) changes. @param musicalContext The musical context with updated content. @param scopeFlags The scope of the content update indicating what has changed. */ - virtual void doUpdateMusicalContextContent (ARAMusicalContext* musicalContext, - ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (musicalContext, scopeFlags); - } + virtual void doUpdateMusicalContextContent (ARAMusicalContext* musicalContext, ARAContentUpdateScopes scopeFlags); /** Called after a region sequence is added to the musical context. @param musicalContext The musical context that \p regionSequence was added to. @param regionSequence The region sequence that was added to \p musicalContext. */ - virtual void didAddRegionSequenceToMusicalContext (ARAMusicalContext* musicalContext, - ARARegionSequence* regionSequence) - { - ignoreUnused (musicalContext, regionSequence); - } + virtual void didAddRegionSequenceToMusicalContext (ARAMusicalContext* musicalContext, ARARegionSequence* regionSequence); /** Called before a region sequence is removed from the musical context. @param musicalContext The musical context that \p regionSequence will be removed from. @param regionSequence The region sequence that will be removed from \p musicalContext. */ virtual void willRemoveRegionSequenceFromMusicalContext (ARAMusicalContext* musicalContext, - ARARegionSequence* regionSequence) - { - ignoreUnused (musicalContext, regionSequence); - } + ARARegionSequence* regionSequence); /** Called after the region sequences are reordered in an ARA MusicalContext @@ -452,20 +382,12 @@ public: @param musicalContext The musical context with reordered region sequences. */ - virtual void didReorderRegionSequencesInMusicalContext (ARAMusicalContext* musicalContext) - { - ignoreUnused (musicalContext); - } + virtual void didReorderRegionSequencesInMusicalContext (ARAMusicalContext* musicalContext); /** Called before the musical context is destroyed. @param musicalContext The musical context that will be destroyed. */ - virtual void willDestroyMusicalContext (ARAMusicalContext* musicalContext) - { - ignoreUnused (musicalContext); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyMusicalContext (ARAMusicalContext* musicalContext); }; //============================================================================== @@ -528,45 +450,29 @@ public: /** Destructor. */ virtual ~ARAPlaybackRegionListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the playback region's properties are updated. @param playbackRegion The playback region whose properties will be updated. @param newProperties The playback region properties that will be assigned to \p playbackRegion. */ virtual void willUpdatePlaybackRegionProperties (ARAPlaybackRegion* playbackRegion, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (playbackRegion, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the playback region's properties are updated. @param playbackRegion The playback region whose properties were updated. */ - virtual void didUpdatePlaybackRegionProperties (ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (playbackRegion); - } + virtual void didUpdatePlaybackRegionProperties (ARAPlaybackRegion* playbackRegion); /** Called when the playback region's content (i.e. samples or notes) changes. @param playbackRegion The playback region with updated content. @param scopeFlags The scope of the content update. */ virtual void didUpdatePlaybackRegionContent (ARAPlaybackRegion* playbackRegion, - ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (playbackRegion, scopeFlags); - } + ARAContentUpdateScopes scopeFlags); /** Called before the playback region is destroyed. @param playbackRegion The playback region that will be destroyed. */ - virtual void willDestroyPlaybackRegion (ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (playbackRegion); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyPlaybackRegion (ARAPlaybackRegion* playbackRegion); }; //============================================================================== @@ -665,55 +571,36 @@ public: /** Destructor. */ virtual ~ARARegionSequenceListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the region sequence's properties are updated. @param regionSequence The region sequence whose properties will be updated. @param newProperties The region sequence properties that will be assigned to \p regionSequence. */ virtual void willUpdateRegionSequenceProperties (ARARegionSequence* regionSequence, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (regionSequence, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the region sequence's properties are updated. @param regionSequence The region sequence whose properties were updated. */ - virtual void didUpdateRegionSequenceProperties (ARARegionSequence* regionSequence) - { - ignoreUnused (regionSequence); - } + virtual void didUpdateRegionSequenceProperties (ARARegionSequence* regionSequence); /** Called before a playback region is removed from the region sequence. @param regionSequence The region sequence that \p playbackRegion will be removed from. @param playbackRegion The playback region that will be removed from \p regionSequence. */ virtual void willRemovePlaybackRegionFromRegionSequence (ARARegionSequence* regionSequence, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (regionSequence, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called after a playback region is added to the region sequence. @param regionSequence The region sequence that \p playbackRegion was added to. @param playbackRegion The playback region that was added to \p regionSequence. */ virtual void didAddPlaybackRegionToRegionSequence (ARARegionSequence* regionSequence, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (regionSequence, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called before the region sequence is destroyed. @param regionSequence The region sequence that will be destroyed. */ - virtual void willDestroyRegionSequence (ARARegionSequence* regionSequence) - { - ignoreUnused (regionSequence); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyRegionSequence (ARARegionSequence* regionSequence); }; //============================================================================== @@ -800,34 +687,23 @@ public: /** Destructor. */ virtual ~ARAAudioSourceListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the audio source's properties are updated. @param audioSource The audio source whose properties will be updated. @param newProperties The audio source properties that will be assigned to \p audioSource. */ virtual void willUpdateAudioSourceProperties (ARAAudioSource* audioSource, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (audioSource, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the audio source's properties are updated. @param audioSource The audio source whose properties were updated. */ - virtual void didUpdateAudioSourceProperties (ARAAudioSource* audioSource) - { - ignoreUnused (audioSource); - } + virtual void didUpdateAudioSourceProperties (ARAAudioSource* audioSource); /** Called when the audio source's content (i.e. samples or notes) changes. @param audioSource The audio source with updated content. @param scopeFlags The scope of the content update. */ - virtual void doUpdateAudioSourceContent (ARAAudioSource* audioSource, ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (audioSource, scopeFlags); - } + virtual void doUpdateAudioSourceContent (ARAAudioSource* audioSource, ARAContentUpdateScopes scopeFlags); /** Called to notify progress when an audio source is being analyzed. @param audioSource The audio source being analyzed. @@ -836,76 +712,54 @@ public: */ virtual void didUpdateAudioSourceAnalysisProgress (ARAAudioSource* audioSource, ARA::ARAAnalysisProgressState state, - float progress) - { - ignoreUnused (audioSource, state, progress); - } + float progress); /** Called before access to an audio source's samples is enabled or disabled. @param audioSource The audio source whose sample access state will be changed. @param enable A bool indicating whether or not sample access will be enabled or disabled. */ - virtual void willEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, bool enable) - { - ignoreUnused (audioSource, enable); - } + virtual void willEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, + bool enable); /** Called after access to an audio source's samples is enabled or disabled. @param audioSource The audio source whose sample access state was changed. @param enable A bool indicating whether or not sample access was enabled or disabled. */ - virtual void didEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, bool enable) - { - ignoreUnused (audioSource, enable); - } + virtual void didEnableAudioSourceSamplesAccess (ARAAudioSource* audioSource, + bool enable); /** Called before an audio source is activated or deactivated when being removed / added from the host's undo history. @param audioSource The audio source that will be activated or deactivated @param deactivate A bool indicating whether \p audioSource was deactivated or activated. */ - virtual void willDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, bool deactivate) - { - ignoreUnused (audioSource, deactivate); - } + virtual void willDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, + bool deactivate); /** Called after an audio source is activated or deactivated when being removed / added from the host's undo history. @param audioSource The audio source that was activated or deactivated @param deactivate A bool indicating whether \p audioSource was deactivated or activated. */ - virtual void didDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, bool deactivate) - { - ignoreUnused (audioSource, deactivate); - } + virtual void didDeactivateAudioSourceForUndoHistory (ARAAudioSource* audioSource, + bool deactivate); /** Called after an audio modification is added to the audio source. @param audioSource The region sequence that \p audioModification was added to. @param audioModification The playback region that was added to \p audioSource. */ virtual void didAddAudioModificationToAudioSource (ARAAudioSource* audioSource, - ARAAudioModification* audioModification) - { - ignoreUnused (audioSource, audioModification); - } + ARAAudioModification* audioModification); /** Called before an audio modification is removed from the audio source. @param audioSource The audio source that \p audioModification will be removed from. @param audioModification The audio modification that will be removed from \p audioSource. */ virtual void willRemoveAudioModificationFromAudioSource (ARAAudioSource* audioSource, - ARAAudioModification* audioModification) - { - ignoreUnused (audioSource, audioModification); - } + ARAAudioModification* audioModification); /** Called before the audio source is destroyed. @param audioSource The audio source that will be destroyed. */ - virtual void willDestroyAudioSource (ARAAudioSource* audioSource) - { - ignoreUnused (audioSource); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyAudioSource (ARAAudioSource* audioSource); }; //============================================================================== @@ -1004,82 +858,57 @@ public: /** Destructor. */ virtual ~ARAAudioModificationListener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called before the audio modification's properties are updated. @param audioModification The audio modification whose properties will be updated. @param newProperties The audio modification properties that will be assigned to \p audioModification. */ virtual void willUpdateAudioModificationProperties (ARAAudioModification* audioModification, - ARA::PlugIn::PropertiesPtr newProperties) - { - ignoreUnused (audioModification, newProperties); - } + ARA::PlugIn::PropertiesPtr newProperties); /** Called after the audio modification's properties are updated. @param audioModification The audio modification whose properties were updated. */ - virtual void didUpdateAudioModificationProperties (ARAAudioModification* audioModification) - { - ignoreUnused (audioModification); - } + virtual void didUpdateAudioModificationProperties (ARAAudioModification* audioModification); /** Called when the audio modification's content (i.e. samples or notes) changes. @param audioModification The audio modification with updated content. @param scopeFlags The scope of the content update. */ - virtual void didUpdateAudioModificationContent (ARAAudioModification* audioModification, ARAContentUpdateScopes scopeFlags) - { - ignoreUnused (audioModification, scopeFlags); - } + virtual void didUpdateAudioModificationContent (ARAAudioModification* audioModification, + ARAContentUpdateScopes scopeFlags); /** Called before an audio modification is activated or deactivated when being removed / added from the host's undo history. @param audioModification The audio modification that was activated or deactivated @param deactivate A bool indicating whether \p audioModification was deactivated or activated. */ - virtual void willDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, bool deactivate) - { - ignoreUnused (audioModification, deactivate); - } + virtual void willDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, + bool deactivate); /** Called after an audio modification is activated or deactivated when being removed / added from the host's undo history. @param audioModification The audio modification that was activated or deactivated @param deactivate A bool indicating whether \p audioModification was deactivated or activated. */ - virtual void didDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, bool deactivate) - { - ignoreUnused (audioModification, deactivate); - } + virtual void didDeactivateAudioModificationForUndoHistory (ARAAudioModification* audioModification, + bool deactivate); /** Called after a playback region is added to the audio modification. @param audioModification The audio modification that \p playbackRegion was added to. @param playbackRegion The playback region that was added to \p audioModification. */ virtual void didAddPlaybackRegionToAudioModification (ARAAudioModification* audioModification, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (audioModification, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called before a playback region is removed from the audio modification. @param audioModification The audio modification that \p playbackRegion will be removed from. @param playbackRegion The playback region that will be removed from \p audioModification. */ virtual void willRemovePlaybackRegionFromAudioModification (ARAAudioModification* audioModification, - ARAPlaybackRegion* playbackRegion) - { - ignoreUnused (audioModification, playbackRegion); - } + ARAPlaybackRegion* playbackRegion); /** Called before the audio modification is destroyed. @param audioModification The audio modification that will be destroyed. */ - virtual void willDestroyAudioModification (ARAAudioModification* audioModification) - { - ignoreUnused (audioModification); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void willDestroyAudioModification (ARAAudioModification* audioModification); }; //============================================================================== diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp index fcece498b5..c80e1027d6 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.cpp @@ -28,12 +28,10 @@ namespace juce { -bool ARARenderer::processBlock (AudioBuffer& buffer, - AudioProcessor::Realtime realtime, - const AudioPlayHead::PositionInfo& positionInfo) noexcept +bool ARARenderer::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] AudioProcessor::Realtime realtime, + [[maybe_unused]] const AudioPlayHead::PositionInfo& positionInfo) noexcept { - ignoreUnused (buffer, realtime, positionInfo); - // If you hit this assertion then either the caller called the double // precision version of processBlock on a processor which does not support it // (i.e. supportsDoublePrecisionProcessing() returns false), or the implementation @@ -43,6 +41,12 @@ bool ARARenderer::processBlock (AudioBuffer& buffer, return false; } +void ARARenderer::prepareToPlay ([[maybe_unused]] double sampleRate, + [[maybe_unused]] int maximumSamplesPerBlock, + [[maybe_unused]] int numChannels, + [[maybe_unused]] AudioProcessor::ProcessingPrecision precision, + [[maybe_unused]] AlwaysNonRealtime alwaysNonRealtime) {} + //============================================================================== #if ARA_VALIDATE_API_CALLS void ARAPlaybackRenderer::addPlaybackRegion (ARA::ARAPlaybackRegionRef playbackRegionRef) noexcept @@ -62,6 +66,21 @@ void ARAPlaybackRenderer::removePlaybackRegion (ARA::ARAPlaybackRegionRef playba } #endif +bool ARAPlaybackRenderer::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] AudioProcessor::Realtime realtime, + [[maybe_unused]] const AudioPlayHead::PositionInfo& positionInfo) noexcept +{ + return false; +} + +//============================================================================== +bool ARAEditorRenderer::processBlock ([[maybe_unused]] AudioBuffer& buffer, + [[maybe_unused]] AudioProcessor::Realtime isNonRealtime, + [[maybe_unused]] const AudioPlayHead::PositionInfo& positionInfo) noexcept +{ + return true; +} + //============================================================================== void ARAEditorView::doNotifySelection (const ARA::PlugIn::ViewSelection* viewSelection) noexcept { @@ -89,4 +108,7 @@ void ARAEditorView::removeListener (Listener* l) listeners.remove (l); } +void ARAEditorView::Listener::onNewSelection ([[maybe_unused]] const ARAViewSelection& viewSelection) {} +void ARAEditorView::Listener::onHideRegionSequences ([[maybe_unused]] const std::vector& regionSequences) {} + } // namespace juce diff --git a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h index 4306d922b2..490e56670f 100644 --- a/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h +++ b/modules/juce_audio_processors/utilities/ARA/juce_ARAPlugInInstanceRoles.h @@ -59,10 +59,7 @@ public: int maximumSamplesPerBlock, int numChannels, AudioProcessor::ProcessingPrecision precision, - AlwaysNonRealtime alwaysNonRealtime = AlwaysNonRealtime::no) - { - ignoreUnused (sampleRate, maximumSamplesPerBlock, numChannels, precision, alwaysNonRealtime); - } + AlwaysNonRealtime alwaysNonRealtime = AlwaysNonRealtime::no); /** Frees render resources allocated in prepareToPlay(). */ virtual void releaseResources() {} @@ -128,11 +125,7 @@ public: bool processBlock (AudioBuffer& buffer, AudioProcessor::Realtime realtime, - const AudioPlayHead::PositionInfo& positionInfo) noexcept override - { - ignoreUnused (buffer, realtime, positionInfo); - return false; - } + const AudioPlayHead::PositionInfo& positionInfo) noexcept override; using ARARenderer::processBlock; @@ -191,11 +184,7 @@ public: // isNonRealtime of the process context - typically preview is limited to realtime. bool processBlock (AudioBuffer& buffer, AudioProcessor::Realtime isNonRealtime, - const AudioPlayHead::PositionInfo& positionInfo) noexcept override - { - ignoreUnused (buffer, isNonRealtime, positionInfo); - return true; - } + const AudioPlayHead::PositionInfo& positionInfo) noexcept override; using ARARenderer::processBlock; @@ -218,7 +207,7 @@ public: // Shadowing templated getters to default to JUCE versions of the returned classes template - std::vector const& getHiddenRegionSequences() const noexcept + const std::vector& getHiddenRegionSequences() const noexcept { return ARA::PlugIn::EditorView::getHiddenRegionSequences(); } @@ -227,7 +216,7 @@ public: void doNotifySelection (const ARA::PlugIn::ViewSelection* currentSelection) noexcept override; // Base class implementation must be called if overridden - void doNotifyHideRegionSequences (std::vector const& regionSequences) noexcept override; + void doNotifyHideRegionSequences (const std::vector& regionSequences) noexcept override; /** A base class for listeners that want to know about changes to an ARAEditorView object. @@ -239,25 +228,15 @@ public: /** Destructor. */ virtual ~Listener() = default; - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_BEGIN - /** Called when the editor view's selection changes. @param viewSelection The current selection state */ - virtual void onNewSelection (const ARAViewSelection& viewSelection) - { - ignoreUnused (viewSelection); - } + virtual void onNewSelection (const ARAViewSelection& viewSelection); /** Called when region sequences are flagged as hidden in the host UI. @param regionSequences A vector containing all hidden region sequences. */ - virtual void onHideRegionSequences (std::vector const& regionSequences) - { - ignoreUnused (regionSequences); - } - - ARA_DISABLE_UNREFERENCED_PARAMETER_WARNING_END + virtual void onHideRegionSequences (const std::vector& regionSequences); }; /** \copydoc ARAListenableModelClass::addListener */ diff --git a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h index 0b90483f4d..a6e0de3947 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h +++ b/modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.h @@ -135,12 +135,7 @@ public: void add (std::unique_ptr... items) { parameters.reserve (parameters.size() + sizeof... (items)); - - // We can replace this with some nicer code once generic lambdas become available. A - // sequential context like an array initialiser is required to ensure we get the correct - // order from the parameter pack. - int unused[] { (parameters.emplace_back (MakeContents() (std::move (items))), 0)... }; - ignoreUnused (unused); + (parameters.push_back (makeParameterStorage (std::move (items))), ...); } template > @@ -150,7 +145,7 @@ public: std::transform (std::make_move_iterator (begin), std::make_move_iterator (end), std::back_inserter (parameters), - MakeContents()); + [] (auto item) { return makeParameterStorage (std::move (item)); }); } ParameterLayout (const ParameterLayout& other) = delete; @@ -191,14 +186,11 @@ public: std::unique_ptr contents; }; - struct MakeContents final + template + static std::unique_ptr> makeParameterStorage (std::unique_ptr contents) { - template - std::unique_ptr operator() (std::unique_ptr item) const - { - return std::unique_ptr (new ParameterStorage (std::move (item))); - } - }; + return std::make_unique> (std::move (contents)); + } void add() {} diff --git a/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp b/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp index 6651bddf84..eba244c398 100644 --- a/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp +++ b/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp @@ -56,7 +56,7 @@ void PluginHostType::switchToHostApplication() const #endif } -bool PluginHostType::isInAAXAudioSuite (AudioProcessor& processor) +bool PluginHostType::isInAAXAudioSuite ([[maybe_unused]] AudioProcessor& processor) { #if JucePlugin_Build_AAX if (PluginHostType::getPluginLoadedAs() == AudioProcessor::wrapperType_AAX @@ -66,14 +66,11 @@ bool PluginHostType::isInAAXAudioSuite (AudioProcessor& processor) } #endif - ignoreUnused (processor); return false; } -Image PluginHostType::getHostIcon (int size) const +Image PluginHostType::getHostIcon ([[maybe_unused]] int size) const { - ignoreUnused (size); - #if JucePlugin_Enable_IAA && JucePlugin_Build_Standalone && JUCE_IOS && (! JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP) if (isInterAppAudioConnected()) return juce_getIAAHostIcon (size); diff --git a/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp new file mode 100644 index 0000000000..e8b42e9b0a --- /dev/null +++ b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.cpp @@ -0,0 +1,39 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +pointer_sized_int VSTCallbackHandler::handleVstPluginCanDo ([[maybe_unused]] int32 index, + [[maybe_unused]] pointer_sized_int value, + [[maybe_unused]] void* ptr, + [[maybe_unused]] float opt) +{ + return 0; +} + +void VSTCallbackHandler::handleVstHostCallbackAvailable ([[maybe_unused]] std::function&& callback) {} + +} // namespace juce diff --git a/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h index d5a4ea5e05..9fe3a0ad82 100644 --- a/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h +++ b/modules/juce_audio_processors/utilities/juce_VSTCallbackHandler.h @@ -46,11 +46,7 @@ struct VSTCallbackHandler virtual pointer_sized_int handleVstPluginCanDo (int32 index, pointer_sized_int value, void* ptr, - float opt) - { - ignoreUnused (index, value, ptr, opt); - return 0; - } + float opt); /** This is called by the VST plug-in wrapper when it receives unhandled vendor specific calls from the host. @@ -71,10 +67,7 @@ struct VSTCallbackHandler /** This is called once by the VST plug-in wrapper after its constructor. You can use the supplied function to query the VST host. */ - virtual void handleVstHostCallbackAvailable (std::function&& callback) - { - ignoreUnused (callback); - } + virtual void handleVstHostCallbackAvailable (std::function&& callback); }; } // namespace juce diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp index be3ff67d0d..fbd90eac38 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp @@ -478,4 +478,9 @@ void MidiKeyboardComponent::handleNoteOff (MidiKeyboardState*, int /*midiChannel noPendingUpdates.store (false); } +//============================================================================== +bool MidiKeyboardComponent::mouseDownOnKey ([[maybe_unused]] int midiNoteNumber, [[maybe_unused]] const MouseEvent& e) { return true; } +bool MidiKeyboardComponent::mouseDraggedToKey ([[maybe_unused]] int midiNoteNumber, [[maybe_unused]] const MouseEvent& e) { return true; } +void MidiKeyboardComponent::mouseUpOnKey ([[maybe_unused]] int midiNoteNumber, [[maybe_unused]] const MouseEvent& e) {} + } // namespace juce diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h index 70dedb688d..2c9c6ab6c2 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.h @@ -193,7 +193,7 @@ public: @see mouseDraggedToKey */ - virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e) { ignoreUnused (midiNoteNumber, e); return true; } + virtual bool mouseDownOnKey (int midiNoteNumber, const MouseEvent& e); /** Callback when the mouse is dragged from one key onto another. @@ -202,13 +202,13 @@ public: @see mouseDownOnKey */ - virtual bool mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e) { ignoreUnused (midiNoteNumber, e); return true; } + virtual bool mouseDraggedToKey (int midiNoteNumber, const MouseEvent& e); /** Callback when the mouse is released from a key. @see mouseDownOnKey */ - virtual void mouseUpOnKey (int midiNoteNumber, const MouseEvent& e) { ignoreUnused (midiNoteNumber, e); } + virtual void mouseUpOnKey (int midiNoteNumber, const MouseEvent& e); /** Allows text to be drawn on the white notes. diff --git a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm index 381c98fc04..9eb0d6e061 100644 --- a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm +++ b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm @@ -171,8 +171,7 @@ void AudioCDReader::refreshTrackLengths() if (toc.exists()) { XmlDocument doc (toc); - const char* error = CDReaderHelpers::getTrackOffsets (doc, trackStartSamples); - ignoreUnused (error); // could be logged.. + [[maybe_unused]] const char* error = CDReaderHelpers::getTrackOffsets (doc, trackStartSamples); lengthInSamples = trackStartSamples.getLast() - trackStartSamples.getFirst(); } diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index d80046b0c1..316e54526f 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -727,32 +727,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, TargetValueType elementToLookFor) const - { - ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - - const ScopedLockType lock (getLock()); - - for (int s = 0, e = values.size();;) - { - if (s >= e) - return -1; - - if (comparator.compareElements (elementToLookFor, values[s]) == 0) - return s; - - auto halfway = (s + e) / 2; - - if (halfway == s) - return -1; - - if (comparator.compareElements (elementToLookFor, values[halfway]) >= 0) - s = halfway; - else - e = halfway; - } - } + int indexOfSorted (ElementComparator& comparator, TargetValueType elementToLookFor) const; //============================================================================== /** Removes an element from the array. @@ -1106,14 +1081,7 @@ public: @see addSorted, indexOfSorted, sortArray */ template - void sort (ElementComparator& comparator, - bool retainOrderOfEquivalentItems = false) - { - const ScopedLockType lock (getLock()); - ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); - } + void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false); //============================================================================== /** Returns the CriticalSection that locks this array. @@ -1150,4 +1118,43 @@ private: } }; +//============================================================================== +template +template +int Array::indexOfSorted ( + [[maybe_unused]] ElementComparator& comparator, + TargetValueType elementToLookFor) const +{ + const ScopedLockType lock (getLock()); + + for (int s = 0, e = values.size();;) + { + if (s >= e) + return -1; + + if (comparator.compareElements (elementToLookFor, values[s]) == 0) + return s; + + auto halfway = (s + e) / 2; + + if (halfway == s) + return -1; + + if (comparator.compareElements (elementToLookFor, values[halfway]) >= 0) + s = halfway; + else + e = halfway; + } +} + +template +template +void Array::sort ( + [[maybe_unused]] ElementComparator& comparator, + bool retainOrderOfEquivalentItems) +{ + const ScopedLockType lock (getLock()); + sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); +} + } // namespace juce diff --git a/modules/juce_core/containers/juce_ArrayBase.h b/modules/juce_core/containers/juce_ArrayBase.h index af0d1be364..353fcfae50 100644 --- a/modules/juce_core/containers/juce_ArrayBase.h +++ b/modules/juce_core/containers/juce_ArrayBase.h @@ -542,7 +542,7 @@ private: template void addImpl (Elements&&... toAdd) { - ignoreUnused (std::initializer_list { (((void) checkSourceIsNotAMember (toAdd)), 0)... }); + (checkSourceIsNotAMember (toAdd), ...); ensureAllocatedSize (numUsed + (int) sizeof... (toAdd)); addAssumingCapacityIsReady (std::forward (toAdd)...); } @@ -550,7 +550,7 @@ private: template void addAssumingCapacityIsReady (Elements&&... toAdd) { - ignoreUnused (std::initializer_list { ((void) (new (elements + numUsed++) ElementType (std::forward (toAdd))), 0)... }); + (new (elements + numUsed++) ElementType (std::forward (toAdd)), ...); } //============================================================================== diff --git a/modules/juce_core/containers/juce_ElementComparator.h b/modules/juce_core/containers/juce_ElementComparator.h index 5bf7d5e12f..8f7ce2bbec 100644 --- a/modules/juce_core/containers/juce_ElementComparator.h +++ b/modules/juce_core/containers/juce_ElementComparator.h @@ -123,7 +123,7 @@ static void sortArray (ElementComparator& comparator, @param lastElement the index of the last element in the range (this is non-inclusive) */ template -static int findInsertIndexInSortedArray (ElementComparator& comparator, +static int findInsertIndexInSortedArray ([[maybe_unused]] ElementComparator& comparator, ElementType* const array, const ElementType newElement, int firstElement, @@ -131,9 +131,6 @@ static int findInsertIndexInSortedArray (ElementComparator& comparator, { jassert (firstElement <= lastElement); - ignoreUnused (comparator); // if you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - while (firstElement < lastElement) { if (comparator.compareElements (newElement, array [firstElement]) == 0) diff --git a/modules/juce_core/containers/juce_OwnedArray.h b/modules/juce_core/containers/juce_OwnedArray.h index 5bc789eda7..c89b11255a 100644 --- a/modules/juce_core/containers/juce_OwnedArray.h +++ b/modules/juce_core/containers/juce_OwnedArray.h @@ -46,7 +46,6 @@ namespace juce */ template - class OwnedArray { public: @@ -531,17 +530,7 @@ public: @see add, sort, indexOfSorted */ template - int addSorted (ElementComparator& comparator, ObjectClass* newObject) noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - auto index = findInsertIndexInSortedArray (comparator, values.begin(), newObject, 0, values.size()); - insert (index, newObject); - return index; - } + int addSorted (ElementComparator& comparator, ObjectClass* newObject) noexcept; /** Finds the index of an object in the array, assuming that the array is sorted. @@ -556,33 +545,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, const ObjectClass* objectToLookFor) const noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - int s = 0, e = values.size(); - - while (s < e) - { - if (comparator.compareElements (objectToLookFor, values[s]) == 0) - return s; - - auto halfway = (s + e) / 2; - - if (halfway == s) - break; - - if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) - s = halfway; - else - e = halfway; - } - - return -1; - } + int indexOfSorted (ElementComparator& comparator, const ObjectClass* objectToLookFor) const noexcept; //============================================================================== /** Removes an object from the array. @@ -818,18 +781,7 @@ public: @see sortArray, indexOfSorted */ template - void sort (ElementComparator& comparator, - bool retainOrderOfEquivalentItems = false) noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - - if (size() > 1) - sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); - } + void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false) noexcept; //============================================================================== /** Returns the CriticalSection that locks this array. @@ -870,4 +822,57 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OwnedArray) }; +//============================================================================== +template +template +int OwnedArray::addSorted ( + [[maybe_unused]] ElementComparator& comparator, + ObjectClass* newObject) noexcept +{ + const ScopedLockType lock (getLock()); + auto index = findInsertIndexInSortedArray (comparator, values.begin(), newObject, 0, values.size()); + insert (index, newObject); + return index; +} + +template +template +int OwnedArray::indexOfSorted ( + [[maybe_unused]] ElementComparator& comparator, + const ObjectClass* objectToLookFor) const noexcept +{ + const ScopedLockType lock (getLock()); + int s = 0, e = values.size(); + + while (s < e) + { + if (comparator.compareElements (objectToLookFor, values[s]) == 0) + return s; + + auto halfway = (s + e) / 2; + + if (halfway == s) + break; + + if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) + s = halfway; + else + e = halfway; + } + + return -1; +} + +template +template +void OwnedArray::sort ( + [[maybe_unused]] ElementComparator& comparator, + bool retainOrderOfEquivalentItems) noexcept +{ + const ScopedLockType lock (getLock()); + + if (size() > 1) + sortArray (comparator, values.begin(), 0, size() - 1, retainOrderOfEquivalentItems); +} + } // namespace juce diff --git a/modules/juce_core/containers/juce_ReferenceCountedArray.h b/modules/juce_core/containers/juce_ReferenceCountedArray.h index c281a1c4c1..fe7dbdf55a 100644 --- a/modules/juce_core/containers/juce_ReferenceCountedArray.h +++ b/modules/juce_core/containers/juce_ReferenceCountedArray.h @@ -563,31 +563,7 @@ public: @see addSorted, sort */ template - int indexOfSorted (ElementComparator& comparator, - const ObjectClass* objectToLookFor) const noexcept - { - ignoreUnused (comparator); - const ScopedLockType lock (getLock()); - int s = 0, e = values.size(); - - while (s < e) - { - if (comparator.compareElements (objectToLookFor, values[s]) == 0) - return s; - - auto halfway = (s + e) / 2; - - if (halfway == s) - break; - - if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) - s = halfway; - else - e = halfway; - } - - return -1; - } + int indexOfSorted (ElementComparator& comparator, const ObjectClass* objectToLookFor) const noexcept; //============================================================================== /** Removes an object from the array. @@ -828,16 +804,7 @@ public: @see sortArray */ template - void sort (ElementComparator& comparator, - bool retainOrderOfEquivalentItems = false) noexcept - { - // If you pass in an object with a static compareElements() method, this - // avoids getting warning messages about the parameter being unused - ignoreUnused (comparator); - - const ScopedLockType lock (getLock()); - sortArray (comparator, values.begin(), 0, values.size() - 1, retainOrderOfEquivalentItems); - } + void sort (ElementComparator& comparator, bool retainOrderOfEquivalentItems = false) noexcept; //============================================================================== /** Reduces the amount of storage being used by the array. @@ -904,4 +871,43 @@ private: } }; +//============================================================================== +template +template +int ReferenceCountedArray::indexOfSorted ( + [[maybe_unused]] ElementComparator& comparator, + const ObjectClass* objectToLookFor) const noexcept +{ + const ScopedLockType lock (getLock()); + int s = 0, e = values.size(); + + while (s < e) + { + if (comparator.compareElements (objectToLookFor, values[s]) == 0) + return s; + + auto halfway = (s + e) / 2; + + if (halfway == s) + break; + + if (comparator.compareElements (objectToLookFor, values[halfway]) >= 0) + s = halfway; + else + e = halfway; + } + + return -1; +} + +template +template +void ReferenceCountedArray::sort ( + [[maybe_unused]] ElementComparator& comparator, + bool retainOrderOfEquivalentItems) noexcept +{ + const ScopedLockType lock (getLock()); + sortArray (comparator, values.begin(), 0, values.size() - 1, retainOrderOfEquivalentItems); +} + } // namespace juce diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index 20561f3959..d19f14b868 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -953,7 +953,7 @@ File File::createTempFile (StringRef fileNameEnding) } bool File::createSymbolicLink (const File& linkFileToCreate, - const String& nativePathOfTarget, + [[maybe_unused]] const String& nativePathOfTarget, bool overwriteExisting) { if (linkFileToCreate.exists()) @@ -986,7 +986,6 @@ bool File::createSymbolicLink (const File& linkFileToCreate, nativePathOfTarget.toWideCharPointer(), targetFile.isDirectory() ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0) != FALSE; #else - ignoreUnused (nativePathOfTarget); jassertfalse; // symbolic links not supported on this platform! return false; #endif diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 3ad6c7754a..855dffec7c 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -1539,9 +1539,9 @@ struct JavascriptEngine::RootObject : public DynamicObject setMethod ("clone", cloneFn); } - static Identifier getClassName() { static const Identifier i ("Object"); return i; } - static var dump (Args a) { DBG (JSON::toString (a.thisObject)); ignoreUnused (a); return var::undefined(); } - static var cloneFn (Args a) { return a.thisObject.clone(); } + static Identifier getClassName() { static const Identifier i ("Object"); return i; } + static var dump ([[maybe_unused]] Args a) { DBG (JSON::toString (a.thisObject)); return var::undefined(); } + static var cloneFn (Args a) { return a.thisObject.clone(); } }; //============================================================================== diff --git a/modules/juce_core/maths/juce_Expression.cpp b/modules/juce_core/maths/juce_Expression.cpp index f4dd5e45cf..49542942d7 100644 --- a/modules/juce_core/maths/juce_Expression.cpp +++ b/modules/juce_core/maths/juce_Expression.cpp @@ -424,9 +424,8 @@ struct Expression::Helpers String getName() const { return "-"; } TermPtr negated() { return input; } - TermPtr createTermToEvaluateInput (const Scope& scope, const Term* t, double overallTarget, Term* topLevelTerm) const + TermPtr createTermToEvaluateInput (const Scope& scope, [[maybe_unused]] const Term* t, double overallTarget, Term* topLevelTerm) const { - ignoreUnused (t); jassert (t == input); const Term* const dest = findDestinationFor (topLevelTerm, this); diff --git a/modules/juce_core/memory/juce_ContainerDeletePolicy.h b/modules/juce_core/memory/juce_ContainerDeletePolicy.h index 1e3fcd2e90..2eddc07d68 100644 --- a/modules/juce_core/memory/juce_ContainerDeletePolicy.h +++ b/modules/juce_core/memory/juce_ContainerDeletePolicy.h @@ -49,7 +49,7 @@ struct ContainerDeletePolicy // implementation of all methods trying to use the OwnedArray (e.g. the destructor // of the class owning it) into cpp files where they can see to the definition // of ObjectType. This should fix the error. - ignoreUnused (sizeof (ObjectType)); + [[maybe_unused]] constexpr auto size = sizeof (ObjectType); delete object; } diff --git a/modules/juce_core/native/juce_android_AndroidDocument.cpp b/modules/juce_core/native/juce_android_AndroidDocument.cpp index e3dba249e4..d86eb2f0b9 100644 --- a/modules/juce_core/native/juce_android_AndroidDocument.cpp +++ b/modules/juce_core/native/juce_android_AndroidDocument.cpp @@ -101,8 +101,7 @@ struct AndroidDocumentDetail auto* env = getEnv(); LocalRef array { env->NewObjectArray (sizeof... (args), JavaString, nullptr) }; - int unused[] { (env->SetObjectArrayElement (array.get(), Ix, args.get()), 0)... }; - ignoreUnused (unused); + (env->SetObjectArrayElement (array.get(), Ix, args.get()), ...); return array; } @@ -745,21 +744,17 @@ struct AndroidDocument::Utils }; //============================================================================== -void AndroidDocumentPermission::takePersistentReadWriteAccess (const URL& url) +void AndroidDocumentPermission::takePersistentReadWriteAccess ([[maybe_unused]] const URL& url) { #if JUCE_ANDROID AndroidDocumentDetail::setPermissions (url, ContentResolver19.takePersistableUriPermission); - #else - ignoreUnused (url); #endif } -void AndroidDocumentPermission::releasePersistentReadWriteAccess (const URL& url) +void AndroidDocumentPermission::releasePersistentReadWriteAccess ([[maybe_unused]] const URL& url) { #if JUCE_ANDROID AndroidDocumentDetail::setPermissions (url, ContentResolver19.releasePersistableUriPermission); - #else - ignoreUnused (url); #endif } @@ -817,7 +812,7 @@ AndroidDocument AndroidDocument::fromFile (const File& filePath) : nullptr }; } -AndroidDocument AndroidDocument::fromDocument (const URL& documentUrl) +AndroidDocument AndroidDocument::fromDocument ([[maybe_unused]] const URL& documentUrl) { #if JUCE_ANDROID if (getAndroidSDKVersion() < 19) @@ -839,12 +834,11 @@ AndroidDocument AndroidDocument::fromDocument (const URL& documentUrl) return AndroidDocument { Utils::createPimplForSdk (javaUri) }; #else - ignoreUnused (documentUrl); return AndroidDocument{}; #endif } -AndroidDocument AndroidDocument::fromTree (const URL& treeUrl) +AndroidDocument AndroidDocument::fromTree ([[maybe_unused]] const URL& treeUrl) { #if JUCE_ANDROID if (getAndroidSDKVersion() < 21) @@ -874,7 +868,6 @@ AndroidDocument AndroidDocument::fromTree (const URL& treeUrl) return AndroidDocument { Utils::createPimplForSdk (documentUri) }; #else - ignoreUnused (treeUrl); return AndroidDocument{}; #endif } diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index dcee53f11a..ffd68758ae 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -397,7 +397,7 @@ bool DirectoryIterator::NativeIterator::next (String& filenameFound, //============================================================================== -bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& parameters) +bool JUCE_CALLTYPE Process::openDocument (const String& fileName, [[maybe_unused]] const String& parameters) { JUCE_AUTORELEASEPOOL { @@ -406,8 +406,6 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& : [NSURL URLWithString: fileNameAsNS]; #if JUCE_IOS - ignoreUnused (parameters); - if (@available (iOS 10.0, *)) { [[UIApplication sharedApplication] openURL: filenameAsURL diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index 51939b4848..56110874d2 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -58,14 +58,12 @@ void MACAddress::findAllAddresses (Array& result) } //============================================================================== -bool JUCE_CALLTYPE Process::openEmailWithAttachments (const String& targetEmailAddress, - const String& emailSubject, - const String& bodyText, - const StringArray& filesToAttach) +bool JUCE_CALLTYPE Process::openEmailWithAttachments ([[maybe_unused]] const String& targetEmailAddress, + [[maybe_unused]] const String& emailSubject, + [[maybe_unused]] const String& bodyText, + [[maybe_unused]] const StringArray& filesToAttach) { #if JUCE_IOS - ignoreUnused (targetEmailAddress, emailSubject, bodyText, filesToAttach); - //xxx probably need to use MFMailComposeViewController jassertfalse; return false; @@ -282,9 +280,9 @@ public: return newRequest; } - void didFailWithError (NSError* error) + void didFailWithError ([[maybe_unused]] NSError* error) { - DBG (nsStringToJuce ([error description])); ignoreUnused (error); + DBG (nsStringToJuce ([error description])); nsUrlErrorCode = [error code]; hasFailed = true; initialised = true; @@ -951,10 +949,8 @@ public: connection.reset(); } - bool connect (WebInputStream::Listener* webInputListener, int numRetries = 0) + bool connect (WebInputStream::Listener* webInputListener, [[maybe_unused]] int numRetries = 0) { - ignoreUnused (numRetries); - { const ScopedLock lock (createConnectionLock); diff --git a/modules/juce_core/native/juce_mac_ObjCHelpers.h b/modules/juce_core/native/juce_mac_ObjCHelpers.h index ac67c4d75a..be62813a8b 100644 --- a/modules/juce_core/native/juce_mac_ObjCHelpers.h +++ b/modules/juce_core/native/juce_mac_ObjCHelpers.h @@ -391,8 +391,8 @@ struct ObjCClass template void addIvar (const char* name) { - BOOL b = class_addIvar (cls, name, sizeof (Type), (uint8_t) rint (log2 (sizeof (Type))), @encode (Type)); - jassert (b); ignoreUnused (b); + [[maybe_unused]] BOOL b = class_addIvar (cls, name, sizeof (Type), (uint8_t) rint (log2 (sizeof (Type))), @encode (Type)); + jassert (b); } template @@ -408,8 +408,8 @@ struct ObjCClass void addProtocol (Protocol* protocol) { - BOOL b = class_addProtocol (cls, protocol); - jassert (b); ignoreUnused (b); + [[maybe_unused]] BOOL b = class_addProtocol (cls, protocol); + jassert (b); } template diff --git a/modules/juce_core/native/juce_posix_NamedPipe.cpp b/modules/juce_core/native/juce_posix_NamedPipe.cpp index dde81fab3a..7d0e1ba59f 100644 --- a/modules/juce_core/native/juce_posix_NamedPipe.cpp +++ b/modules/juce_core/native/juce_posix_NamedPipe.cpp @@ -254,8 +254,7 @@ void NamedPipe::close() pimpl->stopReadOperation = true; const char buffer[] { 0 }; - const auto done = ::write (pimpl->pipeIn.get(), buffer, numElementsInArray (buffer)); - ignoreUnused (done); + [[maybe_unused]] const auto done = ::write (pimpl->pipeIn.get(), buffer, numElementsInArray (buffer)); } } diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index dee843cb57..a2649055ac 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -140,10 +140,9 @@ bool File::setAsCurrentWorkingDirectory() const //============================================================================== // The unix siginterrupt function is deprecated - this does the same job. -int juce_siginterrupt (int sig, int flag) +int juce_siginterrupt ([[maybe_unused]] int sig, [[maybe_unused]] int flag) { #if JUCE_WASM - ignoreUnused (sig, flag); return 0; #else #if JUCE_ANDROID @@ -693,8 +692,7 @@ int File::getVolumeSerialNumber() const void juce_runSystemCommand (const String&); void juce_runSystemCommand (const String& command) { - int result = system (command.toUTF8()); - ignoreUnused (result); + [[maybe_unused]] int result = system (command.toUTF8()); } String juce_getOutputFromCommand (const String&); @@ -1015,7 +1013,7 @@ void JUCE_CALLTYPE Thread::yield() #define SUPPORT_AFFINITIES 1 #endif -void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (uint32 affinityMask) +void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask ([[maybe_unused]] uint32 affinityMask) { #if SUPPORT_AFFINITIES cpu_set_t affinity; @@ -1042,7 +1040,6 @@ void JUCE_CALLTYPE Thread::setCurrentThreadAffinityMask (uint32 affinityMask) // affinities aren't supported because either the appropriate header files weren't found, // or the SUPPORT_AFFINITIES macro was turned off jassertfalse; - ignoreUnused (affinityMask); #endif } diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index 7d93f26afb..6bc65bf228 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -960,7 +960,7 @@ bool File::createShortcut (const String& description, const File& linkFileToCrea ComSmartPtr shellLink; ComSmartPtr persistFile; - ignoreUnused (CoInitialize (nullptr)); + [[maybe_unused]] const auto result = CoInitialize (nullptr); return SUCCEEDED (shellLink.CoCreateInstance (CLSID_ShellLink)) && SUCCEEDED (shellLink->SetPath (getFullPathName().toWideCharPointer())) diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 64b03b627e..63163d148b 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -457,8 +457,7 @@ public: #endif #if JUCE_WIN32_TIMER_PERIOD > 0 - auto res = timeBeginPeriod (JUCE_WIN32_TIMER_PERIOD); - ignoreUnused (res); + [[maybe_unused]] auto res = timeBeginPeriod (JUCE_WIN32_TIMER_PERIOD); jassert (res == TIMERR_NOERROR); #endif diff --git a/modules/juce_core/native/juce_win32_Threads.cpp b/modules/juce_core/native/juce_win32_Threads.cpp index 478978cbd3..590a9976bf 100644 --- a/modules/juce_core/native/juce_win32_Threads.cpp +++ b/modules/juce_core/native/juce_win32_Threads.cpp @@ -134,7 +134,7 @@ void Thread::killThread() } } -void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) +void JUCE_CALLTYPE Thread::setCurrentThreadName ([[maybe_unused]] const String& name) { #if JUCE_DEBUG && JUCE_MSVC struct @@ -159,8 +159,6 @@ void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) { OutputDebugStringA ("** Warning - Encountered noncontinuable exception **\n"); } - #else - ignoreUnused (name); #endif } diff --git a/modules/juce_core/network/juce_Socket.cpp b/modules/juce_core/network/juce_Socket.cpp index 0823d429e4..c020720b2a 100644 --- a/modules/juce_core/network/juce_Socket.cpp +++ b/modules/juce_core/network/juce_Socket.cpp @@ -91,15 +91,16 @@ namespace SocketHelpers : setOption (handle, IPPROTO_TCP, TCP_NODELAY, (int) 1)); } - static void closeSocket (std::atomic& handle, CriticalSection& readLock, - bool isListener, int portNumber, std::atomic& connected) noexcept + static void closeSocket (std::atomic& handle, + [[maybe_unused]] CriticalSection& readLock, + [[maybe_unused]] bool isListener, + [[maybe_unused]] int portNumber, + std::atomic& connected) noexcept { const auto h = (SocketHandle) handle.load(); handle = -1; #if JUCE_WINDOWS - ignoreUnused (portNumber, isListener, readLock); - if (h != invalidSocket || connected) closesocket (h); @@ -771,11 +772,9 @@ bool DatagramSocket::setMulticastLoopbackEnabled (bool enable) return SocketHelpers::setOption ((SocketHandle) handle.load(), IPPROTO_IP, IP_MULTICAST_LOOP, enable); } -bool DatagramSocket::setEnablePortReuse (bool enabled) +bool DatagramSocket::setEnablePortReuse ([[maybe_unused]] bool enabled) { - #if JUCE_ANDROID - ignoreUnused (enabled); - #else + #if ! JUCE_ANDROID if (handle >= 0) return SocketHelpers::setOption ((SocketHandle) handle.load(), #if JUCE_WINDOWS || JUCE_LINUX || JUCE_BSD diff --git a/modules/juce_core/network/juce_URL.cpp b/modules/juce_core/network/juce_URL.cpp index f213307746..dd10be083e 100644 --- a/modules/juce_core/network/juce_URL.cpp +++ b/modules/juce_core/network/juce_URL.cpp @@ -630,8 +630,7 @@ public: } else { - auto desc = [error localizedDescription]; - ignoreUnused (desc); + [[maybe_unused]] auto desc = [error localizedDescription]; jassertfalse; } } @@ -664,8 +663,7 @@ private: return urlToUse.getLocalFile(); } - auto desc = [error localizedDescription]; - ignoreUnused (desc); + [[maybe_unused]] auto desc = [error localizedDescription]; jassertfalse; } diff --git a/modules/juce_core/network/juce_WebInputStream.cpp b/modules/juce_core/network/juce_WebInputStream.cpp index daffbc4428..1183c1bc72 100644 --- a/modules/juce_core/network/juce_WebInputStream.cpp +++ b/modules/juce_core/network/juce_WebInputStream.cpp @@ -96,4 +96,11 @@ void WebInputStream::createHeadersAndPostData (const URL& aURL, aURL.createHeadersAndPostData (headers, data, addParametersToBody); } +bool WebInputStream::Listener::postDataSendProgress ([[maybe_unused]] WebInputStream& request, + [[maybe_unused]] int bytesSent, + [[maybe_unused]] int totalBytes) +{ + return true; +} + } // namespace juce diff --git a/modules/juce_core/network/juce_WebInputStream.h b/modules/juce_core/network/juce_WebInputStream.h index 883012129d..308adfe4e7 100644 --- a/modules/juce_core/network/juce_WebInputStream.h +++ b/modules/juce_core/network/juce_WebInputStream.h @@ -107,11 +107,7 @@ class JUCE_API WebInputStream : public InputStream @returns true to continue or false to cancel the upload */ - virtual bool postDataSendProgress (WebInputStream& request, int bytesSent, int totalBytes) - { - ignoreUnused (request, bytesSent, totalBytes); - return true; - } + virtual bool postDataSendProgress (WebInputStream& request, int bytesSent, int totalBytes); }; /** Wait until the first byte is ready for reading. diff --git a/modules/juce_core/system/juce_StandardHeader.h b/modules/juce_core/system/juce_StandardHeader.h index 8b466006df..93d1a7e6f2 100644 --- a/modules/juce_core/system/juce_StandardHeader.h +++ b/modules/juce_core/system/juce_StandardHeader.h @@ -43,8 +43,7 @@ #if ! DOXYGEN #define JUCE_VERSION_ID \ - volatile auto juceVersionId = "juce_version_" JUCE_STRINGIFY(JUCE_MAJOR_VERSION) "_" JUCE_STRINGIFY(JUCE_MINOR_VERSION) "_" JUCE_STRINGIFY(JUCE_BUILDNUMBER); \ - ignoreUnused (juceVersionId); + [[maybe_unused]] volatile auto juceVersionId = "juce_version_" JUCE_STRINGIFY(JUCE_MAJOR_VERSION) "_" JUCE_STRINGIFY(JUCE_MINOR_VERSION) "_" JUCE_STRINGIFY(JUCE_BUILDNUMBER); #endif //============================================================================== diff --git a/modules/juce_cryptography/encryption/juce_BlowFish.cpp b/modules/juce_cryptography/encryption/juce_BlowFish.cpp index 150890e4e1..a47e459854 100644 --- a/modules/juce_cryptography/encryption/juce_BlowFish.cpp +++ b/modules/juce_cryptography/encryption/juce_BlowFish.cpp @@ -280,9 +280,8 @@ void BlowFish::encrypt (MemoryBlock& data) const auto size = data.getSize(); data.setSize (size + (8u - (size % 8u))); - auto success = encrypt (data.getData(), size, data.getSize()); + [[maybe_unused]] auto success = encrypt (data.getData(), size, data.getSize()); - ignoreUnused (success); jassert (success >= 0); } diff --git a/modules/juce_data_structures/juce_data_structures.cpp b/modules/juce_data_structures/juce_data_structures.cpp index 4b482629c7..90d0d3d11a 100644 --- a/modules/juce_data_structures/juce_data_structures.cpp +++ b/modules/juce_data_structures/juce_data_structures.cpp @@ -39,6 +39,7 @@ #include "values/juce_ValueTreeSynchroniser.cpp" #include "values/juce_CachedValue.cpp" #include "undomanager/juce_UndoManager.cpp" +#include "undomanager/juce_UndoableAction.cpp" #include "app_properties/juce_ApplicationProperties.cpp" #include "app_properties/juce_PropertiesFile.cpp" diff --git a/modules/juce_data_structures/undomanager/juce_UndoableAction.cpp b/modules/juce_data_structures/undomanager/juce_UndoableAction.cpp new file mode 100644 index 0000000000..f9396269a9 --- /dev/null +++ b/modules/juce_data_structures/undomanager/juce_UndoableAction.cpp @@ -0,0 +1,31 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +UndoableAction* UndoableAction::createCoalescedAction ([[maybe_unused]] UndoableAction* nextAction) { return nullptr; } + +} // namespace juce diff --git a/modules/juce_data_structures/undomanager/juce_UndoableAction.h b/modules/juce_data_structures/undomanager/juce_UndoableAction.h index 51e495ab0e..df868b062e 100644 --- a/modules/juce_data_structures/undomanager/juce_UndoableAction.h +++ b/modules/juce_data_structures/undomanager/juce_UndoableAction.h @@ -94,7 +94,7 @@ public: If it's not possible to merge the two actions, the method should return a nullptr. */ - virtual UndoableAction* createCoalescedAction (UndoableAction* nextAction) { ignoreUnused (nextAction); return nullptr; } + virtual UndoableAction* createCoalescedAction (UndoableAction* nextAction); }; } // namespace juce diff --git a/modules/juce_dsp/containers/juce_FixedSizeFunction.h b/modules/juce_dsp/containers/juce_FixedSizeFunction.h index 234c4aa971..1051e85362 100644 --- a/modules/juce_dsp/containers/juce_FixedSizeFunction.h +++ b/modules/juce_dsp/containers/juce_FixedSizeFunction.h @@ -70,10 +70,9 @@ namespace detail template void clear (void* s) { - auto& fn = *reinterpret_cast (s); - fn.~Fn(); // I know this looks insane, for some reason MSVC 14 sometimes thinks fn is unreferenced - ignoreUnused (fn); + [[maybe_unused]] auto& fn = *reinterpret_cast (s); + fn.~Fn(); } template diff --git a/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp b/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp index 6c4aa84a05..e81221913a 100644 --- a/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp +++ b/modules/juce_dsp/containers/juce_FixedSizeFunction_test.cpp @@ -334,8 +334,8 @@ public: bool smallCalled = false; bool largeCalled = false; - SmallFn small = [&smallCalled, a = std::array{}] { smallCalled = true; juce::ignoreUnused (a); }; - LargeFn large = [&largeCalled, a = std::array{}] { largeCalled = true; juce::ignoreUnused (a); }; + SmallFn small = [&smallCalled, a = std::array{}] { smallCalled = true; ignoreUnused (a); }; + LargeFn large = [&largeCalled, a = std::array{}] { largeCalled = true; ignoreUnused (a); }; large = std::move (small); diff --git a/modules/juce_dsp/juce_dsp.h b/modules/juce_dsp/juce_dsp.h index f4d2591b3f..aef9dc2f9a 100644 --- a/modules/juce_dsp/juce_dsp.h +++ b/modules/juce_dsp/juce_dsp.h @@ -208,10 +208,10 @@ namespace juce inline void snapToZero (long double& x) noexcept { JUCE_SNAP_TO_ZERO (x); } #endif #else - inline void snapToZero (float& x) noexcept { ignoreUnused (x); } + inline void snapToZero ([[maybe_unused]] float& x) noexcept {} #ifndef DOXYGEN - inline void snapToZero (double& x) noexcept { ignoreUnused (x); } - inline void snapToZero (long double& x) noexcept { ignoreUnused (x); } + inline void snapToZero ([[maybe_unused]] double& x) noexcept {} + inline void snapToZero ([[maybe_unused]] long double& x) noexcept {} #endif #endif } diff --git a/modules/juce_events/native/juce_linux_Messaging.cpp b/modules/juce_events/native/juce_linux_Messaging.cpp index dcf5833466..69fa23943f 100644 --- a/modules/juce_events/native/juce_linux_Messaging.cpp +++ b/modules/juce_events/native/juce_linux_Messaging.cpp @@ -68,8 +68,7 @@ public: ScopedUnlock ul (lock); unsigned char x = 0xff; - auto numBytes = write (getWriteHandle(), &x, 1); - ignoreUnused (numBytes); + [[maybe_unused]] auto numBytes = write (getWriteHandle(), &x, 1); } } @@ -97,8 +96,7 @@ private: ScopedUnlock ul (lock); unsigned char x; - auto numBytes = read (fd, &x, 1); - ignoreUnused (numBytes); + [[maybe_unused]] auto numBytes = read (fd, &x, 1); } return queue.removeAndReturn (0); diff --git a/modules/juce_events/native/juce_win32_Messaging.cpp b/modules/juce_events/native/juce_win32_Messaging.cpp index 3266f7a3eb..0e91c21596 100644 --- a/modules/juce_events/native/juce_win32_Messaging.cpp +++ b/modules/juce_events/native/juce_win32_Messaging.cpp @@ -288,7 +288,7 @@ void MessageManager::broadcastMessage (const String& value) //============================================================================== void MessageManager::doPlatformSpecificInitialisation() { - ignoreUnused (OleInitialize (nullptr)); + [[maybe_unused]] const auto result = OleInitialize (nullptr); InternalMessageQueue::getInstance(); } diff --git a/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp b/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp index b5e3340f9c..d848addf84 100644 --- a/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp +++ b/modules/juce_graphics/native/juce_win32_Direct2DGraphicsContext.cpp @@ -528,8 +528,8 @@ Direct2DLowLevelGraphicsContext::Direct2DLowLevelGraphicsContext (HWND hwnd_) if (pimpl->factories->d2dFactory != nullptr) { - auto hr = pimpl->factories->d2dFactory->CreateHwndRenderTarget ({}, { hwnd, size }, pimpl->renderingTarget.resetAndGetPointerAddress()); - jassert (SUCCEEDED (hr)); ignoreUnused (hr); + [[maybe_unused]] auto hr = pimpl->factories->d2dFactory->CreateHwndRenderTarget ({}, { hwnd, size }, pimpl->renderingTarget.resetAndGetPointerAddress()); + jassert (SUCCEEDED (hr)); hr = pimpl->renderingTarget->CreateSolidColorBrush (D2D1::ColorF::ColorF (0.0f, 0.0f, 0.0f, 1.0f), pimpl->colourBrush.resetAndGetPointerAddress()); } } diff --git a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp index b82b4c5351..f565a58321 100644 --- a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp +++ b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp @@ -200,8 +200,7 @@ namespace DirectWriteTypeLayout } ComSmartPtr dwFont; - auto hr = fontCollection.GetFontFromFontFace (glyphRun.fontFace, dwFont.resetAndGetPointerAddress()); - ignoreUnused (hr); + [[maybe_unused]] auto hr = fontCollection.GetFontFromFontFace (glyphRun.fontFace, dwFont.resetAndGetPointerAddress()); jassert (dwFont != nullptr); ComSmartPtr dwFontFamily; @@ -299,8 +298,7 @@ namespace DirectWriteTypeLayout fontIndex = 0; ComSmartPtr fontFamily; - auto hr = fontCollection.GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress()); - ignoreUnused (hr); + [[maybe_unused]] auto hr = fontCollection.GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress()); ComSmartPtr dwFont; uint32 fontFacesCount = 0; @@ -420,8 +418,7 @@ namespace DirectWriteTypeLayout return; UINT32 actualLineCount = 0; - auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount); - ignoreUnused (hr); + [[maybe_unused]] auto hr = dwTextLayout->GetLineMetrics (nullptr, 0, &actualLineCount); layout.ensureStorageAllocated ((int) actualLineCount); @@ -486,7 +483,7 @@ static bool canAllTypefacesAndFontsBeUsedInLayout (const AttributedString& text) #endif -bool TextLayout::createNativeLayout (const AttributedString& text) +bool TextLayout::createNativeLayout ([[maybe_unused]] const AttributedString& text) { #if JUCE_USE_DIRECTWRITE if (! canAllTypefacesAndFontsBeUsedInLayout (text)) @@ -506,8 +503,6 @@ bool TextLayout::createNativeLayout (const AttributedString& text) return true; } - #else - ignoreUnused (text); #endif return false; diff --git a/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp b/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp index da59341e62..5da133517a 100644 --- a/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp +++ b/modules/juce_graphics/native/juce_win32_DirectWriteTypeface.cpp @@ -35,8 +35,7 @@ namespace uint32 index = 0; BOOL exists = false; - auto hr = names->FindLocaleName (L"en-us", &index, &exists); - ignoreUnused (hr); + [[maybe_unused]] auto hr = names->FindLocaleName (L"en-us", &index, &exists); if (! exists) index = 0; @@ -152,8 +151,7 @@ public: jassert (fontCollection != nullptr); uint32 fontIndex = 0; - auto hr = fontCollection->FindFamilyName (font.getTypefaceName().toWideCharPointer(), &fontIndex, &fontFound); - ignoreUnused (hr); + [[maybe_unused]] auto hr = fontCollection->FindFamilyName (font.getTypefaceName().toWideCharPointer(), &fontIndex, &fontFound); if (! fontFound) fontIndex = 0; diff --git a/modules/juce_graphics/native/juce_win32_Fonts.cpp b/modules/juce_graphics/native/juce_win32_Fonts.cpp index b7d4afe248..005061efb4 100644 --- a/modules/juce_graphics/native/juce_win32_Fonts.cpp +++ b/modules/juce_graphics/native/juce_win32_Fonts.cpp @@ -234,8 +234,7 @@ StringArray Font::findAllTypefaceStyles (const String& family) { BOOL fontFound = false; uint32 fontIndex = 0; - auto hr = factories->systemFonts->FindFamilyName (family.toWideCharPointer(), &fontIndex, &fontFound); - ignoreUnused (hr); + [[maybe_unused]] auto hr = factories->systemFonts->FindFamilyName (family.toWideCharPointer(), &fontIndex, &fontFound); if (! fontFound) fontIndex = 0; diff --git a/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp b/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp index 9887b1c363..eb1c7514d2 100644 --- a/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp @@ -150,15 +150,13 @@ JUCE_IMPLEMENT_SINGLETON (ContentSharer) ContentSharer::ContentSharer() {} ContentSharer::~ContentSharer() { clearSingletonInstance(); } -void ContentSharer::shareFiles (const Array& files, +void ContentSharer::shareFiles ([[maybe_unused]] const Array& files, std::function callbackToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); pimpl->shareFiles (files); #else - ignoreUnused (files); - // Content sharing is not available on this platform! jassertfalse; @@ -188,15 +186,13 @@ void ContentSharer::startNewShare (std::function cal } #endif -void ContentSharer::shareText (const String& text, +void ContentSharer::shareText ([[maybe_unused]] const String& text, std::function callbackToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); pimpl->shareText (text); #else - ignoreUnused (text); - // Content sharing is not available on this platform! jassertfalse; @@ -205,16 +201,14 @@ void ContentSharer::shareText (const String& text, #endif } -void ContentSharer::shareImages (const Array& images, +void ContentSharer::shareImages ([[maybe_unused]] const Array& images, std::function callbackToUse, - ImageFileFormat* imageFileFormatToUse) + [[maybe_unused]] ImageFileFormat* imageFileFormatToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); prepareImagesThread.reset (new PrepareImagesThread (*this, images, imageFileFormatToUse)); #else - ignoreUnused (images, imageFileFormatToUse); - // Content sharing is not available on this platform! jassertfalse; @@ -238,15 +232,13 @@ void ContentSharer::filesToSharePrepared() } #endif -void ContentSharer::shareData (const MemoryBlock& mb, +void ContentSharer::shareData ([[maybe_unused]] const MemoryBlock& mb, std::function callbackToUse) { #if JUCE_CONTENT_SHARING startNewShare (callbackToUse); prepareDataThread.reset (new PrepareDataThread (*this, mb)); #else - ignoreUnused (mb); - if (callbackToUse) callbackToUse (false, "Content sharing not available on this platform!"); #endif diff --git a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp index 15593e6c71..13e4f9d764 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp @@ -440,7 +440,7 @@ void FileBrowserComponent::fileDoubleClicked (const File& f) void FileBrowserComponent::browserRootChanged (const File&) {} -bool FileBrowserComponent::keyPressed (const KeyPress& key) +bool FileBrowserComponent::keyPressed ([[maybe_unused]] const KeyPress& key) { #if JUCE_LINUX || JUCE_BSD || JUCE_WINDOWS if (key.getModifiers().isCommandDown() @@ -452,7 +452,6 @@ bool FileBrowserComponent::keyPressed (const KeyPress& key) } #endif - ignoreUnused (key); return false; } diff --git a/modules/juce_gui_basics/layout/juce_SidePanel.cpp b/modules/juce_gui_basics/layout/juce_SidePanel.cpp index 758b5d96ae..01ec91d515 100644 --- a/modules/juce_gui_basics/layout/juce_SidePanel.cpp +++ b/modules/juce_gui_basics/layout/juce_SidePanel.cpp @@ -242,10 +242,8 @@ void SidePanel::lookAndFeelChanged() titleLabel.setJustificationType (lf.getSidePanelTitleJustification (*this)); } -void SidePanel::componentMovedOrResized (Component& component, bool wasMoved, bool wasResized) +void SidePanel::componentMovedOrResized (Component& component, [[maybe_unused]] bool wasMoved, bool wasResized) { - ignoreUnused (wasMoved); - if (wasResized && (&component == parent)) setBounds (calculateBoundsInParent (component)); } diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp index 0ec5d7d253..3c6a6e66fd 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp @@ -464,10 +464,9 @@ void LookAndFeel_V3::drawLinearSliderBackground (Graphics& g, int x, int y, int g.strokePath (indent, PathStrokeType (0.5f)); } -void LookAndFeel_V3::drawPopupMenuBackground (Graphics& g, int width, int height) +void LookAndFeel_V3::drawPopupMenuBackground (Graphics& g, [[maybe_unused]] int width, [[maybe_unused]] int height) { g.fillAll (findColour (PopupMenu::backgroundColourId)); - ignoreUnused (width, height); #if ! JUCE_MAC g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f)); diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp index bd87b26a96..d400073ad6 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp @@ -353,12 +353,10 @@ void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button, void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component, float x, float y, float w, float h, const bool ticked, - const bool isEnabled, - const bool shouldDrawButtonAsHighlighted, - const bool shouldDrawButtonAsDown) + [[maybe_unused]] const bool isEnabled, + [[maybe_unused]] const bool shouldDrawButtonAsHighlighted, + [[maybe_unused]] const bool shouldDrawButtonAsDown) { - ignoreUnused (isEnabled, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown); - Rectangle tickBounds (x, y, w, h); g.setColour (component.findColour (ToggleButton::tickDisabledColourId)); @@ -619,10 +617,8 @@ int LookAndFeel_V4::getDefaultScrollbarWidth() } void LookAndFeel_V4::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height, - bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) + bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, [[maybe_unused]] bool isMouseDown) { - ignoreUnused (isMouseDown); - Rectangle thumbBounds; if (isScrollbarVertical) @@ -1253,10 +1249,8 @@ void LookAndFeel_V4::drawPropertyComponentBackground (Graphics& g, int width, in g.fillRect (0, 0, width, height - 1); } -void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, int width, int height, PropertyComponent& component) +void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, [[maybe_unused]] int width, int height, PropertyComponent& component) { - ignoreUnused (width); - auto indent = getPropertyComponentIndent (component); g.setColour (component.findColour (PropertyComponent::labelTextColourId) diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index ef413750da..e2a43d64e5 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -2098,7 +2098,7 @@ struct PopupMenuCompletionCallback : public ModalComponentManager::Callback int PopupMenu::showWithOptionalCallback (const Options& options, ModalComponentManager::Callback* userCallback, - bool canBeModal) + [[maybe_unused]] bool canBeModal) { std::unique_ptr userCallbackDeleter (userCallback); std::unique_ptr callback (new PopupMenuCompletionCallback()); @@ -2120,7 +2120,6 @@ int PopupMenu::showWithOptionalCallback (const Options& options, if (userCallback == nullptr && canBeModal) return window->runModalLoop(); #else - ignoreUnused (canBeModal); jassert (! (userCallback == nullptr && canBeModal)); #endif } diff --git a/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp b/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp index c36306d2fe..9b60308b4e 100644 --- a/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp +++ b/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp @@ -62,10 +62,8 @@ static Rectangle getLogoArea (Rectangle parentRect) } //============================================================================== -JUCESplashScreen::JUCESplashScreen (Component& parent) +JUCESplashScreen::JUCESplashScreen ([[maybe_unused]] Component& parent) { - ignoreUnused (parent); - #if JUCE_DISPLAY_SPLASH_SCREEN if (splashDisplayTime == 0 || Time::getMillisecondCounter() < splashDisplayTime + (uint32) millisecondsToDisplaySplash) diff --git a/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp index ba3f337698..fd447ba705 100644 --- a/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp @@ -184,10 +184,8 @@ public: env->CallVoidMethod (fileObserver, JuceContentProviderFileObserver.startWatching); } - void onFileEvent (int event, const LocalRef& path) + void onFileEvent (int event, [[maybe_unused]] const LocalRef& path) { - ignoreUnused (path); - if (event == open) { ++numOpenedHandles; @@ -513,10 +511,8 @@ public: //============================================================================== jobject openFile (const LocalRef& contentProvider, - const LocalRef& uri, const LocalRef& mode) + const LocalRef& uri, [[maybe_unused]] const LocalRef& mode) { - ignoreUnused (mode); - WeakReference weakRef (this); if (weakRef == nullptr) diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index e3ade3c666..ab149c140e 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -1799,10 +1799,8 @@ bool Desktop::isScreenSaverEnabled() } //============================================================================== -void Desktop::setKioskComponent (Component* kioskComp, bool enableOrDisable, bool allowMenusAndBars) +void Desktop::setKioskComponent (Component* kioskComp, bool enableOrDisable, [[maybe_unused]] bool allowMenusAndBars) { - ignoreUnused (allowMenusAndBars); - if (AndroidComponentPeer* peer = dynamic_cast (kioskComp->getPeer())) peer->setFullScreen (enableOrDisable); else diff --git a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp index 8aea944804..04203b55b8 100644 --- a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp @@ -104,12 +104,9 @@ private: controller.get().excludedActivityTypes = nil; - controller.get().completionWithItemsHandler = ^ (UIActivityType type, BOOL completed, - NSArray* returnedItems, NSError* error) + controller.get().completionWithItemsHandler = ^([[maybe_unused]] UIActivityType type, BOOL completed, + [[maybe_unused]] NSArray* returnedItems, NSError* error) { - ignoreUnused (type); - ignoreUnused (returnedItems); - succeeded = completed; if (error != nil) diff --git a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm index 3f33a8b71b..47b5690edd 100644 --- a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm @@ -137,8 +137,7 @@ public: { if (err != nil) { - auto desc = [err localizedDescription]; - ignoreUnused (desc); + [[maybe_unused]] auto desc = [err localizedDescription]; jassertfalse; return; } @@ -168,8 +167,7 @@ public: } else { - auto desc = [error localizedDescription]; - ignoreUnused (desc); + [[maybe_unused]] auto desc = [error localizedDescription]; jassertfalse; } diff --git a/modules/juce_gui_basics/native/juce_mac_FileChooser.mm b/modules/juce_gui_basics/native/juce_mac_FileChooser.mm index 81d8b6d7ed..9f6bc9dcdd 100644 --- a/modules/juce_gui_basics/native/juce_mac_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_mac_FileChooser.mm @@ -279,10 +279,9 @@ private: && ! [[NSWorkspace sharedWorkspace] isFilePackageAtPath: juceStringToNS (f.getFullPathName())]; } - void panelSelectionDidChange (id sender) + void panelSelectionDidChange ([[maybe_unused]] id sender) { jassert (sender == panel); - ignoreUnused (sender); // NB: would need to extend FilePreviewComponent to handle the full list rather than just the first one if (preview != nullptr) diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 269dd29c94..97746ae667 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -641,7 +641,7 @@ public: return usingCoreGraphics ? 1 : 0; } - void setCurrentRenderingEngine (int index) override + void setCurrentRenderingEngine ([[maybe_unused]] int index) override { #if USE_COREGRAPHICS_RENDERING if (usingCoreGraphics != (index > 0)) @@ -649,8 +649,6 @@ public: usingCoreGraphics = index > 0; [view setNeedsDisplay: true]; } - #else - ignoreUnused (index); #endif } @@ -2491,10 +2489,8 @@ struct JuceNSWindowClass : public NSViewComponentPeerWrapper 1) { @@ -3484,7 +3478,7 @@ private: const UINT keyChar = MapVirtualKey ((UINT) key, 2); const UINT scanCode = MapVirtualKey ((UINT) key, 0); BYTE keyState[256]; - ignoreUnused (GetKeyboardState (keyState)); + [[maybe_unused]] const auto state = GetKeyboardState (keyState); WCHAR text[16] = { 0 }; if (ToUnicode ((UINT) key, scanCode, keyState, text, 8, 0) != 1) diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp index ec79806e45..47057aabaf 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp @@ -361,10 +361,8 @@ namespace X11ErrorHandling return 0; } - static int errorHandler (::Display* display, XErrorEvent* event) + static int errorHandler ([[maybe_unused]] ::Display* display, [[maybe_unused]] XErrorEvent* event) { - ignoreUnused (display, event); - #if JUCE_DEBUG_XERRORS char errorStr[64] = { 0 }; char requestStr[64] = { 0 }; diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 082cff6606..43700aa34b 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -1207,9 +1207,8 @@ std::unique_ptr ListBox::createAccessibilityHandler() } //============================================================================== -Component* ListBoxModel::refreshComponentForRow (int, bool, Component* existingComponentToUpdate) +Component* ListBoxModel::refreshComponentForRow (int, bool, [[maybe_unused]] Component* existingComponentToUpdate) { - ignoreUnused (existingComponentToUpdate); jassert (existingComponentToUpdate == nullptr); // indicates a failure in the code that recycles the components return nullptr; } diff --git a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp index b332e5dc06..00cd8c79a7 100644 --- a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp @@ -725,9 +725,8 @@ void TableListBoxModel::listWasScrolled() {} String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return {}; } var TableListBoxModel::getDragSourceDescription (const SparseSet&) { return {}; } -Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) +Component* TableListBoxModel::refreshComponentForCell (int, int, bool, [[maybe_unused]] Component* existingComponentToUpdate) { - ignoreUnused (existingComponentToUpdate); jassert (existingComponentToUpdate == nullptr); // indicates a failure in the code that recycles the components return nullptr; } diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 3ab01734a5..30b0fc55eb 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -587,8 +587,8 @@ void ComponentPeer::setRepresentedFile (const File&) } //============================================================================== -int ComponentPeer::getCurrentRenderingEngine() const { return 0; } -void ComponentPeer::setCurrentRenderingEngine (int index) { jassert (index == 0); ignoreUnused (index); } +int ComponentPeer::getCurrentRenderingEngine() const { return 0; } +void ComponentPeer::setCurrentRenderingEngine ([[maybe_unused]] int index) { jassert (index == 0); } //============================================================================== std::function ComponentPeer::getNativeRealtimeModifiers = nullptr; diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index da5b4a9a3e..6273cbbd3a 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -670,10 +670,9 @@ void CodeEditorComponent::codeDocumentChanged (const int startIndex, const int e updateScrollBars(); } -void CodeEditorComponent::retokenise (int startIndex, int endIndex) +void CodeEditorComponent::retokenise (int startIndex, [[maybe_unused]] int endIndex) { const CodeDocument::Position affectedTextStart (document, startIndex); - juce::ignoreUnused (endIndex); // Leave room for more efficient impl in future. clearCachedIterators (affectedTextStart.getLineNumber()); diff --git a/modules/juce_gui_extra/juce_gui_extra.cpp b/modules/juce_gui_extra/juce_gui_extra.cpp index 173cd09bd1..bcffb999c8 100644 --- a/modules/juce_gui_extra/juce_gui_extra.cpp +++ b/modules/juce_gui_extra/juce_gui_extra.cpp @@ -135,6 +135,7 @@ #include "misc/juce_SystemTrayIconComponent.cpp" #include "misc/juce_LiveConstantEditor.cpp" #include "misc/juce_AnimatedAppComponent.cpp" +#include "misc/juce_WebBrowserComponent.cpp" //============================================================================== #if JUCE_MAC || JUCE_IOS diff --git a/modules/juce_gui_extra/misc/juce_PushNotifications.cpp b/modules/juce_gui_extra/misc/juce_PushNotifications.cpp index 5642deb8aa..ece6c622da 100644 --- a/modules/juce_gui_extra/misc/juce_PushNotifications.cpp +++ b/modules/juce_gui_extra/misc/juce_PushNotifications.cpp @@ -86,12 +86,11 @@ PushNotifications::~PushNotifications() { clearSingletonInstance(); } void PushNotifications::addListener (Listener* l) { listeners.add (l); } void PushNotifications::removeListener (Listener* l) { listeners.remove (l); } -void PushNotifications::requestPermissionsWithSettings (const PushNotifications::Settings& settings) +void PushNotifications::requestPermissionsWithSettings ([[maybe_unused]] const PushNotifications::Settings& settings) { #if JUCE_PUSH_NOTIFICATIONS && (JUCE_IOS || JUCE_MAC) pimpl->requestPermissionsWithSettings (settings); #else - ignoreUnused (settings); listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); }); #endif } @@ -137,12 +136,10 @@ String PushNotifications::getDeviceToken() const #endif } -void PushNotifications::setupChannels (const Array& groups, const Array& channels) +void PushNotifications::setupChannels ([[maybe_unused]] const Array& groups, [[maybe_unused]] const Array& channels) { #if JUCE_PUSH_NOTIFICATIONS pimpl->setupChannels (groups, channels); - #else - ignoreUnused (groups, channels); #endif } @@ -160,58 +157,48 @@ void PushNotifications::removeAllPendingLocalNotifications() #endif } -void PushNotifications::subscribeToTopic (const String& topic) +void PushNotifications::subscribeToTopic ([[maybe_unused]] const String& topic) { #if JUCE_PUSH_NOTIFICATIONS pimpl->subscribeToTopic (topic); - #else - ignoreUnused (topic); #endif } -void PushNotifications::unsubscribeFromTopic (const String& topic) +void PushNotifications::unsubscribeFromTopic ([[maybe_unused]] const String& topic) { #if JUCE_PUSH_NOTIFICATIONS pimpl->unsubscribeFromTopic (topic); - #else - ignoreUnused (topic); #endif } -void PushNotifications::sendLocalNotification (const Notification& n) +void PushNotifications::sendLocalNotification ([[maybe_unused]] const Notification& n) { #if JUCE_PUSH_NOTIFICATIONS pimpl->sendLocalNotification (n); - #else - ignoreUnused (n); #endif } -void PushNotifications::removeDeliveredNotification (const String& identifier) +void PushNotifications::removeDeliveredNotification ([[maybe_unused]] const String& identifier) { #if JUCE_PUSH_NOTIFICATIONS pimpl->removeDeliveredNotification (identifier); - #else - ignoreUnused (identifier); #endif } -void PushNotifications::removePendingLocalNotification (const String& identifier) +void PushNotifications::removePendingLocalNotification ([[maybe_unused]] const String& identifier) { #if JUCE_PUSH_NOTIFICATIONS pimpl->removePendingLocalNotification (identifier); - #else - ignoreUnused (identifier); #endif } -void PushNotifications::sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) +void PushNotifications::sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { #if JUCE_PUSH_NOTIFICATIONS pimpl->sendUpstreamMessage (serverSenderId, @@ -220,10 +207,24 @@ void PushNotifications::sendUpstreamMessage (const String& serverSenderId, messageType, timeToLive, additionalData); - #else - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); #endif } +//============================================================================== +void PushNotifications::Listener::notificationSettingsReceived ([[maybe_unused]] const Settings& settings) {} +void PushNotifications::Listener::pendingLocalNotificationsListReceived ([[maybe_unused]] const Array& notifications) {} +void PushNotifications::Listener::handleNotification ([[maybe_unused]] bool isLocalNotification, + [[maybe_unused]] const Notification& notification) {} +void PushNotifications::Listener::handleNotificationAction ([[maybe_unused]] bool isLocalNotification, + [[maybe_unused]] const Notification& notification, + [[maybe_unused]] const String& actionIdentifier, + [[maybe_unused]] const String& optionalResponse) {} +void PushNotifications::Listener::localNotificationDismissedByUser ([[maybe_unused]] const Notification& notification) {} +void PushNotifications::Listener::deliveredNotificationsListReceived ([[maybe_unused]] const Array& notifications) {} +void PushNotifications::Listener::deviceTokenRefreshed ([[maybe_unused]] const String& token) {} +void PushNotifications::Listener::remoteNotificationsDeleted() {} +void PushNotifications::Listener::upstreamMessageSent ([[maybe_unused]] const String& messageId) {} +void PushNotifications::Listener::upstreamMessageSendingError ([[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& error) {} + } // namespace juce diff --git a/modules/juce_gui_extra/misc/juce_PushNotifications.h b/modules/juce_gui_extra/misc/juce_PushNotifications.h index 52cf1dbce2..384b43abfb 100644 --- a/modules/juce_gui_extra/misc/juce_PushNotifications.h +++ b/modules/juce_gui_extra/misc/juce_PushNotifications.h @@ -601,12 +601,12 @@ public: with no categories and all allow flags set to true will be received in Listener::notificationSettingsReceived(). */ - virtual void notificationSettingsReceived (const Settings& settings) { ignoreUnused (settings); } + virtual void notificationSettingsReceived (const Settings& settings); /** Called when the list of pending notifications, requested by calling getPendingLocalNotifications() is returned. iOS 10 or above only. */ - virtual void pendingLocalNotificationsListReceived (const Array& notifications) { ignoreUnused (notifications); } + virtual void pendingLocalNotificationsListReceived (const Array& notifications); /** This can be called in multiple different situations, depending on the OS and the situation. @@ -622,7 +622,7 @@ public: Note you can receive this callback on startup, if the application was launched from a notification. */ - virtual void handleNotification (bool isLocalNotification, const Notification& notification) { ignoreUnused (isLocalNotification); ignoreUnused (notification); } + virtual void handleNotification (bool isLocalNotification, const Notification& notification); /** This can be called when a user performs some action on the notification such as pressing on an action button or responding with a text input. @@ -641,18 +641,12 @@ public: virtual void handleNotificationAction (bool isLocalNotification, const Notification& notification, const String& actionIdentifier, - const String& optionalResponse) - { - ignoreUnused (isLocalNotification); - ignoreUnused (notification); - ignoreUnused (actionIdentifier); - ignoreUnused (optionalResponse); - } + const String& optionalResponse); /** For iOS10 and Android, this can be also called when a user dismissed the notification before responding to it. */ - virtual void localNotificationDismissedByUser (const Notification& notification) { ignoreUnused (notification); } + virtual void localNotificationDismissedByUser (const Notification& notification); /** Called after getDeliveredNotifications() request is fulfilled. Returns notifications that are visible in the notification area on the device and that are still waiting @@ -661,31 +655,31 @@ public: On iOS, iOS version 10 or higher is required. On Android, API level 18 or higher is required. For unsupported platforms, an empty array will be returned. */ - virtual void deliveredNotificationsListReceived (const Array& notifications) { ignoreUnused (notifications); } + virtual void deliveredNotificationsListReceived (const Array& notifications); /** Called whenever a token gets refreshed. You should monitor any token updates, because only the last token that is assigned to device is valid and can be used. */ - virtual void deviceTokenRefreshed (const String& token) { ignoreUnused (token); } + virtual void deviceTokenRefreshed (const String& token); /** Called when Firebase Cloud Messaging server deletes pending messages. This can happen when 1) too many messages were sent to the server (hint: use collapsible messages). 2) the devices hasn't been online in a long time (refer to Firebase documentation for the maximum time a message can be stored on FCM before expiring). */ - virtual void remoteNotificationsDeleted() {} + virtual void remoteNotificationsDeleted(); /** Called when an upstream message sent with PushNotifications::sendUpstreamMessage() has been sent successfully. Bear in mind that in may take several minutes or more to receive this callback. */ - virtual void upstreamMessageSent (const String& messageId) { ignoreUnused (messageId); } + virtual void upstreamMessageSent (const String& messageId); /** Called when there was an error sending an upstream message with PushNotifications::sendUpstreamMessage(). Bear in mind that in may take several minutes or more to receive this callback. */ - virtual void upstreamMessageSendingError (const String& messageId, const String& error) { ignoreUnused (messageId); ignoreUnused (error); } + virtual void upstreamMessageSendingError (const String& messageId, const String& error); }; void addListener (Listener* l); diff --git a/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp b/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp index 94fb326313..c5a4efb8d8 100644 --- a/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp +++ b/modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.cpp @@ -132,19 +132,17 @@ void RecentlyOpenedFilesList::restoreFromString (const String& stringifiedVersio //============================================================================== -void RecentlyOpenedFilesList::registerRecentFileNatively (const File& file) +void RecentlyOpenedFilesList::registerRecentFileNatively ([[maybe_unused]] const File& file) { #if JUCE_MAC JUCE_AUTORELEASEPOOL { [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: createNSURLFromFile (file)]; } - #else - ignoreUnused (file); #endif } -void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file) +void RecentlyOpenedFilesList::forgetRecentFileNatively ([[maybe_unused]] const File& file) { #if JUCE_MAC JUCE_AUTORELEASEPOOL @@ -166,8 +164,6 @@ void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file) if (! [url isEqual:nsFile]) [sharedDocController noteNewRecentDocumentURL:url]; } - #else - ignoreUnused (file); #endif } diff --git a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp new file mode 100644 index 0000000000..ce8af6efdd --- /dev/null +++ b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.cpp @@ -0,0 +1,39 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2022 - Raw Material Software Limited + + JUCE is an open source library subject to commercial or open-source + licensing. + + By using JUCE, you agree to the terms of both the JUCE 7 End-User License + Agreement and JUCE Privacy Policy. + + End User License Agreement: www.juce.com/juce-7-licence + Privacy Policy: www.juce.com/juce-privacy-policy + + Or: You may also use this code under the terms of the GPL v3 (see + www.gnu.org/licenses). + + JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE + DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +#if JUCE_WEB_BROWSER || DOXYGEN + +bool WebBrowserComponent::pageAboutToLoad ([[maybe_unused]] const String& newURL) { return true; } +void WebBrowserComponent::pageFinishedLoading ([[maybe_unused]] const String& url) {} +bool WebBrowserComponent::pageLoadHadNetworkError ([[maybe_unused]] const String& errorInfo) { return true; } +void WebBrowserComponent::windowCloseRequest() {} +void WebBrowserComponent::newWindowAttemptingToLoad ([[maybe_unused]] const String& newURL) {} + +#endif + +} // namespace juce diff --git a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h index e65fbea5c2..8285ca3ea1 100644 --- a/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h +++ b/modules/juce_gui_extra/misc/juce_WebBrowserComponent.h @@ -232,10 +232,10 @@ public: tries to go to a particular URL. To allow the operation to carry on, return true, or return false to stop the navigation happening. */ - virtual bool pageAboutToLoad (const String& newURL) { ignoreUnused (newURL); return true; } + virtual bool pageAboutToLoad (const String& newURL); /** This callback happens when the browser has finished loading a page. */ - virtual void pageFinishedLoading (const String& url) { ignoreUnused (url); } + virtual void pageFinishedLoading (const String& url); /** This callback happens when a network error was encountered while trying to load a page. @@ -247,18 +247,18 @@ public: The errorInfo contains some platform dependent string describing the error. */ - virtual bool pageLoadHadNetworkError (const String& errorInfo) { ignoreUnused (errorInfo); return true; } + virtual bool pageLoadHadNetworkError (const String& errorInfo); /** This callback occurs when a script or other activity in the browser asks for the window to be closed. */ - virtual void windowCloseRequest() {} + virtual void windowCloseRequest(); /** This callback occurs when the browser attempts to load a URL in a new window. This won't actually load the window but gives you a chance to either launch a new window yourself or just load the URL into the current window with goToURL(). */ - virtual void newWindowAttemptingToLoad (const String& newURL) { ignoreUnused (newURL); } + virtual void newWindowAttemptingToLoad (const String& newURL); //============================================================================== /** @internal */ @@ -288,6 +288,7 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebBrowserComponent) }; + #endif } // namespace juce diff --git a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp index 87b461c05c..5e718c3e85 100644 --- a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp @@ -447,20 +447,18 @@ struct PushNotifications::Pimpl #endif } - void notifyListenersTokenRefreshed (const String& token) + void notifyListenersTokenRefreshed ([[maybe_unused]] const String& token) { #if defined(JUCE_FIREBASE_INSTANCE_ID_SERVICE_CLASSNAME) MessageManager::callAsync ([this, token] { owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (token); }); }); - #else - ignoreUnused (token); #endif } //============================================================================== - void subscribeToTopic (const String& topic) + void subscribeToTopic ([[maybe_unused]] const String& topic) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -469,12 +467,10 @@ struct PushNotifications::Pimpl FirebaseMessaging.getInstance)); env->CallObjectMethod (firebaseMessaging, FirebaseMessaging.subscribeToTopic, javaString (topic).get()); - #else - ignoreUnused (topic); #endif } - void unsubscribeFromTopic (const String& topic) + void unsubscribeFromTopic ([[maybe_unused]] const String& topic) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -483,17 +479,15 @@ struct PushNotifications::Pimpl FirebaseMessaging.getInstance)); env->CallObjectMethod (firebaseMessaging, FirebaseMessaging.unsubscribeFromTopic, javaString (topic).get()); - #else - ignoreUnused (topic); #endif } - void sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) + void sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -521,13 +515,10 @@ struct PushNotifications::Pimpl FirebaseMessaging.getInstance)); env->CallVoidMethod (firebaseMessaging, FirebaseMessaging.send, message.get()); - #else - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); #endif } - void notifyListenersAboutRemoteNotificationFromSystemTray (const LocalRef& intent) + void notifyListenersAboutRemoteNotificationFromSystemTray ([[maybe_unused]] const LocalRef& intent) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) auto* env = getEnv(); @@ -536,12 +527,10 @@ struct PushNotifications::Pimpl auto notification = remoteNotificationBundleToJuceNotification (bundle); owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, notification); }); - #else - ignoreUnused (intent); #endif } - void notifyListenersAboutRemoteNotificationFromService (const LocalRef& remoteNotification) + void notifyListenersAboutRemoteNotificationFromService ([[maybe_unused]] const LocalRef& remoteNotification) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) GlobalRef rn (remoteNotification); @@ -551,8 +540,6 @@ struct PushNotifications::Pimpl auto notification = firebaseRemoteNotificationToJuceNotification (rn.get()); owner.listeners.call ([&] (Listener& l) { l.handleNotification (false, notification); }); }); - #else - ignoreUnused (remoteNotification); #endif } @@ -566,7 +553,7 @@ struct PushNotifications::Pimpl #endif } - void notifyListenersAboutUpstreamMessageSent (const LocalRef& messageId) + void notifyListenersAboutUpstreamMessageSent ([[maybe_unused]] const LocalRef& messageId) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) GlobalRef mid (LocalRef(messageId.get())); @@ -576,13 +563,11 @@ struct PushNotifications::Pimpl auto midString = juceString ((jstring) mid.get()); owner.listeners.call ([&] (Listener& l) { l.upstreamMessageSent (midString); }); }); - #else - ignoreUnused (messageId); #endif } - void notifyListenersAboutUpstreamMessageSendingError (const LocalRef& messageId, - const LocalRef& error) + void notifyListenersAboutUpstreamMessageSendingError ([[maybe_unused]] const LocalRef& messageId, + [[maybe_unused]] const LocalRef& error) { #if defined(JUCE_FIREBASE_MESSAGING_SERVICE_CLASSNAME) GlobalRef mid (LocalRef(messageId.get())), e (LocalRef(error.get())); @@ -594,8 +579,6 @@ struct PushNotifications::Pimpl owner.listeners.call ([&] (Listener& l) { l.upstreamMessageSendingError (midString, eString); }); }); - #else - ignoreUnused (messageId, error); #endif } diff --git a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp index ade2379dbe..d7c85d0824 100644 --- a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp @@ -587,7 +587,7 @@ struct PushNotifications::Pimpl } } - void removeDeliveredNotification (const String& identifier) + void removeDeliveredNotification ([[maybe_unused]] const String& identifier) { if (@available (iOS 10, *)) { @@ -598,15 +598,13 @@ struct PushNotifications::Pimpl } else { - ignoreUnused (identifier); // Not supported on this platform jassertfalse; } } - void setupChannels (const Array& groups, const Array& channels) + void setupChannels ([[maybe_unused]] const Array& groups, [[maybe_unused]] const Array& channels) { - ignoreUnused (groups, channels); } void getPendingLocalNotifications() const @@ -679,18 +677,16 @@ struct PushNotifications::Pimpl return deviceToken; } - void subscribeToTopic (const String& topic) { ignoreUnused (topic); } - void unsubscribeFromTopic (const String& topic) { ignoreUnused (topic); } + void subscribeToTopic ([[maybe_unused]] const String& topic) {} + void unsubscribeFromTopic ([[maybe_unused]] const String& topic) {} - void sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) + void sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); } private: @@ -719,10 +715,8 @@ private: owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (deviceToken); }); } - void failedToRegisterForRemoteNotifications (NSError* error) + void failedToRegisterForRemoteNotifications ([[maybe_unused]] NSError* error) { - ignoreUnused (error); - deviceToken.clear(); } @@ -794,15 +788,13 @@ private: JUCE_END_IGNORE_WARNINGS_GCC_LIKE - void willPresentNotificationWithCompletionHandler (UNNotification* notification, + void willPresentNotificationWithCompletionHandler ([[maybe_unused]] UNNotification* notification, void (^completionHandler)(UNNotificationPresentationOptions options)) { NSUInteger options = NSUInteger ((int)settings.allowBadge << 0 | (int)settings.allowSound << 1 | (int)settings.allowAlert << 2); - ignoreUnused (notification); - completionHandler (options); } diff --git a/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp index 287131b511..6acaada9c3 100644 --- a/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_linux_X11_WebBrowserComponent.cpp @@ -555,10 +555,9 @@ public: break; case WEBKIT_POLICY_DECISION_TYPE_RESPONSE: { - auto* response = (WebKitNavigationPolicyDecision*) decision; + [[maybe_unused]] auto* response = (WebKitNavigationPolicyDecision*) decision; // for now just always allow response requests - ignoreUnused (response); WebKitSymbols::getInstance()->juce_webkit_policy_decision_use (decision); return true; } @@ -642,9 +641,8 @@ public: launchChild(); - auto ret = pipe (threadControl); + [[maybe_unused]] auto ret = pipe (threadControl); - ignoreUnused (ret); jassert (ret == 0); CommandReceiver::setBlocking (inChannel, true); @@ -772,11 +770,11 @@ private: { int inPipe[2], outPipe[2]; - auto ret = pipe (inPipe); - ignoreUnused (ret); jassert (ret == 0); + [[maybe_unused]] auto ret = pipe (inPipe); + jassert (ret == 0); ret = pipe (outPipe); - ignoreUnused (ret); jassert (ret == 0); + jassert (ret == 0); auto pid = fork(); if (pid == 0) diff --git a/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm b/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm index 014fa7f013..9dddc12a19 100644 --- a/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm +++ b/modules/juce_gui_extra/native/juce_mac_AppleRemote.mm @@ -85,11 +85,9 @@ namespace &cfPlugInInterface, &score) == kIOReturnSuccess) { - HRESULT hr = (*cfPlugInInterface)->QueryInterface (cfPlugInInterface, - CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), - device); - - ignoreUnused (hr); + [[maybe_unused]] HRESULT hr = (*cfPlugInInterface)->QueryInterface (cfPlugInInterface, + CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), + device); (*cfPlugInInterface)->Release (cfPlugInInterface); } diff --git a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp index 2043fbb14f..4a06ebb167 100644 --- a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp @@ -429,9 +429,8 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification: nsNotification]; } - void setupChannels (const Array& groups, const Array& channels) + void setupChannels ([[maybe_unused]] const Array& groups, [[maybe_unused]] const Array& channels) { - ignoreUnused (groups, channels); } void getPendingLocalNotifications() const @@ -494,9 +493,8 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.deviceTokenRefreshed (deviceToken); }); } - void failedToRegisterForRemoteNotifications (NSError* error) override + void failedToRegisterForRemoteNotifications ([[maybe_unused]] NSError* error) override { - ignoreUnused (error); deviceToken.clear(); } @@ -506,9 +504,8 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.handleNotification (true, n); }); } - void didDeliverNotification (NSUserNotification* notification) override + void didDeliverNotification ([[maybe_unused]] NSUserNotification* notification) override { - ignoreUnused (notification); } void didActivateNotification (NSUserNotification* notification) override @@ -540,18 +537,16 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate bool shouldPresentNotification (NSUserNotification*) override { return true; } - void subscribeToTopic (const String& topic) { ignoreUnused (topic); } - void unsubscribeFromTopic (const String& topic) { ignoreUnused (topic); } + void subscribeToTopic ([[maybe_unused]] const String& topic) {} + void unsubscribeFromTopic ([[maybe_unused]] const String& topic) {} - void sendUpstreamMessage (const String& serverSenderId, - const String& collapseKey, - const String& messageId, - const String& messageType, - int timeToLive, - const StringPairArray& additionalData) + void sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId, + [[maybe_unused]] const String& collapseKey, + [[maybe_unused]] const String& messageId, + [[maybe_unused]] const String& messageType, + [[maybe_unused]] int timeToLive, + [[maybe_unused]] const StringPairArray& additionalData) { - ignoreUnused (serverSenderId, collapseKey, messageId, messageType); - ignoreUnused (timeToLive, additionalData); } private: diff --git a/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp index 7e4c168f4e..7d23c7f0c3 100644 --- a/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_win32_WebBrowserComponent.cpp @@ -815,8 +815,9 @@ class WebBrowserComponent::Pimpl { public: Pimpl (WebBrowserComponent& owner, - const Options& preferences, - bool useWebView2, const String& userAgent) + [[maybe_unused]] const Options& preferences, + bool useWebView2, + const String& userAgent) { if (useWebView2) { @@ -829,8 +830,6 @@ public: #endif } - ignoreUnused (preferences); - if (internal == nullptr) internal.reset (new Win32WebView (owner, userAgent)); } diff --git a/modules/juce_opengl/juce_opengl.cpp b/modules/juce_opengl/juce_opengl.cpp index 3ffa2e3169..8a600470b5 100644 --- a/modules/juce_opengl/juce_opengl.cpp +++ b/modules/juce_opengl/juce_opengl.cpp @@ -163,24 +163,22 @@ static bool checkPeerIsValid (OpenGLContext* context) { if (auto* comp = context->getTargetComponent()) { - if (auto* peer = comp->getPeer()) + if (auto* peer [[maybe_unused]] = comp->getPeer()) { #if JUCE_MAC || JUCE_IOS if (auto* nsView = (JUCE_IOS_MAC_VIEW*) peer->getNativeHandle()) { - if (auto nsWindow = [nsView window]) + if ([[maybe_unused]] auto nsWindow = [nsView window]) { #if JUCE_MAC return ([nsWindow isVisible] && (! [nsWindow hidesOnDeactivate] || [NSApp isActive])); #else - ignoreUnused (nsWindow); return true; #endif } } #else - ignoreUnused (peer); return true; #endif } diff --git a/modules/juce_opengl/native/juce_OpenGL_android.h b/modules/juce_opengl/native/juce_OpenGL_android.h index 4358a6d7e1..36f47864aa 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -246,9 +246,11 @@ public: //============================================================================== // Android Surface Callbacks: - void surfaceChanged (LocalRef holder, int format, int width, int height) override + void surfaceChanged ([[maybe_unused]] LocalRef holder, + [[maybe_unused]] int format, + [[maybe_unused]] int width, + [[maybe_unused]] int height) override { - ignoreUnused (holder, format, width, height); } void surfaceCreated (LocalRef) override; diff --git a/modules/juce_opengl/native/juce_OpenGL_ios.h b/modules/juce_opengl/native/juce_OpenGL_ios.h index cf29a2a5fe..813aa7a652 100644 --- a/modules/juce_opengl/native/juce_OpenGL_ios.h +++ b/modules/juce_opengl/native/juce_OpenGL_ios.h @@ -244,8 +244,8 @@ private: glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorBufferHandle); - bool ok = [context.get() renderbufferStorage: GL_RENDERBUFFER fromDrawable: glLayer]; - jassert (ok); ignoreUnused (ok); + [[maybe_unused]] bool ok = [context.get() renderbufferStorage: GL_RENDERBUFFER fromDrawable: glLayer]; + jassert (ok); GLint width, height; glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width); diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp index 9ced7d1a23..7030a49f18 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp @@ -60,8 +60,8 @@ void InAppPurchases::getProductsInformation (const StringArray& productIdentifie } void InAppPurchases::purchaseProduct (const String& productIdentifier, - const String& upgradeProductIdentifier, - bool creditForUnusedSubscription) + [[maybe_unused]] const String& upgradeProductIdentifier, + [[maybe_unused]] bool creditForUnusedSubscription) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->purchaseProduct (productIdentifier, upgradeProductIdentifier, creditForUnusedSubscription); @@ -69,66 +69,55 @@ void InAppPurchases::purchaseProduct (const String& productIdentifier, Listener::PurchaseInfo purchaseInfo { Purchase { "", productIdentifier, {}, {}, {} }, {} }; listeners.call ([&] (Listener& l) { l.productPurchaseFinished (purchaseInfo, false, "In-app purchases unavailable"); }); - ignoreUnused (upgradeProductIdentifier, creditForUnusedSubscription); #endif } -void InAppPurchases::restoreProductsBoughtList (bool includeDownloadInfo, const String& subscriptionsSharedSecret) +void InAppPurchases::restoreProductsBoughtList ([[maybe_unused]] bool includeDownloadInfo, [[maybe_unused]] const String& subscriptionsSharedSecret) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->restoreProductsBoughtList (includeDownloadInfo, subscriptionsSharedSecret); #else listeners.call ([] (Listener& l) { l.purchasesListRestored ({}, false, "In-app purchases unavailable"); }); - ignoreUnused (includeDownloadInfo, subscriptionsSharedSecret); #endif } -void InAppPurchases::consumePurchase (const String& productIdentifier, const String& purchaseToken) +void InAppPurchases::consumePurchase (const String& productIdentifier, [[maybe_unused]] const String& purchaseToken) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->consumePurchase (productIdentifier, purchaseToken); #else listeners.call ([&] (Listener& l) { l.productConsumed (productIdentifier, false, "In-app purchases unavailable"); }); - ignoreUnused (purchaseToken); #endif } void InAppPurchases::addListener (Listener* l) { listeners.add (l); } void InAppPurchases::removeListener (Listener* l) { listeners.remove (l); } -void InAppPurchases::startDownloads (const Array& downloads) +void InAppPurchases::startDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->startDownloads (downloads); - #else - ignoreUnused (downloads); #endif } -void InAppPurchases::pauseDownloads (const Array& downloads) +void InAppPurchases::pauseDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->pauseDownloads (downloads); - #else - ignoreUnused (downloads); #endif } -void InAppPurchases::resumeDownloads (const Array& downloads) +void InAppPurchases::resumeDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->resumeDownloads (downloads); - #else - ignoreUnused (downloads); #endif } -void InAppPurchases::cancelDownloads (const Array& downloads) +void InAppPurchases::cancelDownloads ([[maybe_unused]] const Array& downloads) { #if JUCE_ANDROID || JUCE_IOS || JUCE_MAC pimpl->cancelDownloads (downloads); - #else - ignoreUnused (downloads); #endif } diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h index 2f89af71d3..d67755b83d 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.h @@ -261,12 +261,10 @@ public: "and only a single subscription can be upgraded/downgraded. Use the updated purchaseProduct method " "which takes a single String argument.")]] void purchaseProduct (const String& productIdentifier, - bool isSubscription, + [[maybe_unused]] bool isSubscription, const StringArray& upgradeOrDowngradeFromSubscriptionsWithProductIdentifiers = {}, bool creditForUnusedSubscription = true) { - - ignoreUnused (isSubscription); purchaseProduct (productIdentifier, upgradeOrDowngradeFromSubscriptionsWithProductIdentifiers[0], creditForUnusedSubscription); diff --git a/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp b/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp index b382e5a1b4..91422393e9 100644 --- a/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/native/juce_android_InAppPurchases.cpp @@ -685,31 +685,27 @@ struct InAppPurchases::Pimpl } //============================================================================== - void startDownloads (const Array& downloads) + void startDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } - void pauseDownloads (const Array& downloads) + void pauseDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } - void resumeDownloads (const Array& downloads) + void resumeDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } - void cancelDownloads (const Array& downloads) + void cancelDownloads ([[maybe_unused]] const Array& downloads) { // Not available on this platform. - ignoreUnused (downloads); jassertfalse; } diff --git a/modules/juce_video/capture/juce_CameraDevice.cpp b/modules/juce_video/capture/juce_CameraDevice.cpp index da0f3a6d33..5a317a7258 100644 --- a/modules/juce_video/capture/juce_CameraDevice.cpp +++ b/modules/juce_video/capture/juce_CameraDevice.cpp @@ -191,10 +191,10 @@ StringArray CameraDevice::getAvailableDevices() } } -CameraDevice* CameraDevice::openDevice (int index, - int minWidth, int minHeight, - int maxWidth, int maxHeight, - bool useHighQuality) +CameraDevice* CameraDevice::openDevice ([[maybe_unused]] int index, + [[maybe_unused]] int minWidth, [[maybe_unused]] int minHeight, + [[maybe_unused]] int maxWidth, [[maybe_unused]] int maxHeight, + [[maybe_unused]] bool useHighQuality) { jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager()); @@ -204,9 +204,6 @@ CameraDevice* CameraDevice::openDevice (int index, if (d != nullptr && d->pimpl->openedOk()) return d.release(); #else - ignoreUnused (index, minWidth, minHeight); - ignoreUnused (maxWidth, maxHeight, useHighQuality); - // Use openDeviceAsync to open a camera device on iOS or Android. jassertfalse; #endif diff --git a/modules/juce_video/native/juce_android_CameraDevice.h b/modules/juce_video/native/juce_android_CameraDevice.h index 45a731cc6d..e55ba1279d 100644 --- a/modules/juce_video/native/juce_android_CameraDevice.h +++ b/modules/juce_video/native/juce_android_CameraDevice.h @@ -715,7 +715,7 @@ private: { auto key = LocalRef (env->CallObjectMethod (keysList, JavaList.get, i)); auto jKeyName = LocalRef ((jstring) env->CallObjectMethod (key, CameraCharacteristicsKey.getName)); - auto keyName = juceString (jKeyName); + [[maybe_unused]] auto keyName = juceString (jKeyName); auto keyValue = LocalRef (env->CallObjectMethod (characteristics, CameraCharacteristics.get, key.get())); auto jKeyValueString = LocalRef ((jstring) env->CallObjectMethod (keyValue, JavaObject.toString)); @@ -747,16 +747,12 @@ private: JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + keyValueString); } } - - ignoreUnused (keyName); } } - static void printPrimitiveArrayElements (const LocalRef& keyValue, const String& keyName, + static void printPrimitiveArrayElements (const LocalRef& keyValue, [[maybe_unused]] const String& keyName, const String& keyValueString) { - ignoreUnused (keyName); - String result = "["; auto* env = getEnv(); @@ -790,7 +786,7 @@ private: JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + result); } - static void printRangeArrayElements (const LocalRef& rangeArray, const String& keyName) + static void printRangeArrayElements (const LocalRef& rangeArray, [[maybe_unused]] const String& keyName) { auto* env = getEnv(); @@ -809,7 +805,6 @@ private: result << juceString (jRangeString) << " "; } - ignoreUnused (keyName); JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + result); } @@ -921,10 +916,8 @@ private: javaString (name).get())); } - static void printSizesLog (const Array>& sizes, const String& className) + static void printSizesLog ([[maybe_unused]] const Array>& sizes, [[maybe_unused]] const String& className) { - ignoreUnused (sizes, className); - JUCE_CAMERA_LOG ("Sizes for class " + className); #if JUCE_CAMERA_LOG_ENABLED @@ -1489,18 +1482,14 @@ private: Desktop::getInstance().setOrientationsEnabled (orientationsEnabled); } - void onInfo (LocalRef& recorder, int what, int extra) override + void onInfo ([[maybe_unused]] LocalRef& recorder, [[maybe_unused]] int what, [[maybe_unused]] int extra) override { - ignoreUnused (recorder, what, extra); - JUCE_CAMERA_LOG ("MediaRecorder::OnInfo: " + getInfoStringFromCode (what) + ", extra code = " + String (extra)); } - void onError (LocalRef& recorder, int what, int extra) override + void onError ([[maybe_unused]] LocalRef& recorder, [[maybe_unused]] int what, [[maybe_unused]] int extra) override { - ignoreUnused (recorder, what, extra); - JUCE_CAMERA_LOG ("MediaRecorder::onError: " + getErrorStringFromCode (what) + ", extra code = " + String (extra)); } @@ -1976,54 +1965,60 @@ private: } //============================================================================== - void cameraCaptureSessionCaptureCompleted (bool isPreview, jobject session, jobject request, jobject result) + void cameraCaptureSessionCaptureCompleted (bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + jobject result) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureCompleted()"); - ignoreUnused (session, request); - if (isPreview) updateState (result); else if (currentState != State::idle) unlockFocus(); } - void cameraCaptureSessionCaptureFailed (bool isPreview, jobject session, jobject request, jobject failure) + void cameraCaptureSessionCaptureFailed ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + [[maybe_unused]] jobject failure) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureFailed()"); - - ignoreUnused (isPreview, session, request, failure); } - void cameraCaptureSessionCaptureProgressed (bool isPreview, jobject session, jobject request, jobject partialResult) + void cameraCaptureSessionCaptureProgressed (bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + jobject partialResult) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureProgressed()"); - ignoreUnused (session, request); - if (isPreview) updateState (partialResult); } - void cameraCaptureSessionCaptureSequenceAborted (bool isPreview, jobject session, int sequenceId) + void cameraCaptureSessionCaptureSequenceAborted ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] int sequenceId) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureSequenceAborted()"); - - ignoreUnused (isPreview, isPreview, session, sequenceId); } - void cameraCaptureSessionCaptureSequenceCompleted (bool isPreview, jobject session, int sequenceId, int64 frameNumber) + void cameraCaptureSessionCaptureSequenceCompleted ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] int sequenceId, + [[maybe_unused]] int64 frameNumber) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureSequenceCompleted()"); - - ignoreUnused (isPreview, session, sequenceId, frameNumber); } - void cameraCaptureSessionCaptureStarted (bool isPreview, jobject session, jobject request, int64 timestamp, int64 frameNumber) + void cameraCaptureSessionCaptureStarted ([[maybe_unused]] bool isPreview, + [[maybe_unused]] jobject session, + [[maybe_unused]] jobject request, + [[maybe_unused]] int64 timestamp, + [[maybe_unused]] int64 frameNumber) { JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureStarted()"); - - ignoreUnused (isPreview, session, request, timestamp, frameNumber); } //============================================================================== @@ -2166,24 +2161,21 @@ private: env->CallVoidMethod (captureRequestBuilder, CaptureRequestBuilder.set, jKey.get(), jValue.get()); } - void cameraCaptureSessionActive (jobject session) + void cameraCaptureSessionActive ([[maybe_unused]] jobject session) { JUCE_CAMERA_LOG ("cameraCaptureSessionActive()"); - ignoreUnused (session); } - void cameraCaptureSessionClosed (jobject session) + void cameraCaptureSessionClosed ([[maybe_unused]] jobject session) { JUCE_CAMERA_LOG ("cameraCaptureSessionClosed()"); - ignoreUnused (session); closedEvent.signal(); } - void cameraCaptureSessionConfigureFailed (jobject session) + void cameraCaptureSessionConfigureFailed ([[maybe_unused]] jobject session) { JUCE_CAMERA_LOG ("cameraCaptureSessionConfigureFailed()"); - ignoreUnused (session); MessageManager::callAsync ([weakRef = WeakReference { this }] { @@ -2231,10 +2223,9 @@ private: }); } - void cameraCaptureSessionReady (const LocalRef& session) + void cameraCaptureSessionReady ([[maybe_unused]] const LocalRef& session) { JUCE_CAMERA_LOG ("cameraCaptureSessionReady()"); - ignoreUnused (session); } //============================================================================== diff --git a/modules/juce_video/native/juce_android_Video.h b/modules/juce_video/native/juce_android_Video.h index 101bf958fc..4f8810f8e6 100644 --- a/modules/juce_video/native/juce_android_Video.h +++ b/modules/juce_video/native/juce_android_Video.h @@ -774,20 +774,18 @@ private: //============================================================================== // MediaSessionController callbacks - static void audioInfoChanged (JNIEnv*, jobject, jlong host, jobject playbackInfo) + static void audioInfoChanged (JNIEnv*, jobject, jlong host, [[maybe_unused]] jobject playbackInfo) { if (auto* myself = reinterpret_cast (host)) { - ignoreUnused (playbackInfo); JUCE_VIDEO_LOG ("MediaSessionController::audioInfoChanged()"); } } - static void metadataChanged (JNIEnv*, jobject, jlong host, jobject metadata) + static void metadataChanged (JNIEnv*, jobject, jlong host, [[maybe_unused]] jobject metadata) { if (auto* myself = reinterpret_cast (host)) { - ignoreUnused (metadata); JUCE_VIDEO_LOG ("MediaSessionController::metadataChanged()"); } } @@ -835,10 +833,8 @@ private: getEnv()->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.setDisplay, videoSurfaceHolder.get()); } - void load (const LocalRef& mediaId, const LocalRef& extras) + void load (const LocalRef& mediaId, [[maybe_unused]] const LocalRef& extras) { - ignoreUnused (extras); - closeVideo(); auto* env = getEnv(); @@ -1114,39 +1110,31 @@ private: State currentState = State::idle; //============================================================================== - void onPrepared (LocalRef& mediaPlayer) override + void onPrepared ([[maybe_unused]] LocalRef& mediaPlayer) override { JUCE_VIDEO_LOG ("MediaPlayer::onPrepared()"); - ignoreUnused (mediaPlayer); - currentState = State::prepared; owner.playerPrepared(); } - void onBufferingUpdate (LocalRef& mediaPlayer, int progress) override + void onBufferingUpdate ([[maybe_unused]] LocalRef& mediaPlayer, int progress) override { - ignoreUnused (mediaPlayer); - owner.playerBufferingUpdated (progress); } - void onSeekComplete (LocalRef& mediaPlayer) override + void onSeekComplete ([[maybe_unused]] LocalRef& mediaPlayer) override { JUCE_VIDEO_LOG ("MediaPlayer::onSeekComplete()"); - ignoreUnused (mediaPlayer); - owner.playerSeekCompleted(); } - void onCompletion (LocalRef& mediaPlayer) override + void onCompletion ([[maybe_unused]] LocalRef& mediaPlayer) override { JUCE_VIDEO_LOG ("MediaPlayer::onCompletion()"); - ignoreUnused (mediaPlayer); - currentState = State::complete; owner.playerPlaybackCompleted(); @@ -1169,13 +1157,11 @@ private: MEDIA_INFO_SUBTITLE_TIMED_OUT = 902 }; - bool onInfo (LocalRef& mediaPlayer, int what, int extra) override + bool onInfo ([[maybe_unused]] LocalRef& mediaPlayer, int what, [[maybe_unused]] int extra) override { JUCE_VIDEO_LOG ("MediaPlayer::onInfo(), infoCode: " + String (what) + " (" + infoCodeToString (what) + ")" + ", extraCode: " + String (extra)); - ignoreUnused (mediaPlayer, extra); - if (what == MEDIA_INFO_BUFFERING_START) owner.playerBufferingStarted(); else if (what == MEDIA_INFO_BUFFERING_END) @@ -1205,7 +1191,7 @@ private: } } - bool onError (LocalRef& mediaPlayer, int what, int extra) override + bool onError ([[maybe_unused]] LocalRef& mediaPlayer, int what, int extra) override { auto errorMessage = errorCodeToString (what); auto extraMessage = errorCodeToString (extra); @@ -1216,8 +1202,6 @@ private: JUCE_VIDEO_LOG ("MediaPlayer::onError(), errorCode: " + String (what) + " (" + errorMessage + ")" + ", extraCode: " + String (extra) + " (" + extraMessage + ")"); - ignoreUnused (mediaPlayer); - currentState = State::error; owner.errorOccurred (errorMessage); diff --git a/modules/juce_video/native/juce_ios_CameraDevice.h b/modules/juce_video/native/juce_ios_CameraDevice.h index 97a48c5a2a..d5b8187206 100644 --- a/modules/juce_video/native/juce_ios_CameraDevice.h +++ b/modules/juce_video/native/juce_ios_CameraDevice.h @@ -524,23 +524,19 @@ private: private: //============================================================================== - static void started (id self, SEL, NSNotification* notification) + static void started (id self, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - ignoreUnused (notification); - dispatch_async (dispatch_get_main_queue(), ^{ getOwner (self).cameraSessionStarted(); }); } - static void stopped (id, SEL, NSNotification* notification) + static void stopped (id, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - - ignoreUnused (notification); } static void runtimeError (id self, SEL, NSNotification* notification) @@ -555,18 +551,14 @@ private: }); } - static void interrupted (id, SEL, NSNotification* notification) + static void interrupted (id, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - - ignoreUnused (notification); } - static void interruptionEnded (id, SEL, NSNotification* notification) + static void interruptionEnded (id, SEL, [[maybe_unused]] NSNotification* notification) { JUCE_CAMERA_LOG (nsStringToJuce ([notification description])); - - ignoreUnused (notification); } }; @@ -788,8 +780,7 @@ private: static void didFinishCaptureForSettings (id, SEL, AVCapturePhotoOutput*, AVCaptureResolvedPhotoSettings*, NSError* error) { - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("didFinishCaptureForSettings(), error = " + errorString); } @@ -799,8 +790,7 @@ private: { getOwner (self).takingPicture = false; - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("didFinishProcessingPhoto(), error = " + errorString); @@ -904,8 +894,7 @@ private: { getOwner (self).takingPicture = false; - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("didFinishProcessingPhotoSampleBuffer(), error = " + errorString); @@ -1019,10 +1008,8 @@ private: } private: - static void printVideoOutputDebugInfo (AVCaptureMovieFileOutput* output) + static void printVideoOutputDebugInfo ([[maybe_unused]] AVCaptureMovieFileOutput* output) { - ignoreUnused (output); - JUCE_CAMERA_LOG ("Available video codec types:"); #if JUCE_CAMERA_LOG_ENABLED diff --git a/modules/juce_video/native/juce_mac_CameraDevice.h b/modules/juce_video/native/juce_mac_CameraDevice.h index 28748f8de2..6280e56fb7 100644 --- a/modules/juce_video/native/juce_mac_CameraDevice.h +++ b/modules/juce_video/native/juce_mac_CameraDevice.h @@ -306,8 +306,7 @@ private: { if (error != nil) { - String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); - ignoreUnused (errorString); + [[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String(); JUCE_CAMERA_LOG ("Still picture capture failed, error: " + errorString); jassertfalse; diff --git a/modules/juce_video/native/juce_win32_CameraDevice.h b/modules/juce_video/native/juce_win32_CameraDevice.h index 9ba11f4e25..535c6a3d30 100644 --- a/modules/juce_video/native/juce_win32_CameraDevice.h +++ b/modules/juce_video/native/juce_win32_CameraDevice.h @@ -479,7 +479,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster auto context = [] { IBindCtx* ptr = nullptr; - ignoreUnused (CreateBindCtx (0, &ptr)); + [[maybe_unused]] const auto result = CreateBindCtx (0, &ptr); return ContextPtr (ptr); }(); diff --git a/modules/juce_video/native/juce_win32_Video.h b/modules/juce_video/native/juce_win32_Video.h index 6279cd1861..263b47e165 100644 --- a/modules/juce_video/native/juce_win32_Video.h +++ b/modules/juce_video/native/juce_win32_Video.h @@ -395,7 +395,7 @@ private: { DirectShowContext (Pimpl& c) : component (c) { - ignoreUnused (CoInitialize (nullptr)); + [[maybe_unused]] const auto result = CoInitialize (nullptr); } ~DirectShowContext() override diff --git a/modules/juce_video/playback/juce_VideoComponent.cpp b/modules/juce_video/playback/juce_VideoComponent.cpp index 3eb62862bf..10c4138a2f 100644 --- a/modules/juce_video/playback/juce_VideoComponent.cpp +++ b/modules/juce_video/playback/juce_VideoComponent.cpp @@ -145,7 +145,6 @@ Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync) { #if JUCE_ANDROID || JUCE_IOS ignoreUnused (fileOrUrl, loadAsync); - // You need to use loadAsync on Android & iOS. jassertfalse; return Result::fail ("load() is not supported on this platform. Use loadAsync() instead."); @@ -155,7 +154,7 @@ Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync) if (loadAsync) startTimer (50); else - resized(); + resized(); return result; #endif