[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    [PATCH xserver 6/6] meson: Port default warning flags from xorg-macros
From:       Adam Jackson <ajax () redhat ! com>
Date:       2017-09-27 18:31:39
Message-ID: 20170927183139.20731-6-ajax () redhat ! com
[Download RAW message or body]

Well, almost all of them. No -Wdeclaration-after-statement because
that's legal in C99, and in the limited ways we use it, more readable.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
---
 meson.build | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 811d3d4ceb..d71cfed5ab 100644
--- a/meson.build
+++ b/meson.build
@@ -14,8 +14,49 @@ add_global_arguments('-fvisibility=hidden', language : 'c')
 
 add_global_link_arguments('-fvisibility=hidden', language : 'c')
 
-# Quiet some EXA warnings.
-add_global_arguments('-Wno-discarded-qualifiers', language : 'c')
+if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+    test_wflags = [
+        '-Wall',
+        '-Wpointer-arith',
+        '-Wmissing-declarations',
+        '-Wformat=2',
+        '-Wstrict-prototypes',
+        '-Wmissing-prototypes',
+        '-Wnested-externs',
+        '-Wbad-function-cast',
+        '-Wold-style-definition',
+        '-Wunused',
+        '-Wuninitialized',
+        '-Wshadow',
+        '-Wmissing-noreturn',
+        '-Wmissing-format-attribute',
+        '-Wredundant-decls',
+        '-Werror=implicit',
+        '-Werror=nonnull',
+        '-Werror=init-self',
+        '-Werror=main',
+        '-Werror=missing-braces',
+        '-Werror=sequence-point',
+        '-Werror=return-type',
+        '-Werror=trigraphs',
+        '-Werror=array-bounds',
+        '-Werror=write-strings',
+        '-Werror=address',
+        '-Werror=int-to-pointer-cast',
+        '-Werror=pointer-to-int-cast',
+    ]
+else
+    test_wflags = []
+endif
+
+common_wflags = []
+foreach wflag: test_wflags
+    if cc.has_argument(wflag)
+        common_wflags += [ wflag ]
+    endif
+endforeach
+
+add_global_arguments(common_wflags, language : 'c')
 
 xproto_dep = dependency('xproto', version: '>= 7.0.31')
 randrproto_dep = dependency('randrproto', version: '>= 1.5.0')
-- 
2.13.5

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic