diff --git a/extras/AudioPluginHost/AudioPluginHost.jucer b/extras/AudioPluginHost/AudioPluginHost.jucer index 894f791c7c..0cecea5328 100644 --- a/extras/AudioPluginHost/AudioPluginHost.jucer +++ b/extras/AudioPluginHost/AudioPluginHost.jucer @@ -7,7 +7,7 @@ companyCopyright="ROLI Ltd."> diff --git a/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj b/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj index bbcabdbbb8..4998fe4c8a 100644 --- a/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj +++ b/extras/AudioPluginHost/Builds/MacOSX/AudioPluginHost.xcodeproj/project.pbxproj @@ -801,7 +801,7 @@ INFOPLIST_PREPROCESS = NO; INSTALL_PATH = "$(HOME)/Applications"; MACOSX_DEPLOYMENT_TARGET = 10.11; - OTHER_CPLUSPLUSFLAGS = "-Wall -Wshadow -Wstrict-aliasing -Wconversion -Wsign-compare -Woverloaded-virtual -Wextra-semi"; + OTHER_CPLUSPLUSFLAGS = "-Wall -Wno-missing-field-initializers -Wshadow-all -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wno-ignored-qualifiers -Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align -Winconsistent-missing-destructor-override -Wshift-sign-overflow -Wundefined-func-template -Wnullable-to-nonnull-conversion"; PRODUCT_BUNDLE_IDENTIFIER = com.roli.juce.pluginhost; PRODUCT_NAME = "AudioPluginHost"; USE_HEADERMAP = NO; @@ -847,7 +847,7 @@ INSTALL_PATH = "$(HOME)/Applications"; LLVM_LTO = YES; MACOSX_DEPLOYMENT_TARGET = 10.11; - OTHER_CPLUSPLUSFLAGS = "-Wall -Wshadow -Wstrict-aliasing -Wconversion -Wsign-compare -Woverloaded-virtual -Wextra-semi"; + OTHER_CPLUSPLUSFLAGS = "-Wall -Wno-missing-field-initializers -Wshadow-all -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wno-ignored-qualifiers -Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align -Winconsistent-missing-destructor-override -Wshift-sign-overflow -Wundefined-func-template -Wnullable-to-nonnull-conversion"; PRODUCT_BUNDLE_IDENTIFIER = com.roli.juce.pluginhost; PRODUCT_NAME = "AudioPluginHost"; USE_HEADERMAP = NO; diff --git a/extras/AudioPluginHost/Source/Filters/FilterGraph.h b/extras/AudioPluginHost/Source/Filters/FilterGraph.h index 592642d4df..318e8c90c1 100644 --- a/extras/AudioPluginHost/Source/Filters/FilterGraph.h +++ b/extras/AudioPluginHost/Source/Filters/FilterGraph.h @@ -40,7 +40,7 @@ class FilterGraph : public FileBasedDocument, public: //============================================================================== FilterGraph (AudioPluginFormatManager&); - ~FilterGraph(); + ~FilterGraph() override; //============================================================================== using NodeID = AudioProcessorGraph::NodeID; diff --git a/extras/AudioPluginHost/Source/Filters/FilterIOConfiguration.h b/extras/AudioPluginHost/Source/Filters/FilterIOConfiguration.h index 4fcf3ba6bc..266a3a180e 100644 --- a/extras/AudioPluginHost/Source/Filters/FilterIOConfiguration.h +++ b/extras/AudioPluginHost/Source/Filters/FilterIOConfiguration.h @@ -35,7 +35,7 @@ class FilterIOConfigurationWindow : public AudioProcessorEditor { public: FilterIOConfigurationWindow (AudioProcessor&); - ~FilterIOConfigurationWindow(); + ~FilterIOConfigurationWindow() override; //============================================================================== void paint (Graphics& g) override; diff --git a/extras/AudioPluginHost/Source/Filters/InternalFilters.h b/extras/AudioPluginHost/Source/Filters/InternalFilters.h index 4432ff08a1..e0b26a2a8d 100644 --- a/extras/AudioPluginHost/Source/Filters/InternalFilters.h +++ b/extras/AudioPluginHost/Source/Filters/InternalFilters.h @@ -38,7 +38,7 @@ class InternalPluginFormat : public AudioPluginFormat public: //============================================================================== InternalPluginFormat(); - ~InternalPluginFormat() {} + ~InternalPluginFormat() override {} //============================================================================== PluginDescription audioInDesc, audioOutDesc, midiInDesc; diff --git a/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp b/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp index 3803bf0b2c..c3b6036a31 100644 --- a/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp +++ b/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp @@ -197,7 +197,7 @@ struct GraphEditorPanel::FilterComponent : public Component, FilterComponent (const FilterComponent&) = delete; FilterComponent& operator= (const FilterComponent&) = delete; - ~FilterComponent() + ~FilterComponent() override { if (auto f = graph.graph.getNodeForId (pluginID)) { @@ -812,7 +812,7 @@ void GraphEditorPanel::updateComponents() for (auto* f : graph.graph.getNodes()) { - if (getComponentForFilter (f->nodeID) == 0) + if (getComponentForFilter (f->nodeID) == nullptr) { auto* comp = nodes.add (new FilterComponent (*this, f->nodeID)); addAndMakeVisible (comp); @@ -822,7 +822,7 @@ void GraphEditorPanel::updateComponents() for (auto& c : graph.graph.getConnections()) { - if (getComponentForConnection (c) == 0) + if (getComponentForConnection (c) == nullptr) { auto* comp = connectors.add (new ConnectorComponent (*this)); addAndMakeVisible (comp); @@ -844,8 +844,8 @@ void GraphEditorPanel::showPopupMenu (Point mousePos) menu->showMenuAsync ({}, ModalCallbackFunction::create ([this, mousePos] (int r) { - if (auto* mainWindow = findParentComponentOfClass()) - if (auto* desc = mainWindow->getChosenType (r)) + if (auto* mainWin = findParentComponentOfClass()) + if (auto* desc = mainWin->getChosenType (r)) createNewPlugin (*desc, mousePos); })); } diff --git a/extras/AudioPluginHost/Source/UI/GraphEditorPanel.h b/extras/AudioPluginHost/Source/UI/GraphEditorPanel.h index 7112e05a37..291420ea3f 100644 --- a/extras/AudioPluginHost/Source/UI/GraphEditorPanel.h +++ b/extras/AudioPluginHost/Source/UI/GraphEditorPanel.h @@ -40,7 +40,7 @@ class GraphEditorPanel : public Component, { public: GraphEditorPanel (FilterGraph& graph); - ~GraphEditorPanel(); + ~GraphEditorPanel() override; void createNewPlugin (const PluginDescription&, Point position); @@ -107,7 +107,7 @@ public: AudioDeviceManager& deviceManager, KnownPluginList& pluginList); - ~GraphDocumentComponent(); + ~GraphDocumentComponent() override; //============================================================================== void createNewPlugin (const PluginDescription&, Point position); diff --git a/extras/AudioPluginHost/Source/UI/MainHostWindow.cpp b/extras/AudioPluginHost/Source/UI/MainHostWindow.cpp index e395667492..4b3522b150 100644 --- a/extras/AudioPluginHost/Source/UI/MainHostWindow.cpp +++ b/extras/AudioPluginHost/Source/UI/MainHostWindow.cpp @@ -55,7 +55,7 @@ public: setVisible (true); } - ~PluginListWindow() + ~PluginListWindow() override { getAppProperties().getUserSettings()->setValue ("listWindowPos", getWindowStateAsString()); clearContentComponent(); diff --git a/extras/AudioPluginHost/Source/UI/MainHostWindow.h b/extras/AudioPluginHost/Source/UI/MainHostWindow.h index 78e87e8992..8ca9e21517 100644 --- a/extras/AudioPluginHost/Source/UI/MainHostWindow.h +++ b/extras/AudioPluginHost/Source/UI/MainHostWindow.h @@ -60,7 +60,7 @@ class MainHostWindow : public DocumentWindow, public: //============================================================================== MainHostWindow(); - ~MainHostWindow(); + ~MainHostWindow() override; //============================================================================== void closeButtonPressed() override; diff --git a/extras/AudioPluginHost/Source/UI/PluginWindow.h b/extras/AudioPluginHost/Source/UI/PluginWindow.h index 0fc39c3fc0..386ee07f83 100644 --- a/extras/AudioPluginHost/Source/UI/PluginWindow.h +++ b/extras/AudioPluginHost/Source/UI/PluginWindow.h @@ -40,12 +40,12 @@ class FilterDebugWindow : public AudioProcessorEditor, { public: FilterDebugWindow (AudioProcessor& proc) - : AudioProcessorEditor (proc), processor (proc) + : AudioProcessorEditor (proc), audioProc (proc) { setSize (500, 200); addAndMakeVisible (list); - for (auto* p : processor.getParameters()) + for (auto* p : audioProc.getParameters()) p->addListener (this); log.add ("Parameter debug log started"); @@ -53,7 +53,7 @@ public: void parameterValueChanged (int parameterIndex, float newValue) override { - auto* param = processor.getParameters()[parameterIndex]; + auto* param = audioProc.getParameters()[parameterIndex]; auto value = param->getCurrentValueAsText().quoted() + " (" + String (newValue, 4) + ")"; appendToLog ("parameter change", *param, value); @@ -61,7 +61,7 @@ public: void parameterGestureChanged (int parameterIndex, bool gestureIsStarting) override { - auto* param = processor.getParameters()[parameterIndex]; + auto* param = audioProc.getParameters()[parameterIndex]; appendToLog ("gesture", *param, gestureIsStarting ? "start" : "end"); } @@ -120,7 +120,7 @@ private: StringArray pendingLogEntries; CriticalSection pendingLogLock; - AudioProcessor& processor; + AudioProcessor& audioProc; }; //============================================================================== @@ -170,7 +170,7 @@ public: setVisible (true); } - ~PluginWindow() + ~PluginWindow() override { clearContentComponent(); } @@ -287,7 +287,7 @@ private: owner.addListener (this); } - ~PropertyComp() + ~PropertyComp() override { owner.removeListener (this); } diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h index de59213181..aaec61154c 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h @@ -40,7 +40,7 @@ class JUCE_API AudioUnitPluginFormat : public AudioPluginFormat public: //============================================================================== AudioUnitPluginFormat(); - ~AudioUnitPluginFormat(); + ~AudioUnitPluginFormat() override; //============================================================================== String getName() const override { return "AudioUnit"; } diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index 19d5531f7e..2e7e75533c 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -163,7 +163,7 @@ namespace AudioUnitFormatHelpers desc.componentSubType = stringToOSType (tokens[1]); desc.componentManufacturer = stringToOSType (tokens[2]); - if (AudioComponent comp = AudioComponentFindNext (0, &desc)) + if (AudioComponent comp = AudioComponentFindNext (nullptr, &desc)) { getNameAndManufacturer (comp, name, manufacturer); @@ -206,17 +206,17 @@ namespace AudioUnitFormatHelpers const char* const utf8 = fileOrIdentifier.toUTF8(); - if (CFURLRef url = CFURLCreateFromFileSystemRepresentation (0, (const UInt8*) utf8, + if (CFURLRef url = CFURLCreateFromFileSystemRepresentation (nullptr, (const UInt8*) utf8, (CFIndex) strlen (utf8), file.isDirectory())) { CFBundleRef bundleRef = CFBundleCreate (kCFAllocatorDefault, url); CFRelease (url); - if (bundleRef != 0) + if (bundleRef != nullptr) { CFTypeRef bundleName = CFBundleGetValueForInfoDictionaryKey (bundleRef, CFSTR("CFBundleName")); - if (bundleName != 0 && CFGetTypeID (bundleName) == CFStringGetTypeID()) + if (bundleName != nullptr && CFGetTypeID (bundleName) == CFStringGetTypeID()) name = String::fromCFString ((CFStringRef) bundleName); if (name.isEmpty()) @@ -224,12 +224,12 @@ namespace AudioUnitFormatHelpers CFTypeRef versionString = CFBundleGetValueForInfoDictionaryKey (bundleRef, CFSTR("CFBundleVersion")); - if (versionString != 0 && CFGetTypeID (versionString) == CFStringGetTypeID()) + if (versionString != nullptr && CFGetTypeID (versionString) == CFStringGetTypeID()) version = String::fromCFString ((CFStringRef) versionString); CFTypeRef manuString = CFBundleGetValueForInfoDictionaryKey (bundleRef, CFSTR("CFBundleGetInfoString")); - if (manuString != 0 && CFGetTypeID (manuString) == CFStringGetTypeID()) + if (manuString != nullptr && CFGetTypeID (manuString) == CFStringGetTypeID()) manufacturer = String::fromCFString ((CFStringRef) manuString); const ResFileRefNum resFileId = CFBundleOpenBundleResourceMap (bundleRef); @@ -256,7 +256,7 @@ namespace AudioUnitFormatHelpers desc.componentSubType = types[1]; desc.componentManufacturer = types[2]; - if (AudioComponent comp = AudioComponentFindNext (0, &desc)) + if (AudioComponent comp = AudioComponentFindNext (nullptr, &desc)) getNameAndManufacturer (comp, name, manufacturer); break; @@ -506,7 +506,7 @@ public: auComponent (AudioComponentInstanceGetComponent (au)), audioUnit (au), #if JUCE_MAC - eventListenerRef (0), + eventListenerRef (nullptr), #endif midiConcatenator (2048) { @@ -529,7 +529,7 @@ public: updateSupportedLayouts(); } - ~AudioUnitPluginInstance() + ~AudioUnitPluginInstance() override { const ScopedLock sl (lock); @@ -574,10 +574,10 @@ public: void cleanup() { #if JUCE_MAC - if (eventListenerRef != 0) + if (eventListenerRef != nullptr) { AUListenerDispose (eventListenerRef); - eventListenerRef = 0; + eventListenerRef = nullptr; } #endif @@ -1292,7 +1292,7 @@ public: void getCurrentProgramStateInformation (MemoryBlock& destData) override { - CFPropertyListRef propertyList = 0; + CFPropertyListRef propertyList = nullptr; UInt32 sz = sizeof (CFPropertyListRef); if (AudioUnitGetProperty (audioUnit, @@ -1303,7 +1303,7 @@ public: CFWriteStreamRef stream = CFWriteStreamCreateWithAllocatedBuffers (kCFAllocatorDefault, kCFAllocatorDefault); CFWriteStreamOpen (stream); - CFIndex bytesWritten = CFPropertyListWriteToStream (propertyList, stream, kCFPropertyListBinaryFormat_v1_0, 0); + CFIndex bytesWritten = CFPropertyListWriteToStream (propertyList, stream, kCFPropertyListBinaryFormat_v1_0, nullptr); CFWriteStreamClose (stream); CFDataRef data = (CFDataRef) CFWriteStreamCopyProperty (stream, kCFStreamPropertyDataWritten); @@ -1330,10 +1330,10 @@ public: CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0; CFPropertyListRef propertyList = CFPropertyListCreateFromStream (kCFAllocatorDefault, stream, 0, - kCFPropertyListImmutable, &format, 0); + kCFPropertyListImmutable, &format, nullptr); CFRelease (stream); - if (propertyList != 0) + if (propertyList != nullptr) { AudioUnitSetProperty (audioUnit, kAudioUnitProperty_ClassInfo, kAudioUnitScope_Global, 0, &propertyList, sizeof (propertyList)); @@ -1443,7 +1443,7 @@ public: auto getClumpName = [this, info] { AudioUnitParameterNameInfo clumpNameInfo; - UInt32 sz = sizeof (clumpNameInfo); + UInt32 clumpSz = sizeof (clumpNameInfo); zerostruct (clumpNameInfo); clumpNameInfo.inID = info.clumpID; clumpNameInfo.inDesiredLength = (SInt32) 256; @@ -1453,7 +1453,7 @@ public: kAudioUnitScope_Global, 0, &clumpNameInfo, - &sz) == noErr) + &clumpSz) == noErr) return String::fromCFString (clumpNameInfo.outName); return String (info.clumpID); @@ -1606,11 +1606,11 @@ private: { String lowercaseText (text.toLowerCase()); - for (auto& testText : onStrings) + for (auto& testText : auOnStrings) if (lowercaseText == testText) return 1.0f; - for (auto& testText : offStrings) + for (auto& testText : auOffStrings) if (lowercaseText == testText) return 0.0f; @@ -1628,8 +1628,8 @@ private: String getLabel() const override { return {}; } AudioUnitPluginInstance& parent; - const StringArray onStrings { TRANS("on"), TRANS("yes"), TRANS("true") }; - const StringArray offStrings { TRANS("off"), TRANS("no"), TRANS("false") }; + const StringArray auOnStrings { TRANS("on"), TRANS("yes"), TRANS("true") }; + const StringArray auOffStrings { TRANS("off"), TRANS("no"), TRANS("false") }; const StringArray values { TRANS("Off"), TRANS("On") }; bool currentValue = false; @@ -2262,7 +2262,7 @@ public: createView (createGenericViewIfNeeded); } - ~AudioUnitPluginWindowCocoa() + ~AudioUnitPluginWindowCocoa() override { if (wrapper.getView() != nil) { @@ -2340,7 +2340,7 @@ private: { NSString* viewClassName = (NSString*) (info->mCocoaAUViewClass[0]); CFStringRef path = CFURLCopyPath (info->mCocoaAUViewBundleLocation); - NSString* unescapedPath = (NSString*) CFURLCreateStringByReplacingPercentEscapes (0, path, CFSTR ("")); + NSString* unescapedPath = (NSString*) CFURLCreateStringByReplacingPercentEscapes (nullptr, path, CFSTR ("")); CFRelease (path); NSBundle* viewBundle = [NSBundle bundleWithPath: [unescapedPath autorelease]]; Class viewClass = [viewBundle classNamed: viewClassName]; @@ -2662,7 +2662,7 @@ void AudioUnitPluginFormat::createPluginInstance (const PluginDescription& desc, return; } - if ((auComponent = AudioComponentFindNext (0, &componentDesc)) == nullptr) + if ((auComponent = AudioComponentFindNext (nullptr, &componentDesc)) == nullptr) { callback (userData, nullptr, errMessage); return; @@ -2761,7 +2761,7 @@ bool AudioUnitPluginFormat::requiresUnblockedMessageThreadDuringCreation (const || AudioUnitFormatHelpers::getComponentDescFromFile (desc.fileOrIdentifier, componentDesc, pluginName, version, manufacturer)) { - if (AudioComponent auComp = AudioComponentFindNext (0, &componentDesc)) + if (AudioComponent auComp = AudioComponentFindNext (nullptr, &componentDesc)) if (AudioComponentGetDescription (auComp, &componentDesc) == noErr) return ((componentDesc.componentFlags & kAudioComponentFlag_IsV3AudioUnit) != 0); } diff --git a/modules/juce_audio_processors/format_types/juce_VST3Headers.h b/modules/juce_audio_processors/format_types/juce_VST3Headers.h index fa929df30f..13a22cf3cb 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3Headers.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Headers.h @@ -53,6 +53,15 @@ #if __has_warning("-Wcomma") #pragma clang diagnostic ignored "-Wcomma" #endif + #if __has_warning("-Wzero-as-null-pointer-constant") + #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" + #endif + #if __has_warning("-Winconsistent-missing-destructor-override") + #pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override" + #endif + #if __has_warning("-Wcast-align") + #pragma clang diagnostic ignored "-Wcast-align" + #endif #endif #undef DEVELOPMENT diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index c023c75042..dd3f711699 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -66,8 +66,17 @@ static int warnOnFailure (int result) noexcept DBG (message); return result; } + +static int warnOnFailureIfImplemented (int result) noexcept +{ + if (result != kResultOk && result != kNotImplemented) + return warnOnFailure (result); + + return result; +} #else #define warnOnFailure(x) x + #define warnOnFailureIfImplemented(x) x #endif //============================================================================== @@ -949,7 +958,7 @@ private: const File file (filePath); const char* const utf8 = file.getFullPathName().toRawUTF8(); - if (CFURLRef url = CFURLCreateFromFileSystemRepresentation (0, (const UInt8*) utf8, (CFIndex) std::strlen (utf8), file.isDirectory())) + if (CFURLRef url = CFURLCreateFromFileSystemRepresentation (nullptr, (const UInt8*) utf8, (CFIndex) std::strlen (utf8), file.isDirectory())) { bundleRef = CFBundleCreate (kCFAllocatorDefault, url); CFRelease (url); @@ -1131,7 +1140,7 @@ struct VST3PluginWindow : public AudioProcessorEditor, } } - ~VST3PluginWindow() + ~VST3PluginWindow() override { warnOnFailure (view->removed()); warnOnFailure (view->setFrame (nullptr)); @@ -1716,7 +1725,7 @@ public: holder->host->setPlugin (this); } - ~VST3PluginInstance() + ~VST3PluginInstance() override { jassert (getActiveEditor() == nullptr); // You must delete any editors before deleting the plugin instance! @@ -1886,10 +1895,7 @@ public: cachedBusLayouts = getBusesLayout(); warnOnFailure (holder->component->setActive (true)); - auto result = processor->setProcessing (true); - - if (result != kResultOk && result != kNotImplemented) - warnOnFailure (result); + warnOnFailureIfImplemented (processor->setProcessing (true)); isActive = true; } @@ -1904,12 +1910,7 @@ public: setStateForAllMidiBuses (false); if (processor != nullptr) - { - auto result = processor->setProcessing (false); - - if (result != kResultOk && result != kNotImplemented) - warnOnFailure (result); - } + warnOnFailureIfImplemented (processor->setProcessing (false)); if (holder->component != nullptr) warnOnFailure (holder->component->setActive (false)); @@ -2626,15 +2627,8 @@ private: Steinberg::MemoryStream stream; if (holder->component->getState (&stream) == kResultTrue) - { if (stream.seek (0, Steinberg::IBStream::kIBSeekSet, nullptr) == kResultTrue) - { - auto result = editController->setComponentState (&stream); - - if (result != kResultOk && result != kNotImplemented) - warnOnFailure (result); - } - } + warnOnFailureIfImplemented (editController->setComponentState (&stream)); } void grabInformationObjects() diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h index f80363ff1c..13e963adea 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h @@ -41,7 +41,7 @@ public: VST3PluginFormat(); /** Destructor */ - ~VST3PluginFormat(); + ~VST3PluginFormat() override; //============================================================================== /** Attempts to reload a VST3 plugin's state from some preset file data. diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 687d8f0bb6..5bd3a39fc0 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -36,6 +36,12 @@ #define __cdecl #endif +#if JUCE_CLANG + #if __has_warning("-Wzero-as-null-pointer-constant") + #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" + #endif +#endif + #define VST_FORCE_DEPRECATED 0 #define JUCE_VSTINTERFACE_H_INCLUDED 1 @@ -207,7 +213,7 @@ namespace #if JUCE_MAC static bool makeFSRefFromPath (FSRef* destFSRef, const String& path) { - return FSPathMakeRef (reinterpret_cast (path.toRawUTF8()), destFSRef, 0) == noErr; + return FSPathMakeRef (reinterpret_cast (path.toRawUTF8()), destFSRef, nullptr) == noErr; } #endif } @@ -630,7 +636,7 @@ struct ModuleHandle : public ReferenceCountedObject #elif JUCE_MAC FSRef ref; makeFSRefFromPath (&ref, f.getParentDirectory().getFullPathName()); - FSGetCatalogInfo (&ref, kFSCatInfoNone, 0, 0, &parentDirFSSpec, 0); + FSGetCatalogInfo (&ref, kFSCatInfoNone, nullptr, nullptr, &parentDirFSSpec, nullptr); #endif } @@ -730,13 +736,13 @@ struct ModuleHandle : public ReferenceCountedObject { auto* utf8 = file.getFullPathName().toRawUTF8(); - if (CFURLRef url = CFURLCreateFromFileSystemRepresentation (0, (const UInt8*) utf8, + if (CFURLRef url = CFURLCreateFromFileSystemRepresentation (nullptr, (const UInt8*) utf8, (CFIndex) strlen (utf8), file.isDirectory())) { bundleRef = CFBundleCreate (kCFAllocatorDefault, url); CFRelease (url); - if (bundleRef != 0) + if (bundleRef != nullptr) { if (CFBundleLoadExecutable (bundleRef)) { @@ -785,7 +791,7 @@ struct ModuleHandle : public ReferenceCountedObject { CFBundleUnloadExecutable (bundleRef); CFRelease (bundleRef); - bundleRef = 0; + bundleRef = nullptr; } } } @@ -796,7 +802,7 @@ struct ModuleHandle : public ReferenceCountedObject void close() { - if (bundleRef != 0) + if (bundleRef != nullptr) { #if JUCE_MAC CFBundleCloseBundleResourceMap (bundleRef, resFileId); @@ -812,7 +818,7 @@ struct ModuleHandle : public ReferenceCountedObject void closeEffect (Vst2::AEffect* eff) { - eff->dispatcher (eff, Vst2::effClose, 0, 0, 0, 0); + eff->dispatcher (eff, Vst2::effClose, 0, 0, nullptr, 0); } #endif @@ -1006,7 +1012,7 @@ struct VSTPluginInstance : public AudioPluginInstance, Array shortParamNames; float defaultValue = 0; String label; - bool isAutomatable = dispatch (Vst2::effCanBeAutomated, i, 0, 0, 0) != 0; + bool isAutomatable = dispatch (Vst2::effCanBeAutomated, i, 0, nullptr, 0) != 0; bool isDiscrete = false; int numSteps = AudioProcessor::getDefaultNumParameterSteps(); bool isBoolSwitch = false; @@ -1081,7 +1087,7 @@ struct VSTPluginInstance : public AudioPluginInstance, setRateAndBufferSizeDetails (sampleRateToUse, blockSizeToUse); } - ~VSTPluginInstance() + ~VSTPluginInstance() override { if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */) { @@ -1143,14 +1149,14 @@ struct VSTPluginInstance : public AudioPluginInstance, { newEffect->resvd2 = 0; - newEffect->dispatcher (newEffect, Vst2::effIdentify, 0, 0, 0, 0); + newEffect->dispatcher (newEffect, Vst2::effIdentify, 0, 0, nullptr, 0); auto blockSize = jmax (32, initialBlockSize); - newEffect->dispatcher (newEffect, Vst2::effSetSampleRate, 0, 0, 0, static_cast (initialSampleRate)); - newEffect->dispatcher (newEffect, Vst2::effSetBlockSize, 0, blockSize, 0, 0); + newEffect->dispatcher (newEffect, Vst2::effSetSampleRate, 0, 0, nullptr, static_cast (initialSampleRate)); + newEffect->dispatcher (newEffect, Vst2::effSetBlockSize, 0, blockSize, nullptr, 0); - newEffect->dispatcher (newEffect, Vst2::effOpen, 0, 0, 0, 0); + newEffect->dispatcher (newEffect, Vst2::effOpen, 0, 0, nullptr, 0); BusesProperties ioConfig = queryBusIO (newEffect); return new VSTPluginInstance (newModule, ioConfig, newEffect, initialSampleRate, blockSize); @@ -1223,25 +1229,25 @@ struct VSTPluginInstance : public AudioPluginInstance, setRateAndBufferSizeDetails (initialSampleRate, initialBlockSize); - dispatch (Vst2::effIdentify, 0, 0, 0, 0); + dispatch (Vst2::effIdentify, 0, 0, nullptr, 0); if (getSampleRate() > 0) - dispatch (Vst2::effSetSampleRate, 0, 0, 0, (float) getSampleRate()); + dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) getSampleRate()); if (getBlockSize() > 0) - dispatch (Vst2::effSetBlockSize, 0, jmax (32, getBlockSize()), 0, 0); + dispatch (Vst2::effSetBlockSize, 0, jmax (32, getBlockSize()), nullptr, 0); - dispatch (Vst2::effOpen, 0, 0, 0, 0); + dispatch (Vst2::effOpen, 0, 0, nullptr, 0); setRateAndBufferSizeDetails (getSampleRate(), getBlockSize()); if (getNumPrograms() > 1) setCurrentProgram (0); else - dispatch (Vst2::effSetProgram, 0, 0, 0, 0); + dispatch (Vst2::effSetProgram, 0, 0, nullptr, 0); - for (int i = vstEffect->numInputs; --i >= 0;) dispatch (Vst2::effConnectInput, i, 1, 0, 0); - for (int i = vstEffect->numOutputs; --i >= 0;) dispatch (Vst2::effConnectOutput, i, 1, 0, 0); + for (int i = vstEffect->numInputs; --i >= 0;) dispatch (Vst2::effConnectInput, i, 1, nullptr, 0); + for (int i = vstEffect->numOutputs; --i >= 0;) dispatch (Vst2::effConnectOutput, i, 1, nullptr, 0); if (getVstCategory() != Vst2::kPlugCategShell) // (workaround for Waves 5 plugins which crash during this call) updateStoredProgramNames(); @@ -1293,7 +1299,7 @@ struct VSTPluginInstance : public AudioPluginInstance, if ((vstEffect->flags & Vst2::effFlagsNoSoundInStop) != 0) return 0.0; - auto tailSize = dispatch (Vst2::effGetTailSize, 0, 0, 0, 0); + auto tailSize = dispatch (Vst2::effGetTailSize, 0, 0, nullptr, 0); auto sampleRate = getSampleRate(); // remain backward compatible with old JUCE plug-ins: anything larger @@ -1313,7 +1319,7 @@ struct VSTPluginInstance : public AudioPluginInstance, bool producesMidi() const override { return pluginCanDo ("sendVstMidiEvent") > 0; } bool supportsMPE() const override { return pluginCanDo ("MPE") > 0; } - Vst2::VstPlugCategory getVstCategory() const noexcept { return (Vst2::VstPlugCategory) dispatch (Vst2::effGetPlugCategory, 0, 0, 0, 0); } + Vst2::VstPlugCategory getVstCategory() const noexcept { return (Vst2::VstPlugCategory) dispatch (Vst2::effGetPlugCategory, 0, 0, nullptr, 0); } int pluginCanDo (const char* text) const { return (int) dispatch (Vst2::effCanDo, 0, 0, (void*) text, 0); } @@ -1355,15 +1361,15 @@ struct VSTPluginInstance : public AudioPluginInstance, incomingMidi.clear(); - dispatch (Vst2::effSetSampleRate, 0, 0, 0, (float) rate); - dispatch (Vst2::effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), 0, 0); + dispatch (Vst2::effSetSampleRate, 0, 0, nullptr, (float) rate); + dispatch (Vst2::effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), nullptr, 0); if (supportsDoublePrecisionProcessing()) { int32 vstPrecision = isUsingDoublePrecision() ? Vst2::kVstProcessPrecision64 : Vst2::kVstProcessPrecision32; - dispatch (Vst2::effSetProcessPrecision, 0, (pointer_sized_int) vstPrecision, 0, 0); + dispatch (Vst2::effSetProcessPrecision, 0, (pointer_sized_int) vstPrecision, nullptr, 0); } auto maxChannels = jmax (1, jmax (vstEffect->numInputs, vstEffect->numOutputs)); @@ -1390,7 +1396,7 @@ struct VSTPluginInstance : public AudioPluginInstance, } } - dispatch (Vst2::effStartProcess, 0, 0, 0, 0); + dispatch (Vst2::effStartProcess, 0, 0, nullptr, 0); setLatencySamples (vstEffect->initialDelay); } @@ -1400,7 +1406,7 @@ struct VSTPluginInstance : public AudioPluginInstance, { if (initialised) { - dispatch (Vst2::effStopProcess, 0, 0, 0, 0); + dispatch (Vst2::effStopProcess, 0, 0, nullptr, 0); setPower (false); } @@ -1544,12 +1550,12 @@ struct VSTPluginInstance : public AudioPluginInstance, int getNumPrograms() override { return vstEffect != nullptr ? jmax (0, vstEffect->numPrograms) : 0; } // NB: some plugs return negative numbers from this function. - int getCurrentProgram() override { return (int) dispatch (Vst2::effGetProgram, 0, 0, 0, 0); } + int getCurrentProgram() override { return (int) dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); } void setCurrentProgram (int newIndex) override { if (getNumPrograms() > 0 && newIndex != getCurrentProgram()) - dispatch (Vst2::effSetProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), 0, 0); + dispatch (Vst2::effSetProgram, 0, jlimit (0, getNumPrograms() - 1, newIndex), nullptr, 0); } const String getProgramName (int index) override @@ -1594,7 +1600,7 @@ struct VSTPluginInstance : public AudioPluginInstance, //============================================================================== void timerCallback() override { - if (dispatch (Vst2::effIdle, 0, 0, 0, 0) == 0) + if (dispatch (Vst2::effIdle, 0, 0, nullptr, 0) == 0) stopTimer(); } @@ -1979,8 +1985,8 @@ private: { VST2BypassParameter (VSTPluginInstance& effectToUse) : parent (effectToUse), - onStrings (TRANS("on"), TRANS("yes"), TRANS("true")), - offStrings (TRANS("off"), TRANS("no"), TRANS("false")), + vstOnStrings (TRANS("on"), TRANS("yes"), TRANS("true")), + vstOffStrings (TRANS("off"), TRANS("no"), TRANS("false")), values (TRANS("Off"), TRANS("On")) { } @@ -1997,11 +2003,11 @@ private: { String lowercaseText (text.toLowerCase()); - for (auto& testText : onStrings) + for (auto& testText : vstOnStrings) if (lowercaseText == testText) return 1.0f; - for (auto& testText : offStrings) + for (auto& testText : vstOffStrings) if (lowercaseText == testText) return 0.0f; @@ -2021,7 +2027,7 @@ private: VSTPluginInstance& parent; bool currentValue = false; - StringArray onStrings, offStrings, values; + StringArray vstOnStrings, vstOffStrings, values; }; //============================================================================== @@ -2098,7 +2104,7 @@ private: #if JUCE_MAC if (getActiveEditor() != nullptr) - dispatch (Vst2::effEditIdle, 0, 0, 0, 0); + dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0); #endif Timer::callPendingTimersSynchronously(); @@ -2629,7 +2635,7 @@ private: String getVersion() const { - auto v = (unsigned int) dispatch (Vst2::effGetVendorVersion, 0, 0, 0, 0); + auto v = (unsigned int) dispatch (Vst2::effGetVendorVersion, 0, 0, nullptr, 0); String s; @@ -2702,7 +2708,7 @@ private: void setPower (const bool on) { - dispatch (Vst2::effMainsChanged, 0, on ? 1 : 0, 0, 0); + dispatch (Vst2::effMainsChanged, 0, on ? 1 : 0, nullptr, 0); isPowerOn = on; } @@ -2775,7 +2781,7 @@ public: setVisible (true); } - ~VSTPluginWindow() + ~VSTPluginWindow() override { closePluginWindow(); @@ -2958,7 +2964,7 @@ public: if (! reentrantGuard) { reentrantGuard = true; - plugin.dispatch (Vst2::effEditIdle, 0, 0, 0, 0); + plugin.dispatch (Vst2::effEditIdle, 0, 0, nullptr, 0); reentrantGuard = false; } @@ -2990,7 +2996,7 @@ public: activeVSTWindows.add (this); #if JUCE_MAC - dispatch (Vst2::effEditTop, 0, 0, 0, 0); + dispatch (Vst2::effEditTop, 0, 0, nullptr, 0); #endif } @@ -3034,7 +3040,7 @@ private: #if JUCE_MAC void openPluginWindow (void* parentWindow) { - if (isOpen || parentWindow == 0) + if (isOpen || parentWindow == nullptr) return; isOpen = true; @@ -3045,10 +3051,10 @@ private: // do this before and after like in the steinberg example dispatch (Vst2::effEditGetRect, 0, 0, &rect, 0); - dispatch (Vst2::effGetProgram, 0, 0, 0, 0); // also in steinberg code + dispatch (Vst2::effGetProgram, 0, 0, nullptr, 0); // also in steinberg code // Install keyboard hooks - pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, 0, 0) == 0); + pluginWantsKeys = (dispatch (Vst2::effKeysRequired, 0, 0, nullptr, 0) == 0); // double-check it's not too tiny int w = 250, h = 150; @@ -3224,7 +3230,7 @@ private: JUCE_VST_LOG ("Closing VST UI: " + plugin.getName()); isOpen = false; - dispatch (Vst2::effEditClose, 0, 0, 0, 0); + dispatch (Vst2::effEditClose, 0, 0, nullptr, 0); stopTimer(); #if JUCE_WINDOWS @@ -3513,7 +3519,7 @@ void VSTPluginFormat::findAllTypesForFile (OwnedArray& result // Normal plugin... results.add (new PluginDescription (desc)); - instance->dispatch (Vst2::effOpen, 0, 0, 0, 0); + instance->dispatch (Vst2::effOpen, 0, 0, nullptr, 0); } else { diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h index 2c6684c869..20f5fe20d8 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h @@ -40,7 +40,7 @@ class JUCE_API VSTPluginFormat : public AudioPluginFormat public: //============================================================================== VSTPluginFormat(); - ~VSTPluginFormat(); + ~VSTPluginFormat() override; //============================================================================== /** Attempts to retrieve the VSTXML data from a plugin. diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp index fd708dad19..5378231dfd 100644 --- a/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/modules/juce_audio_processors/juce_audio_processors.cpp @@ -133,6 +133,9 @@ struct AutoResizingNSViewComponentWithParent : public AutoResizingNSViewCompone #if JUCE_CLANG #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #if __has_warning("-Wcast-align") + #pragma clang diagnostic ignored "-Wcast-align" + #endif #endif #include "format/juce_AudioPluginFormat.cpp" diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index 797207633f..0730ba1201 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -692,7 +692,7 @@ public: DelegateClass::setState (delegate, this); } - ~URLConnectionState() + ~URLConnectionState() override { stop(); diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index e41a6b471f..9b22cfd022 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -85,7 +85,7 @@ public: nativeContext.reset(); } - ~CachedImage() + ~CachedImage() override { stop(); } @@ -671,7 +671,7 @@ public: attach(); } - ~Attachment() + ~Attachment() override { detach(); }