mesa: Add -Werror=declaration-after-statement to core Mesa CFLAGS

Add the flag only if the compiler is GCC.

Since MSVC does not support C99, explicit errors must be set within core
Mesa in order to prevent GCC users from breaking the MSVC build.

---
 configure.ac      |    4 ++++
 src/mesa/Makefile |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 46938f4..26b6e8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,10 @@ if test "x$GCC" = xyes; then
 
     # Work around aliasing bugs - developers should comment this out
     CFLAGS="$CFLAGS -fno-strict-aliasing"
+
+    # Since MSVC does not support C99, explicit errors must be set within core
+    # Mesa in order to prevent GCC users from breaking the MSVC build.
+    CORE_MESA_C_ERROR_FLAGS="-Werror=declaration-after-statement"
 fi
 if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -Wall"
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index a6025e9..557b208 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -22,7 +22,7 @@ MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
 MESA_CPPFLAGS += $(INCLUDE_DIRS)
 
 # tidy compiler flags
-CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
+CFLAGS := $(filter-out $(DEFINES), $(CFLAGS)) $(CORE_MESA_C_ERROR_FLAGS)
 CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
 
 # LLVM is needed for the state tracker
-- 
1.7.3.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to