From 61f5a48a74680c316bee2bf93d6ef5d50a688f22 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 2 May 2011 16:52:26 -0700 Subject: 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 Reviewed-by: Jeremy Huddleston --- xorg-macros.m4.in | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- cgit v1.2.3