[Mesa-dev] [PATCH] configure: avoid testing for negative compiler options

Marc Dietrich marvin24 at gmx.de
Wed Nov 29 13:47:55 UTC 2017


gcc seems to always accept unsupported negative compiler warning options:

echo "int i;" | gcc -c -xc -Wno-bob - # no error
echo "int i;" | gcc -c -xc -Walice -  # unsupported compiler option

Inverting the options fixes the tests.

Signed-off-by: Marc Dietrich <marvin24 at gmx.de>
---
 configure.ac | 4 ++--
 meson.build  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1344c12884..c025d9c766 100644
--- a/configure.ac
+++ b/configure.ac
@@ -394,8 +394,8 @@ esac
 AC_SUBST([VISIBILITY_CFLAGS])
 AC_SUBST([VISIBILITY_CXXFLAGS])
 
-AX_CHECK_COMPILE_FLAG([-Wno-override-init],                    [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"])         # gcc
-AX_CHECK_COMPILE_FLAG([-Wno-initializer-overrides],            [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-initializer-overrides"]) # clang
+AX_CHECK_COMPILE_FLAG([-Woverride-init],                    [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"])         # gcc
+AX_CHECK_COMPILE_FLAG([-Winitializer-overrides],            [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-initializer-overrides"]) # clang
 AC_SUBST([WNO_OVERRIDE_INIT])
 
 dnl
diff --git a/meson.build b/meson.build
index bba9a292aa..e69ef6a14b 100644
--- a/meson.build
+++ b/meson.build
@@ -683,7 +683,7 @@ endif
 cpp = meson.get_compiler('cpp')
 cpp_args = []
 foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
-             '-Qunused-arguments', '-Wno-non-virtual-dtor']
+             '-Qunused-arguments', '-Wnon-virtual-dtor']
   if cpp.has_argument(a)
     cpp_args += a
   endif
@@ -708,7 +708,7 @@ foreach a : ['-Werror=pointer-arith', '-Werror=vla']
 endforeach
 
 no_override_init_args = []
-foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
+foreach a : ['-Woverride-init', '-Winitializer-overrides']
   if cc.has_argument(a)
     no_override_init_args += a
   endif
-- 
2.15.0



More information about the mesa-dev mailing list