Mesa (master): autoconf: Enable missing-prototypes errors when available.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jan 30 19:35:38 UTC 2012


Module: Mesa
Branch: master
Commit: b9aab8b3b3769b9c5121686efe3446dae770b951
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b9aab8b3b3769b9c5121686efe3446dae770b951

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 26 18:48:20 2012 -0800

autoconf: Enable missing-prototypes errors when available.

After the removal of the dri driver link test, this should help avoid
the original problem that it was designed to catch: The warning about
a missing prototype due to typoing a function name scrolling by in the
Mesa build spew, and you not noticing until you try to run an
application and it falls back to swrast.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 configure.ac |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index df9f880..d42a529 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,7 +176,20 @@ esac
 
 dnl Add flags for gcc and g++
 if test "x$GCC" = xyes; then
-    CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
+    CFLAGS="$CFLAGS -Wall -std=c99"
+
+    # Enable -Werror=implicit-function-declaration and
+    # -Werror=missing-prototypes, if available, or otherwise, just
+    # -Wmissing-prototypes.  This is particularly useful to avoid
+    # generating a loadable driver module that has undefined symbols.
+    save_CFLAGS="$CFLAGS"
+    AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
+    CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
+    CFLAGS="$CFLAGS -Werror=missing-prototypes"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+		   AC_MSG_RESULT([yes]),
+		   [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
+		    AC_MSG_RESULT([no])]);
 
     # Enable -fvisibility=hidden if using a gcc that supports it
     save_CFLAGS="$CFLAGS"




More information about the mesa-commit mailing list