[Mesa-dev] [PATCH 1/5] configure.ac: add Wundef to the build flags

Emil Velikov emil.l.velikov at gmail.com
Fri Nov 24 14:25:02 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

>From the manual:
  Warn if an undefined identifier is evaluated in an `#if' directive.

This is something we want to know and address. Otherwise we can end up
with subtle issues, in the less commonly used codepaths.

Note: this will trigger a lot of extra warnings, with ~60 of those being
unique. Once all those are resolved we'd want to promote the warning to
an error.

Cc: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 configure.ac | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1344c12884f..ba7dda7b575 100644
--- a/configure.ac
+++ b/configure.ac
@@ -291,6 +291,7 @@ dnl
 dnl Check compiler flags
 dnl
 AX_CHECK_COMPILE_FLAG([-Wall],                                 [CFLAGS="$CFLAGS -Wall"])
+AX_CHECK_COMPILE_FLAG([-Wundef],                               [CFLAGS="$CFLAGS -Wundef"])
 AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"])
 AX_CHECK_COMPILE_FLAG([-Werror=missing-prototypes],            [CFLAGS="$CFLAGS -Werror=missing-prototypes"])
 AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],                  [CFLAGS="$CFLAGS -Wmissing-prototypes"])
@@ -303,6 +304,7 @@ dnl Check C++ compiler flags
 dnl
 AC_LANG_PUSH([C++])
 AX_CHECK_COMPILE_FLAG([-Wall],                                 [CXXFLAGS="$CXXFLAGS -Wall"])
+AX_CHECK_COMPILE_FLAG([-Wundef],                               [CXXFLAGS="$CXXFLAGS -Wundef"])
 AX_CHECK_COMPILE_FLAG([-fno-math-errno],                       [CXXFLAGS="$CXXFLAGS -fno-math-errno"])
 AX_CHECK_COMPILE_FLAG([-fno-trapping-math],                    [CXXFLAGS="$CXXFLAGS -fno-trapping-math"])
 AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],                   [VISIBILITY_CXXFLAGS="-fvisibility=hidden"])
-- 
2.14.1



More information about the mesa-dev mailing list