From 0fd4c84a5ec8d1d178e55a01d612f0a39e50a828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Tue, 4 Jun 2024 21:51:26 +0200 Subject: [PATCH] meson: clear flags used for build Some were duplicated between GCC and Clange. Others were missing in Clang case. Instead test all the flags and don't make assumptions that will get invalid over time. Testing flags is almost free. --- meson.build | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/meson.build b/meson.build index 319e4c356f..0f692a8e87 100644 --- a/meson.build +++ b/meson.build @@ -266,41 +266,31 @@ cc = meson.get_compiler('c') flags = ['-D_FILE_OFFSET_BITS=64'] link_flags = [] -test_flags = ['-Werror=implicit-function-declaration', - '-Wno-missing-field-initializers', - '-Wno-sign-compare', - '-Wno-unused-parameter', - '-Wno-cast-function-type', +test_flags = ['-Wdisabled-optimization', '-Wempty-body', - '-Wdisabled-optimization', - '-Wstrict-prototypes', - '-Wno-format-zero-length', - '-Wno-redundant-decls', - '-Wvla', - '-Wno-format-truncation', + '-Wformat', '-Wimplicit-fallthrough', + '-Wmissing-prototypes', + '-Wparentheses', + '-Wpointer-arith', + '-Wshadow', + '-Wstrict-prototypes', + '-Wundef', + '-Wvla', + '-Werror=implicit-function-declaration', + '-Wno-cast-function-type', + '-Wno-format-zero-length', + '-Wno-missing-field-initializers', + '-Wno-pointer-sign', + '-Wno-sign-compare', + '-Wno-switch', + '-Wno-unused-parameter', '-fno-math-errno'] flags += cc.get_supported_arguments(test_flags) if cc.has_multi_arguments('-Wformat', '-Werror=format-security') - flags += ['-Wformat', '-Werror=format-security'] -endif - -if cc.get_id() == 'gcc' - gcc_flags = ['-Wundef', '-Wmissing-prototypes', '-Wshadow', - '-Wno-switch', '-Wparentheses', '-Wpointer-arith', - '-Wno-pointer-sign', - # GCC bug 66425 - '-Wno-unused-result'] - flags += gcc_flags -endif - -if cc.get_id() == 'clang' - clang_flags = ['-Wno-logical-op-parentheses', '-Wno-switch', - '-Wno-tautological-compare', '-Wno-pointer-sign', - '-Wno-tautological-constant-out-of-range-compare'] - flags += clang_flags + flags += '-Werror=format-security' endif darwin = host_machine.system() == 'darwin'