[PATCH util-macros 1/1] Turn on the selective -Werror=... CFLAGS for development builds only

Jeremy Huddleston jeremyhu at apple.com
Sun Dec 18 16:19:14 PST 2011


For the more dangerous compiler warnings that we made into errors,
use -Werror=... if .git exists and -W... if not.  This way we still
force developers to trip on them but end users will just see
warnings.

Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
 xorg-macros.m4.in |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index d9ed137..566b05d 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1557,6 +1557,8 @@ XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
 
 # Turn some warnings into errors, so we don't accidently get successful builds
 # when there are problems that should be fixed.
+
+if test -d $srcdir/.git ; then
 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
@@ -1570,6 +1572,21 @@ XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
+else
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
+fi
 
 AC_SUBST([BASE_CFLAGS])
 ]) # XORG_COMPILER_FLAGS
-- 
1.7.7.4



More information about the xorg-devel mailing list