[gucharmap] build: Fix format warnings test



commit 2a84c6913fce030b928a94cec371b34aafedc45e
Author: Christian Persch <chpe src gnome org>
Date:   Fri Sep 20 21:12:21 2019 +0200

    build: Fix format warnings test

 meson.build | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/meson.build b/meson.build
index 34227142..a6b22f29 100644
--- a/meson.build
+++ b/meson.build
@@ -194,19 +194,26 @@ foreach flag: compiler_flags_cc_required
   assert(cc.has_argument(flag), flag + ' is required but not supported')
 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.
-
-# FIXME: these flags break the gtkdoc-scangobj run
-# compiler_flags_format_warnings = [
-#  '-Werror=format=2',
-#  '-Werror=format-nonliteral',
-#  '-Werror=format-security',
-#]
-#
-# global_cflags += compiler_flags_format_warnings
+# These flags have to be tested together
+
+compiler_flags_common_multi = [
+  # FIXME: these flags break the gtkdoc-scangobj run
+  ## These only work together with -Wformat
+  #[
+  #  '-Werror=format=2',
+  #  '-Werror=format-nonliteral',
+  #  '-Werror=format-security',
+  #],
+]
+
+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
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]