From 1d03a572d7d88819a0f024d0d110caae1c2f42ab Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 24 Nov 2024 17:09:30 -0500 Subject: Clean up and strengthen warning flags Some previously global suppressions were only actually needed in benchmarks or tests, so move them there to keep the main set as small as possible. --- benchmark/meson.build | 8 ++++++-- meson.build | 22 +++++----------------- test/meson.build | 20 ++++++++++++++------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/benchmark/meson.build b/benchmark/meson.build index d3b04ea..3c231c6 100644 --- a/benchmark/meson.build +++ b/benchmark/meson.build @@ -17,13 +17,17 @@ if glib_dep.found() build_benchmarks = true benchmark_c_args = platform_c_args + benchmark_c_suppressions = [] if cc.get_id() in ['clang', 'emscripten'] benchmark_c_suppressions = [ + '-Wno-bad-function-cast', + '-Wno-c11-extensions', # Glib '-Wno-reserved-identifier', ] - - benchmark_c_args += cc.get_supported_arguments(benchmark_c_suppressions) + elif cc.get_id() == 'gcc' + benchmark_c_suppressions = ['-Wno-bad-function-cast'] endif + benchmark_c_args += cc.get_supported_arguments(benchmark_c_suppressions) foreach benchmark : benchmarks benchmark( diff --git a/meson.build b/meson.build index ad31a87..81f6c62 100644 --- a/meson.build +++ b/meson.build @@ -44,8 +44,6 @@ c_suppressions = [] if cc.get_id() in ['clang', 'emscripten'] if warning_level == 'everything' c_suppressions += [ - '-Wno-bad-function-cast', - '-Wno-c11-extensions', # Glib '-Wno-declaration-after-statement', '-Wno-implicit-fallthrough', # Really for clang < 12 '-Wno-padded', @@ -54,9 +52,7 @@ if cc.get_id() in ['clang', 'emscripten'] ] if not meson.is_cross_build() - c_suppressions += [ - '-Wno-poison-system-directories', - ] + c_suppressions += ['-Wno-poison-system-directories'] endif if host_machine.system() == 'windows' @@ -68,22 +64,16 @@ if cc.get_id() in ['clang', 'emscripten'] endif if warning_level in ['everything', '3'] - c_suppressions += [ - '-Wno-nullability-extension', - ] + c_suppressions += ['-Wno-nullability-extension'] endif if cc.get_id() == 'emscripten' - c_suppressions += [ - '-Wno-format', - ] + c_suppressions += ['-Wno-format'] endif elif cc.get_id() == 'gcc' if warning_level == 'everything' c_suppressions += [ - '-Wno-bad-function-cast', - '-Wno-cast-function-type', '-Wno-inline', '-Wno-padded', '-Wno-strict-overflow', @@ -93,7 +83,7 @@ elif cc.get_id() == 'gcc' if host_machine.system() == 'windows' c_suppressions += [ - '-Wno-format', + '-Wno-bad-function-cast', '-Wno-suggest-attribute=const', '-Wno-suggest-attribute=format', '-Wno-suggest-attribute=pure', @@ -102,9 +92,7 @@ elif cc.get_id() == 'gcc' endif if warning_level in ['everything', '3'] - c_suppressions += [ - '-Wno-pedantic', # C11 - ] + c_suppressions += ['-Wno-pedantic'] # C11 endif elif cc.get_id() == 'msvc' diff --git a/test/meson.build b/test/meson.build index 309551f..63141bb 100644 --- a/test/meson.build +++ b/test/meson.build @@ -52,12 +52,20 @@ endif # Set warning suppression flags specific to tests test_suppressions = [] -if host_machine.system() == 'windows' - if cc.get_id() in ['clang', 'emscripten'] - test_suppressions += [ - '-Wno-format-nonliteral', - ] - elif cc.get_id() == 'gcc' +if cc.get_id() in ['clang', 'emscripten'] + if warning_level == 'everything' + test_suppressions += ['-Wno-bad-function-cast'] + + if host_machine.system() == 'windows' + if cc.get_id() in ['clang', 'emscripten'] + test_suppressions += ['-Wno-format-nonliteral'] + endif + endif + endif +elif cc.get_id() == 'gcc' + test_suppressions += ['-Wno-bad-function-cast'] + + if host_machine.system() == 'windows' test_suppressions += ['-Wno-format'] endif endif -- cgit v1.2.1