summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-05-02 16:52:26 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-05-06 17:30:32 -0700
commit61f5a48a74680c316bee2bf93d6ef5d50a688f22 (patch)
tree9dc2a01af6c6a7b21517776e4434851c08d3847d
parent8a556afbe7ff81987597ca88e315fe66f10e4adc (diff)
XORG_STRICT_OPTION: add -Werror=attributes to STRICT_CFLAGS for gcc
Flags unknown attributes as errors, if -Werror=attributes is supported. (The -Werror=* option was first spotted in gcc 4.2.0 manuals.) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--xorg-macros.m4.in9
1 files changed, 9 insertions, 0 deletions
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index ccbe931..f89efb6 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1356,6 +1356,15 @@ AC_ARG_ENABLE(strict-compilation,
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
if test "x$GCC" = xyes ; then
STRICT_CFLAGS="-pedantic -Werror"
+ # Add -Werror=attributes if supported (gcc 4.2 & later)
+ AC_MSG_CHECKING([if $CC supports -Werror=attributes])
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
+ [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
+ CFLAGS="$save_CFLAGS"
elif test "x$SUNCC" = "xyes"; then
STRICT_CFLAGS="-errwarn"
elif test "x$INTELCC" = "xyes"; then