[PATCH macros 2/2] Separate unknown warning options by language

Gaetan Nadon memsize at videotron.ca
Mon Mar 12 14:28:58 PDT 2012


On 12-03-12 02:57 PM, Chase Douglas wrote:
> If XORG_COMPILER_FLAGS is called more than once with separate languages,
> the unknown warning options used internally for unknown warning checking
> will be set the first time and then the cached value will be used for
> subsequent languages. This is a problem if the compilers differ between
> the languages.
>
> This change ensures that the unknown warning options are namespaced so
> multiple XORG_COMPILER_FLAGS calls with different languages are checked
> separately.
>
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
>  xorg-macros.m4.in |   26 +++++++++++++-------------
>  1 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index 2da57c2..0d8a754 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1515,28 +1515,28 @@ AC_LANG_CASE(
>  
>  [xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
>  
> -if test "x$xorg_testset_unknown_warning_option" = "x" ; then
> +if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
>  	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
> -	AC_CACHE_CHECK([if compiler supports -Werror=unknown-warning-option],
> -			xorg_cv_compiler_flag_unknown_warning_option,
> +	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
> +			[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
>  			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
> -					  [xorg_cv_compiler_flag_unknown_warning_option=yes],
> -					  [xorg_cv_compiler_flag_unknown_warning_option=no]))
> -	xorg_testset_unknown_warning_option=$xorg_cv_compiler_flag_unknown_warning_option
> +					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
> +					  [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
> +	[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
>  	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
>  fi
>  
> -if test "x$xorg_testset_unused_command_line_argument" = "x" ; then
> -	if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
> +if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
> +	if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
>  		PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
>  	fi
>  	PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
> -	AC_CACHE_CHECK([if compiler supports -Werror=unused-command-line-argument],
> -			xorg_cv_compiler_flag_unused_command_line_argument,
> +	AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
> +			[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
>  			AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
> -					  [xorg_cv_compiler_flag_unused_command_line_argument=yes],
> -					  [xorg_cv_compiler_flag_unused_command_line_argument=no]))
> -	xorg_testset_unused_command_line_argument=$xorg_cv_compiler_flag_unused_command_line_argument
> +					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
> +					  [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
> +	[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
>  	PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
>  fi
>  

Reviewed-by: Gaetan Nadon<memsize at videotron.ca>


More information about the xorg-devel mailing list