summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2019-09-20 21:01:06 +0200
committerChristian Persch <chpe@src.gnome.org>2019-09-20 21:02:16 +0200
commitac68d4c02e21f5857f68e75bf39f4cfc4c593a52 (patch)
tree6363049efd0401c1132e6650f93e37785e6b1ad7
parent90afbfd67e452ed308f8b3dc5ce8210ae70fe9b9 (diff)
downloadvte-ac68d4c02e21f5857f68e75bf39f4cfc4c593a52.tar.gz
build: Fix format warnings test
-rw-r--r--meson.build28
1 files changed, 17 insertions, 11 deletions
diff --git a/meson.build b/meson.build
index 69ff1329..c8ff297a 100644
--- a/meson.build
+++ b/meson.build
@@ -350,19 +350,25 @@ foreach flag: compiler_flags_cxx_required
endforeach
-# Meson problem: GCC only accepts the latter 2 options of the 3 below
-# if the first is *also* passed, which doesn't work with get_supported_arguments()
-# above. So just add these unconditionally, since all compilers we support
-# accept these flags.
-
-compiler_flags_format_warnings = [
- '-Werror=format=2',
- '-Werror=format-nonliteral',
- '-Werror=format-security',
+# These flags have to be tested together
+
+compiler_flags_common_multi = [
+ # These only work together with -Wformat
+ [
+ '-Werror=format=2',
+ '-Werror=format-nonliteral',
+ '-Werror=format-security',
+ ],
]
-global_cflags += compiler_flags_format_warnings
-global_cxxflags += compiler_flags_format_warnings
+foreach flags : compiler_flags_common_multi
+ if cc.has_multi_arguments(flags)
+ global_cflags += flags
+ endif
+ if cxx.has_multi_arguments(flags)
+ global_cxxflags += flags
+ endif
+endforeach
# ... and now make these flags the default