[balsa/wip/gtk4: 183/351] build: Use get_supported_arguments()



commit c020f97539e666d11b0524cf79ba3c357471e988
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Feb 21 17:31:40 2018 -0500

    build: Use get_supported_arguments()
    
    Instead of checking each flag one by one, use the appropriate method of
    the Meson compiler object.

 meson.build |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/meson.build b/meson.build
index ac9fd39..80e7e54 100644
--- a/meson.build
+++ b/meson.build
@@ -556,25 +556,25 @@ endif
 # set more warnings.
 #
 
-if compiler.get_id() == 'gcc' and more_warnings
-  foreach argument : ['-Wsign-compare',
-                      '-Wpointer-arith',
-                      '-Wnested-externs',
-                      '-Wchar-subscripts',
-                      '-Wuninitialized',
-                      '-Wmissing-prototypes',
-                      '-Wreturn-type',
-                      '-Wdeclaration-after-statement']
-    if compiler.has_argument(argument)
-      add_global_arguments(argument, language : 'c')
-    endif
-  endforeach
-endif
+if more_warnings
+  test_cflags = ['-Wsign-compare',
+                 '-Wpointer-arith',
+                 '-Wnested-externs',
+                 '-Wchar-subscripts',
+                 '-Wuninitialized',
+                 '-Wmissing-prototypes',
+                 '-Wreturn-type',
+                 '-Wdeclaration-after-statement']
+  add_global_arguments(compiler.get_supported_arguments(test_cflags), language : 'c')
+endif # more_warnings
 
 # extra warnings for GIT.
 #
 if balsa_from_git
-  add_global_arguments('-Wall', '-Werror', '-Wdeprecated-declarations', language : 'c')
+  test_cflags = ['-Wall',
+                 '-Werror',
+                 '-Wdeprecated-declarations']
+  add_global_arguments(compiler.get_supported_arguments(test_cflags), language : 'c')
   add_global_arguments('-DGMIME_DISABLE_DEPRECATED', language : 'c')
   add_global_arguments('-O2', '-U_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=2', language : 'c')
 endif # balsa_from_git


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