From 74b66562df05eddcc4e760cf2ab7b8b5b304c6ad Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 11 Nov 2019 16:55:53 +0000 Subject: [PATCH] build: Split out warning flags that are only supported for C For completeness, I've added separate lists of flags that are only supported for C++, although there are none yet. Signed-off-by: Simon McVittie <smcv@collabora.com> --- meson.build | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index ae0cbd339..6c739e406 100644 --- a/meson.build +++ b/meson.build @@ -54,7 +54,7 @@ endif glslang_validator = find_program('glslangValidator', required : true) -warning_cflags = [ +warning_flags = [ '-Wall', '-Wextra', '-Warray-bounds', @@ -65,19 +65,14 @@ warning_cflags = [ '-Wformat-nonliteral', '-Wformat-security', '-Wformat=2', - '-Wimplicit-function-declaration', '-Winit-self', '-Winline', - '-Wjump-misses-init', '-Wlogical-op', '-Wmissing-declarations', '-Wmissing-format-attribute', '-Wmissing-include-dirs', '-Wmissing-noreturn', - '-Wmissing-prototypes', - '-Wnested-externs', '-Wnull-dereference', - '-Wold-style-definition', '-Wpacked', '-Wpointer-arith', '-Wredundant-decls', @@ -85,20 +80,34 @@ warning_cflags = [ '-Wreturn-type', '-Wshadow', '-Wstrict-aliasing', - '-Wstrict-prototypes', '-Wswitch-default', '-Wswitch-enum', '-Wundef', '-Wunused-but-set-variable', '-Wwrite-strings', ] -no_warning_cflags = [ - 'declaration-after-statement', +warning_cflags = warning_flags + [ + '-Wimplicit-function-declaration', + '-Wjump-misses-init', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', + '-Wstrict-prototypes', +] +warning_cxxflags = warning_flags + [ +] + +no_warning_flags = [ 'missing-field-initializers', 'sign-compare', 'unused-local-typedefs', 'unused-parameter', ] +no_warning_cflags = no_warning_flags + [ + 'declaration-after-statement', +] +no_warning_cxxflags = no_warning_flags + [ +] c_compiler = meson.get_compiler('c') supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags) -- GitLab