[PATCH:macros v2] Make XORG_STRICT_OPTION always set STRICT_CFLAGS

Jeremy Huddleston jeremyhu at apple.com
Mon May 2 00:19:08 PDT 2011


Hey Alan,

I think you missed my comment about adding -Werror=attributes for the $GCC case.  Could you please add that as well (gcc doesn't default to -Werror=attributes with -Werror).

On May 1, 2011, at 10:36, Alan Coopersmith wrote:

> Still only adds it to CWARNFLAGS if --enable-strict-compilation is
> passed, but sets the variable with the right flags for the compiler
> so it's available for other checks in configure scripts.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> 
> By popular request, adds AC_SUBST([STRICT_CFLAGS])
> Also updates comments to document that 1.14 will be the first version to
> export this, for future reference by people who want to use this.
> 
> xorg-macros.m4.in |   25 ++++++++++++++++---------
> 1 files changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index bdf734e..ccbe931 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1337,7 +1337,13 @@ AC_SUBST(CWARNFLAGS)
> # -----------------------
> # Minimum version: 1.3.0
> #
> -# Add configure option to enable strict compilation
> +# Add configure option to enable strict compilation flags, such as treating
> +# warnings as fatal errors.
> +# If --enable-strict-compilation is passed to configure, adds strict flags to
> +# $CWARNFLAGS.
> +#
> +# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
> +# when strict compilation is unconditionally desired.
> AC_DEFUN([XORG_STRICT_OPTION], [
> # If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
> AC_REQUIRE([AC_PROG_CC_C99])
> @@ -1348,16 +1354,17 @@ AC_ARG_ENABLE(strict-compilation,
> 			  AS_HELP_STRING([--enable-strict-compilation],
> 			  [Enable all warnings from compiler and make them errors (default: disabled)]),
> 			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
> +if test "x$GCC" = xyes ; then
> +    STRICT_CFLAGS="-pedantic -Werror"
> +elif test "x$SUNCC" = "xyes"; then
> +    STRICT_CFLAGS="-errwarn"
> +elif test "x$INTELCC" = "xyes"; then
> +    STRICT_CFLAGS="-Werror"
> +fi
> if test "x$STRICT_COMPILE" = "xyes"; then
> -	if test "x$GCC" = xyes ; then
> -		STRICT_CFLAGS="-pedantic -Werror"
> -	elif test "x$SUNCC" = "xyes"; then
> -		STRICT_CFLAGS="-errwarn"
> -	elif test "x$INTELCC" = "xyes"; then
> -		STRICT_CFLAGS="-Werror"
> -	fi
> +    CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
> fi
> -CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
> +AC_SUBST([STRICT_CFLAGS])
> AC_SUBST([CWARNFLAGS])
> ]) # XORG_STRICT_OPTION
> 
> -- 
> 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