From 333f98d2046c171d7d02cfdfb1be4e27c035a99c Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 27 Aug 2020 14:13:58 +0100 Subject: [PATCH] Squashed some compiler warnings with -Wmissing-prototypes enabled --- examples/DemoRunner/Source/Demos/JUCEDemos.cpp | 4 ---- examples/DemoRunner/Source/Demos/JUCEDemos.h | 3 +++ .../juce_build_tools/utils/juce_Icons.cpp | 4 ++-- .../Source/Application/jucer_Application.cpp | 6 +++--- .../Source/Application/jucer_AutoUpdater.cpp | 2 +- .../UI/jucer_JucerDocumentEditor.cpp | 2 ++ .../Utility/Helpers/jucer_MiscUtilities.cpp | 8 ++++---- .../codecs/juce_OggVorbisAudioFormat.cpp | 3 ++- .../VST3/juce_VST3_Wrapper.cpp | 15 +++++++++++---- .../juce_audio_plugin_client.h | 1 + .../juce_audio_plugin_client_AU_2.mm | 3 ++- .../utility/juce_CreatePluginFilter.h | 2 -- .../format_types/juce_AudioUnitPluginFormat.mm | 18 +++++++++--------- .../format_types/juce_VST3Headers.h | 3 ++- .../juce_core/containers/juce_ArrayBase.cpp | 8 ++++---- .../juce_MultiChoicePropertyComponent.cpp | 2 +- .../native/juce_mac_WebBrowserComponent.mm | 2 +- 17 files changed, 48 insertions(+), 38 deletions(-) diff --git a/examples/DemoRunner/Source/Demos/JUCEDemos.cpp b/examples/DemoRunner/Source/Demos/JUCEDemos.cpp index 297cba70dd..3fbd5834f3 100644 --- a/examples/DemoRunner/Source/Demos/JUCEDemos.cpp +++ b/examples/DemoRunner/Source/Demos/JUCEDemos.cpp @@ -169,10 +169,6 @@ AudioDeviceManager& getSharedAudioDeviceManager (int numInputChannels, int numOu } //============================================================================== -// need to split this into two files otherwise VS will fall over -void registerDemos_One() noexcept; -void registerDemos_Two() noexcept; - void registerAllDemos() noexcept { registerDemos_One(); diff --git a/examples/DemoRunner/Source/Demos/JUCEDemos.h b/examples/DemoRunner/Source/Demos/JUCEDemos.h index 2e9f065e2e..4faf1c6107 100644 --- a/examples/DemoRunner/Source/Demos/JUCEDemos.h +++ b/examples/DemoRunner/Source/Demos/JUCEDemos.h @@ -57,6 +57,9 @@ struct JUCEDemos static File findExamplesDirectoryFromExecutable (File exec); }; +void registerDemos_One() noexcept; +void registerDemos_Two() noexcept; + //============================================================================== // used by child-process demo bool invokeChildProcessDemo (const String& commandLine); diff --git a/extras/Build/juce_build_tools/utils/juce_Icons.cpp b/extras/Build/juce_build_tools/utils/juce_Icons.cpp index d043dc3d55..c0e51acc81 100644 --- a/extras/Build/juce_build_tools/utils/juce_Icons.cpp +++ b/extras/Build/juce_build_tools/utils/juce_Icons.cpp @@ -78,7 +78,7 @@ namespace build_tools } } // namespace mac - void writeMacIcon (const Icons& icons, OutputStream& out) + static void writeMacIcon (const Icons& icons, OutputStream& out) { MemoryOutputStream data; auto smallest = std::numeric_limits::max(); @@ -269,7 +269,7 @@ namespace build_tools } } // namespace win - void writeWinIcon (const Icons& icons, OutputStream& os) + static void writeWinIcon (const Icons& icons, OutputStream& os) { Array images; int sizes[] = { 16, 32, 48, 256 }; diff --git a/extras/Projucer/Source/Application/jucer_Application.cpp b/extras/Projucer/Source/Application/jucer_Application.cpp index ec06756dae..adb518bbf1 100644 --- a/extras/Projucer/Source/Application/jucer_Application.cpp +++ b/extras/Projucer/Source/Application/jucer_Application.cpp @@ -1452,7 +1452,7 @@ void ProjucerApplication::initCommandManager() registerGUIEditorCommands(); } -void rescanModules (AvailableModulesList& list, const Array& paths, bool async) +static void rescanModules (AvailableModulesList& list, const Array& paths, bool async) { if (async) list.scanPathsAsync (paths); @@ -1556,13 +1556,13 @@ void ProjucerApplication::setEditorColourScheme (int index, bool saveSetting) getCommandManager().commandStatusChanged(); } -bool isEditorColourSchemeADefaultScheme (const StringArray& schemes, int editorColourSchemeIndex) +static bool isEditorColourSchemeADefaultScheme (const StringArray& schemes, int editorColourSchemeIndex) { auto& schemeName = schemes[editorColourSchemeIndex]; return (schemeName == "Default (Dark)" || schemeName == "Default (Light)"); } -int getEditorColourSchemeForGUIColourScheme (const StringArray& schemes, int guiColourSchemeIndex) +static int getEditorColourSchemeForGUIColourScheme (const StringArray& schemes, int guiColourSchemeIndex) { auto defaultDarkEditorIndex = schemes.indexOf ("Default (Dark)"); auto defaultLightEditorIndex = schemes.indexOf ("Default (Light)"); diff --git a/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp b/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp index 5033b110c0..d1720105b7 100644 --- a/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp +++ b/extras/Projucer/Source/Application/jucer_AutoUpdater.cpp @@ -499,7 +499,7 @@ private: std::function completionCallback; }; -void restartProcess (const File& targetFolder) +static void restartProcess (const File& targetFolder) { #if JUCE_MAC || JUCE_LINUX #if JUCE_MAC diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp index 29a918ecfd..7faa74bc37 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp @@ -1217,6 +1217,7 @@ Image JucerDocumentEditor::createComponentLayerSnapshot() const const int gridSnapMenuItemBase = 0x8723620; const int snapSizes[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32 }; +PopupMenu createGUIEditorMenu(); PopupMenu createGUIEditorMenu() { PopupMenu menu; @@ -1293,6 +1294,7 @@ PopupMenu createGUIEditorMenu() menu.addSubMenu ("Component Overlay", overlays, holder != nullptr); } + return menu; } diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.cpp b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.cpp index bc56b55530..599ce4499d 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.cpp +++ b/extras/Projucer/Source/Utility/Helpers/jucer_MiscUtilities.cpp @@ -366,7 +366,7 @@ bool isJUCEModulesFolder (const File& f) } //============================================================================== -bool isDivider (const String& line) +static bool isDivider (const String& line) { auto afterIndent = line.trim(); @@ -385,7 +385,7 @@ bool isDivider (const String& line) return false; } -int getIndexOfCommentBlockStart (const StringArray& lines, int endIndex) +static int getIndexOfCommentBlockStart (const StringArray& lines, int endIndex) { auto endLine = lines[endIndex]; @@ -431,7 +431,7 @@ int findBestLineToScrollToForClass (StringArray lines, const String& className, } //============================================================================== -var parseJUCEHeaderMetadata (const StringArray& lines) +static var parseJUCEHeaderMetadata (const StringArray& lines) { auto* o = new DynamicObject(); var result (o); @@ -454,7 +454,7 @@ var parseJUCEHeaderMetadata (const StringArray& lines) return result; } -String parseMetadataItem (const StringArray& lines, int& index) +static String parseMetadataItem (const StringArray& lines, int& index) { String result = lines[index++]; diff --git a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp index c40e89172c..d103dba285 100644 --- a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp @@ -47,7 +47,8 @@ namespace OggVorbisNamespace "-Wsign-conversion", "-Wswitch-default", "-Wredundant-decls", - "-Wmisleading-indentation") + "-Wmisleading-indentation", + "-Wmissing-prototypes") #include "oggvorbis/vorbisenc.h" #include "oggvorbis/codec.h" 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 d9c9815a87..f0b9ac886d 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -2975,6 +2975,7 @@ JUCE_END_IGNORE_WARNINGS_MSVC JUCE_END_IGNORE_WARNINGS_GCC_LIKE //============================================================================== +bool initModule(); bool initModule() { #if JUCE_MAC @@ -2984,6 +2985,7 @@ bool initModule() return true; } +bool shutdownModule(); bool shutdownModule() { return true; @@ -2992,17 +2994,19 @@ bool shutdownModule() #undef JUCE_EXPORTED_FUNCTION #if JUCE_WINDOWS - extern "C" __declspec (dllexport) bool InitDll() { return initModule(); } - extern "C" __declspec (dllexport) bool ExitDll() { return shutdownModule(); } #define JUCE_EXPORTED_FUNCTION #else - #define JUCE_EXPORTED_FUNCTION extern "C" __attribute__ ((visibility ("default"))) + #define JUCE_EXPORTED_FUNCTION extern "C" __attribute__ ((visibility("default"))) #endif -#if JUCE_LINUX +#if JUCE_WINDOWS + extern "C" __declspec (dllexport) bool InitDll() { return initModule(); } + extern "C" __declspec (dllexport) bool ExitDll() { return shutdownModule(); } +#elif JUCE_LINUX void* moduleHandle = nullptr; int moduleEntryCounter = 0; + JUCE_EXPORTED_FUNCTION bool ModuleEntry (void* sharedLibraryHandle); JUCE_EXPORTED_FUNCTION bool ModuleEntry (void* sharedLibraryHandle) { if (++moduleEntryCounter == 1) @@ -3014,6 +3018,7 @@ bool shutdownModule() return true; } + JUCE_EXPORTED_FUNCTION bool ModuleExit(); JUCE_EXPORTED_FUNCTION bool ModuleExit() { if (--moduleEntryCounter == 0) @@ -3033,6 +3038,7 @@ bool shutdownModule() char modulePath[MaxPathLength] = { 0 }; void* moduleHandle = nullptr; + JUCE_EXPORTED_FUNCTION bool bundleEntry (CFBundleRef ref); JUCE_EXPORTED_FUNCTION bool bundleEntry (CFBundleRef ref) { if (ref != nullptr) @@ -3056,6 +3062,7 @@ bool shutdownModule() return initModule(); } + JUCE_EXPORTED_FUNCTION bool bundleExit(); JUCE_EXPORTED_FUNCTION bool bundleExit() { if (shutdownModule()) diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client.h b/modules/juce_audio_plugin_client/juce_audio_plugin_client.h index 10636c3cbf..96f3210a00 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client.h +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client.h @@ -127,4 +127,5 @@ #endif #include "utility/juce_PluginHostType.h" +#include "utility/juce_CreatePluginFilter.h" #include "VST/juce_VSTCallbackHandler.h" diff --git a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm index 1ca32a918c..c068f7b126 100644 --- a/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm +++ b/modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm @@ -43,7 +43,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wparentheses", "-Wzero-as-null-pointer-constant", "-Wnullable-to-nonnull-conversion", "-Wignored-qualifiers", - "-Wfour-char-constants") + "-Wfour-char-constants", + "-Wmissing-prototypes") // From MacOS 10.13 and iOS 11 Apple has (sensibly!) stopped defining a whole // set of functions with rather generic names. However, we still need a couple diff --git a/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h b/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h index 860ec61e47..0722f52da6 100644 --- a/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h +++ b/modules/juce_audio_plugin_client/utility/juce_CreatePluginFilter.h @@ -25,8 +25,6 @@ #pragma once -#include - /** Somewhere in the codebase of your plugin, you need to implement this function and make it return a new instance of the filter subclass that you're building. */ diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index ec3efa2c53..5d8eef9361 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -74,7 +74,7 @@ namespace AudioUnitFormatHelpers static ThreadLocalValue insideCallback; #endif - String osTypeToString (OSType type) noexcept + static String osTypeToString (OSType type) noexcept { const juce_wchar s[4] = { (juce_wchar) ((type >> 24) & 0xff), (juce_wchar) ((type >> 16) & 0xff), @@ -83,7 +83,7 @@ namespace AudioUnitFormatHelpers return String (s, 4); } - OSType stringToOSType (String s) + static OSType stringToOSType (String s) { if (s.trim().length() >= 4) // (to avoid trimming leading spaces) s = s.trim(); @@ -98,7 +98,7 @@ namespace AudioUnitFormatHelpers static const char* auIdentifierPrefix = "AudioUnit:"; - String createPluginIdentifier (const AudioComponentDescription& desc) + static String createPluginIdentifier (const AudioComponentDescription& desc) { String s (auIdentifierPrefix); @@ -123,7 +123,7 @@ namespace AudioUnitFormatHelpers return s; } - void getNameAndManufacturer (AudioComponent comp, String& name, String& manufacturer) + static void getNameAndManufacturer (AudioComponent comp, String& name, String& manufacturer) { CFStringRef cfName; if (AudioComponentCopyName (comp, &cfName) == noErr) @@ -142,8 +142,8 @@ namespace AudioUnitFormatHelpers name = ""; } - bool getComponentDescFromIdentifier (const String& fileOrIdentifier, AudioComponentDescription& desc, - String& name, String& version, String& manufacturer) + static bool getComponentDescFromIdentifier (const String& fileOrIdentifier, AudioComponentDescription& desc, + String& name, String& version, String& manufacturer) { if (fileOrIdentifier.startsWithIgnoreCase (auIdentifierPrefix)) { @@ -188,8 +188,8 @@ namespace AudioUnitFormatHelpers return false; } - bool getComponentDescFromFile (const String& fileOrIdentifier, AudioComponentDescription& desc, - String& name, String& version, String& manufacturer) + static bool getComponentDescFromFile (const String& fileOrIdentifier, AudioComponentDescription& desc, + String& name, String& version, String& manufacturer) { zerostruct (desc); @@ -291,7 +291,7 @@ namespace AudioUnitFormatHelpers #endif } - const char* getCategory (OSType type) noexcept + static const char* getCategory (OSType type) noexcept { switch (type) { diff --git a/modules/juce_audio_processors/format_types/juce_VST3Headers.h b/modules/juce_audio_processors/format_types/juce_VST3Headers.h index 586c0e249b..2fd842e295 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3Headers.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Headers.h @@ -55,7 +55,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnon-virtual-dtor", "-Wformat", "-Wpedantic", "-Wextra", - "-Wclass-memaccess") + "-Wclass-memaccess", + "-Wmissing-prototypes") #undef DEVELOPMENT #define DEVELOPMENT 0 // This avoids a Clang warning in Steinberg code about unused values diff --git a/modules/juce_core/containers/juce_ArrayBase.cpp b/modules/juce_core/containers/juce_ArrayBase.cpp index 8e7a9189fe..0ddd9b4849 100644 --- a/modules/juce_core/containers/juce_ArrayBase.cpp +++ b/modules/juce_core/containers/juce_ArrayBase.cpp @@ -87,14 +87,14 @@ namespace ArrayBaseTestsHelpers }; } -bool operator== (const ArrayBaseTestsHelpers::TriviallyCopyableType& tct, - const ArrayBaseTestsHelpers::NonTriviallyCopyableType& ntct) +static bool operator== (const ArrayBaseTestsHelpers::TriviallyCopyableType& tct, + const ArrayBaseTestsHelpers::NonTriviallyCopyableType& ntct) { return tct.getValue() == ntct.getValue(); } -bool operator== (const ArrayBaseTestsHelpers::NonTriviallyCopyableType& ntct, - const ArrayBaseTestsHelpers::TriviallyCopyableType& tct) +static bool operator== (const ArrayBaseTestsHelpers::NonTriviallyCopyableType& ntct, + const ArrayBaseTestsHelpers::TriviallyCopyableType& tct) { return tct == ntct; } diff --git a/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp b/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp index 6bcee0ea5c..d0a2785f18 100644 --- a/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp +++ b/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp @@ -42,7 +42,7 @@ public: } }; -void updateButtonTickColour (ToggleButton* button, bool usingDefault) +static void updateButtonTickColour (ToggleButton* button, bool usingDefault) { button->setColour (ToggleButton::tickColourId, button->getLookAndFeel().findColour (ToggleButton::tickColourId) .withAlpha (usingDefault ? 0.4f : 1.0f)); diff --git a/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm b/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm index f25609845e..13d21c9a9f 100644 --- a/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm +++ b/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm @@ -36,7 +36,7 @@ namespace juce #endif -NSMutableURLRequest* getRequestForURL (const String& url, const StringArray* headers, const MemoryBlock* postData) +static NSMutableURLRequest* getRequestForURL (const String& url, const StringArray* headers, const MemoryBlock* postData) { NSString* urlString = juceStringToNS (url);