[PATCH:macros] XORG_STRICT_OPTION: add -Werror=attributes to STRICT_CFLAGS for gcc

Jeremy Huddleston jeremyhu at apple.com
Mon May 2 20:38:15 PDT 2011


Thanks.

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On May 2, 2011, at 7:13 PM, Alan Coopersmith wrote:

> 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 at oracle.com>
> ---
> xorg-macros.m4.in |    9 +++++++++
> 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
> -- 
> 1.7.3.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list