From 445a56f6d576f1d5bd3f61fd5e722722b563ee74 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 25 Nov 2022 07:05:28 -0500 Subject: Trim redundant warning flags enabled by -Wextra and -Wpedantic --- meson.build | 1 + meson/suppressions/meson.build | 13 +++++++++++-- meson/warnings/meson.build | 20 -------------------- test/headers/meson.build | 7 ++++++- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/meson.build b/meson.build index 8f3c2876..8c3db730 100644 --- a/meson.build +++ b/meson.build @@ -8,6 +8,7 @@ project('serd', ['c'], default_options: [ 'b_ndebug=if-release', 'buildtype=release', + 'warning_level=3', 'c_std=c99', ]) diff --git a/meson/suppressions/meson.build b/meson/suppressions/meson.build index f722ebe0..098f7ab5 100644 --- a/meson/suppressions/meson.build +++ b/meson/suppressions/meson.build @@ -60,16 +60,25 @@ if is_variable('cc') '/wd4061', # enumerator in switch is not explicitly handled '/wd4365', # signed/unsigned mismatch '/wd4514', # unreferenced inline function has been removed - '/wd4706', # assignment within conditional expression '/wd4710', # function not inlined '/wd4711', # function selected for automatic inline expansion '/wd4800', # implicit conversion from int to bool '/wd4820', # padding added after construct - '/wd4996', # POSIX name for this item is deprecated '/wd5045', # will insert Spectre mitigation for memory load ] endif endif + if cc.get_id() == 'clang' + c_suppressions += [ + '-Wno-nullability-extension', + ] + elif cc.get_id() == 'msvc' + c_suppressions += [ + '/wd4706', # assignment within conditional expression + '/wd4996', # POSIX name for this item is deprecated + ] + endif + c_suppressions = cc.get_supported_arguments(c_suppressions) endif diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build index 80d57749..c0e523b9 100644 --- a/meson/warnings/meson.build +++ b/meson/warnings/meson.build @@ -61,40 +61,30 @@ gcc_common_warnings = [ '-Wattribute-alias=2', '-Wbidi-chars=ucn', '-Wcast-align=strict', - '-Wcast-function-type', '-Wcast-qual', - '-Wclobbered', '-Wconversion', '-Wdate-time', '-Wdisabled-optimization', '-Wdouble-promotion', '-Wduplicated-branches', '-Wduplicated-cond', - '-Wempty-body', - '-Wendif-labels', '-Wfloat-equal', '-Wformat-overflow=2', '-Wformat-signedness', '-Wformat-truncation=2', '-Wformat=2', - '-Wignored-qualifiers', - '-Wimplicit-fallthrough=3', '-Winit-self', '-Winline', '-Winvalid-pch', '-Wlogical-op', '-Wmissing-declarations', - '-Wmissing-field-initializers', '-Wmissing-include-dirs', '-Wmultichar', '-Wnormalized=nfc', '-Wnull-dereference', '-Wopenacc-parallelism', - '-Woverlength-strings', '-Wpacked', - '-Wpacked-bitfield-compat', '-Wpadded', - '-Wpointer-arith', '-Wredundant-decls', '-Wshadow', '-Wshift-negative-value', @@ -102,7 +92,6 @@ gcc_common_warnings = [ '-Wstack-protector', '-Wstrict-aliasing=3', '-Wstrict-overflow=5', - '-Wstring-compare', '-Wstringop-overflow=3', '-Wsuggest-attribute=cold', '-Wsuggest-attribute=const', @@ -114,11 +103,9 @@ gcc_common_warnings = [ '-Wswitch-enum', '-Wtrampolines', '-Wtrivial-auto-var-init', - '-Wtype-limits', '-Wundef', '-Wuninitialized', '-Wunsafe-loop-optimizations', - '-Wunused', '-Wunused-const-variable=2', '-Wunused-macros', '-Wvector-operation-performance', @@ -145,18 +132,11 @@ if is_variable('cc') elif cc.get_id() == 'gcc' all_c_warnings += gcc_common_warnings + [ - '-Wabsolute-value', '-Wbad-function-cast', '-Wc++-compat', - '-Wenum-conversion', - '-Wjump-misses-init', - '-Wmissing-parameter-type', '-Wmissing-prototypes', '-Wnested-externs', - '-Wold-style-declaration', '-Wold-style-definition', - '-Woverride-init', - '-Wsign-compare', '-Wstrict-prototypes', '-Wunsuffixed-float-constants', ] diff --git a/test/headers/meson.build b/test/headers/meson.build index af270073..0c4e97ea 100644 --- a/test/headers/meson.build +++ b/test/headers/meson.build @@ -6,7 +6,6 @@ header_c_suppressions = [] if get_option('strict') if cc.get_id() == 'clang' header_c_suppressions += [ - '-Wno-nullability-extension', '-Wno-padded', ] elif cc.get_id() == 'gcc' @@ -21,6 +20,12 @@ if get_option('strict') endif endif +if cc.get_id() == 'clang' + header_c_suppressions += [ + '-Wno-nullability-extension', + ] +endif + test( 'headers', executable( -- cgit v1.2.1