aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ejdestig <marejde@gmail.com>2016-02-20 21:29:35 +0100
committerMartin Ejdestig <marejde@gmail.com>2016-02-20 21:51:32 +0100
commita179d07fd1635196ead57d2a3ce62d418a24f8a8 (patch)
tree95d5c6db089ab075f1dd3c07923907639cc49ba1
parent2cbe876f714f2c6fc66a5bcb0dfe9118752f850d (diff)
downloadmeson-a179d07fd1635196ead57d2a3ce62d418a24f8a8.zip
meson-a179d07fd1635196ead57d2a3ce62d418a24f8a8.tar.gz
meson-a179d07fd1635196ead57d2a3ce62d418a24f8a8.tar.bz2
Do not pass -Weverything to Clang at warning level 3
-Weverything is not a good match for behavior of other compilers at warning level 3. Align flags with what Meson passes to GCC instead. The warnings generated are often conflicting with what the user most probably wants. E.g.: * -Wc++98-compat does not make sense when building code that uses -std= to set a later standard. * -Wpadding warns when compiler pads classes and structs for better performance, probably something the user wants. These warnings, and maybe a couple of others, can of course be disabled by Meson with -Wno-* but it is not future proof (other warnings that makes sense to disable by default may be added which means Meson will probably have to pass different flags depending on the Clang version). It is also problematic to compile many system and library headers with -Weverything. For instance: * stdio.h and sigaction.h on Linux makes use of recursive macros (-Wdisabled-macro-expansion). * Many library headers make use of deprecated functionality (-Wdeprecated). * Many library (e.g. GTK+ and Qt) headers trigger Clang's Doxygen warnings (-Wdocumentation-unknown-command and -Wdocumentation). There are a couple of more warnings that need to be disabled when building files that use GTK+ and Qt. GTest is also problematic. Maybe it would make sense to add a higher level, where -Weverything would be passed to Clang, that aligns with the original intent of -Weverything. See http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20121029/067071.html . GCC does not have a similar flag though. I do not know about other compilers (MSVC etc).
-rw-r--r--mesonbuild/compilers.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 1a51e21..a320343 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -1393,7 +1393,7 @@ class ClangCCompiler(CCompiler):
self.id = 'clang'
self.warn_args = {'1': ['-Wall', '-Winvalid-pch'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch'],
- '3' : ['-Weverything']}
+ '3' : ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch']}
def get_buildtype_args(self, buildtype):
return gnulike_buildtype_args[buildtype]
@@ -1484,7 +1484,7 @@ class ClangCPPCompiler(CPPCompiler):
self.id = 'clang'
self.warn_args = {'1': ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'],
'2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'],
- '3': ['-Weverything']}
+ '3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']}
def get_buildtype_args(self, buildtype):
return gnulike_buildtype_args[buildtype]