aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2017-09-06 15:44:20 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-04-17 09:55:18 +0000
commit162a58b493eb30ccca8179febc4cfbf3fdaf7cb5 (patch)
tree504075bbba4c02a40e79228e14a932c3596b4e28 /mesonbuild
parentf7a7059250ab9cf71c68ca78812a24a35ee745f6 (diff)
downloadmeson-162a58b493eb30ccca8179febc4cfbf3fdaf7cb5.zip
meson-162a58b493eb30ccca8179febc4cfbf3fdaf7cb5.tar.gz
meson-162a58b493eb30ccca8179febc4cfbf3fdaf7cb5.tar.bz2
fix checks for gcc disable warning flags
GCC does not print a warning or error for unknown options if the options are to disable warnings. Therefore, when checking for options starting '-Wno-', also check the opposite enabling option. This fixes the case where e.g. -Wno-implicit-fallthrough is incorrectly reported as supported by gcc 5.4. To avoid missed warnings when using combinations of flags, such as in test case "112 has arg", we limit the checking of for the positive option to where the negative option is checked alone.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/c.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index 4263536..7f45ecb 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -847,6 +847,11 @@ and other similar methods only support checking compiler arguments.
Using them to check linker arguments are never supported, and results
are likely to be wrong regardless of the compiler you are using.
'''.format(arg))
+ # some compilers, e.g. GCC, don't warn for unsupported warning-disable
+ # flags, so when we are testing a flag like "-Wno-forgotten-towel", also
+ # check the equivalent enable flag too "-Wforgotten-towel"
+ if len(args) == 1 and args[0].startswith('-Wno-'):
+ args.append('-W' + args[0][5:])
return self.compiles('int i;\n', env, extra_args=args)