]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: fix detection of "-Wno-" options 5827/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Apr 2017 14:05:41 +0000 (10:05 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 27 Apr 2017 14:05:41 +0000 (10:05 -0400)
meson.build

index d9dfe7fbd9483a9dfe50f4ef1c3f5e92768382f1..fa0ef168f804a4f6560419df5c5778864eb2ff9b 100644 (file)
@@ -246,10 +246,6 @@ foreach arg : ['-Wundef',
                '-Wendif-labels',
                '-Wstrict-aliasing=2',
                '-Wwrite-strings',
-               '-Wno-unused-parameter',
-               '-Wno-missing-field-initializers',
-               '-Wno-unused-result',
-               '-Wno-format-signedness',
                '-Werror=overflow',
                '-Wdate-time',
                '-Wnested-externs',
@@ -268,6 +264,17 @@ foreach arg : ['-Wundef',
         endif
 endforeach
 
+# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
+# arguments, just emits a warnings. So test for the "positive" version instead.
+foreach arg : ['unused-parameter',
+               'missing-field-initializers',
+               'unused-result',
+               'format-signedness']
+        if cc.has_argument('-W' + arg)
+                add_project_arguments('-Wno-' + arg, language : 'c')
+        endif
+endforeach
+
 if cc.compiles('
    #include <time.h>
    #include <inttypes.h>