Browse Source

CMake: Add Wpedantic as a recommended warning flag

tags/2021-05-28
reuk 5 years ago
parent
commit
0e9fb915fa
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
5 changed files with 18 additions and 10 deletions
  1. +2
    -2
      extras/Build/CMake/JUCEHelperTargets.cmake
  2. +6
    -1
      modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp
  3. +3
    -1
      modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm
  4. +2
    -1
      modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm
  5. +5
    -5
      modules/juce_core/system/juce_CompilerWarnings.h

+ 2
- 2
extras/Build/CMake/JUCEHelperTargets.cmake View File

@@ -13,7 +13,7 @@ elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQU
-Wzero-as-null-pointer-constant -Wcast-align
-Winconsistent-missing-destructor-override -Wshift-sign-overflow
-Wnullable-to-nonnull-conversion -Wno-missing-field-initializers
-Wno-ignored-qualifiers -Wswitch-enum)
-Wno-ignored-qualifiers -Wswitch-enum -Wpedantic)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(juce_recommended_warning_flags INTERFACE
-Wall -Wextra -Wstrict-aliasing -Wuninitialized -Wunused-parameter
@@ -21,7 +21,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align
-Wno-implicit-fallthrough -Wno-maybe-uninitialized
-Wno-missing-field-initializers -Wno-ignored-qualifiers -Wswitch-enum
-Wredundant-decls)
-Wredundant-decls -Wpedantic)

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0")
target_compile_options(juce_recommended_warning_flags INTERFACE "-Wno-strict-overflow")


+ 6
- 1
modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp View File

@@ -35,7 +35,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnon-virtual-dtor",
"-Wshift-sign-overflow",
"-Wpragma-pack",
"-Wzero-as-null-pointer-constant",
"-Winconsistent-missing-destructor-override")
"-Winconsistent-missing-destructor-override",
"-Wfour-char-constants")
#include <AAX_Version.h>
@@ -72,6 +73,8 @@ static_assert (AAX_SDK_CURRENT_REVISION >= AAX_SDK_2p3p0_REVISION, "JUCE require
JUCE_END_IGNORE_WARNINGS_MSVC
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wfour-char-constants")
#if JUCE_WINDOWS
#ifndef JucePlugin_AAXLibs_path
#error "You need to define the JucePlugin_AAXLibs_path macro. (This is best done via the Projucer)"
@@ -2344,6 +2347,8 @@ AAX_Result JUCE_CDECL GetEffectDescriptions (AAX_ICollection* collection)
return AAX_ERROR_NULL_OBJECT;
}
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
//==============================================================================
#if _MSC_VER || JUCE_MINGW
extern "C" BOOL WINAPI DllMain (HINSTANCE instance, DWORD reason, LPVOID) { if (reason == DLL_PROCESS_ATTACH) Process::setCurrentModuleInstanceHandle (instance); return true; }


+ 3
- 1
modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm View File

@@ -36,7 +36,9 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wshorten-64-to-32",
"-Wshadow",
"-Wswitch-enum",
"-Wzero-as-null-pointer-constant",
"-Wnullable-to-nonnull-conversion")
"-Wnullable-to-nonnull-conversion",
"-Wgnu-zero-variadic-macro-arguments",
"-Wformat-pedantic")
#include "../utility/juce_IncludeSystemHeaders.h"


+ 2
- 1
modules/juce_audio_plugin_client/juce_audio_plugin_client_AU_2.mm View File

@@ -34,7 +34,8 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wparentheses",
"-Wswitch-enum",
"-Wzero-as-null-pointer-constant",
"-Wnullable-to-nonnull-conversion",
"-Wignored-qualifiers")
"-Wignored-qualifiers",
"-Wfour-char-constants")
// 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


+ 5
- 5
modules/juce_core/system/juce_CompilerWarnings.h View File

@@ -77,7 +77,7 @@
/** Apply the macro FN to each of the other arguments. */
#define JUCE_EACH(FN, ...) \
JUCE_NTH_ARG_(, ##__VA_ARGS__, \
JUCE_NTH_ARG_(, __VA_ARGS__, \
JUCE_EACH_39_, \
JUCE_EACH_38_, \
JUCE_EACH_37_, \
@@ -118,7 +118,7 @@
JUCE_EACH_02_, \
JUCE_EACH_01_, \
JUCE_EACH_00_) \
(FN, ##__VA_ARGS__)
(FN, __VA_ARGS__)
/** Concatenate two tokens to form a new token. */
#define JUCE_CONCAT_(a, b) a##b
@@ -148,7 +148,7 @@
#define JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, ...) \
_Pragma(JUCE_TO_STRING(compiler diagnostic push)) \
JUCE_EACH(JUCE_CONCAT(JUCE_IGNORE_, compiler), ##__VA_ARGS__)
JUCE_EACH(JUCE_CONCAT(JUCE_IGNORE_, compiler), __VA_ARGS__)
/** Push a new warning scope, and then ignore each warning for either clang
or gcc. If the compiler doesn't support __has_warning, we add -Wpragmas
@@ -157,10 +157,10 @@
*/
#if defined (__has_warning)
#define JUCE_PUSH_WARNINGS_GCC_LIKE(compiler, ...) \
JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, ##__VA_ARGS__)
JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, __VA_ARGS__)
#else
#define JUCE_PUSH_WARNINGS_GCC_LIKE(compiler, ...) \
JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, "-Wpragmas", ##__VA_ARGS__)
JUCE_IGNORE_WARNINGS_GCC_LIKE(compiler, "-Wpragmas", __VA_ARGS__)
#endif
/** Pop the current warning scope. */


Loading…
Cancel
Save