summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2018-06-11 18:24:39 +0200
committerGert Wollny <[email protected]>2018-06-20 11:08:28 +0200
commit81e5bf3cfef60edb093cde35bace061a8543dba5 (patch)
tree3dcca321c9a778cb1cd75bf309964055cb642afa /meson.build
parent916dda5cf7abdcc0f95293758942951b34af7a6d (diff)
configure.ac: Add CFLAG -Wno-missing-field-initializers (v5)
This warning is misleading: When a struct is partially initialized without assigning to the structure members by name, then the remaining fields will be zeroed out, and this warning will be issued (if enabled). If, on the other hand, the partial initialization is done by assigning to named members, the remaining structure elements may hold random data, but the warning is not issued. Since in Mesa the first approach to initialize structure elements is used very often, and it is usually assumed that the remaining elements are zeroed out, heeding this warning would be counter-productive. v2: - add -Wno-missing-field-initializers to meson-build - fix empty line error (both Eric Engestrom) v3: * check for -Wmissing-field-initializers warning and then disable it because gcc and clang always accept -Wno-* (Dylan Baker) * Also disable this warning for C++ v4: * meson.build add -Wno-missing-field-initializers to c_args instead of no_override_init_args (Eric Engstrom) v5: * configure.ac: Correct copy/paste error with CFLAGS/CXXFLAGS Reviewed-by: Marek Olšák <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v2) Reviewed-by: Eric Engestrom <[email protected]> Signed-off-by: Gert Wollny <[email protected]>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build13
1 files changed, 10 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index ce54393fded..e834adbb249 100644
--- a/meson.build
+++ b/meson.build
@@ -769,6 +769,10 @@ foreach a : ['-Wall', '-Werror=implicit-function-declaration',
c_args += a
endif
endforeach
+if cc.has_argument('-Wmissing-field-initializers')
+ c_args += '-Wno-missing-field-initializers'
+endif
+
c_vis_args = []
if cc.has_argument('-fvisibility=hidden')
c_vis_args += '-fvisibility=hidden'
@@ -785,9 +789,12 @@ endforeach
# For some reason, the test for -Wno-foo always succeeds with gcc, even if the
# option is not supported. Hence, check for -Wfoo instead.
-if cpp.has_argument('-Wnon-virtual-dtor')
- cpp_args += '-Wno-non-virtual-dtor'
-endif
+
+foreach a : ['non-virtual-dtor', 'missing-field-initializers']
+ if cpp.has_argument('-W' + a)
+ cpp_args += '-Wno-' + a
+ endif
+endforeach
no_override_init_args = []
foreach a : ['override-init', 'initializer-overrides']