[RFA] Fix various PPC build failures due to int-in-boolean-context code

Jakub Jelinek jakub@redhat.com
Fri Oct 28 15:18:00 GMT 2016


On Fri, Oct 28, 2016 at 09:12:29AM -0600, Jeff Law wrote:
> 	* config/rs6000/rs6000.c (rs6000_option_override_internal): Avoid
> 	false positive from int-in-boolean-context warnings.
> 
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 5e35e33..38a5226 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -3880,7 +3880,7 @@ rs6000_option_override_internal (bool global_init_p)
>  
>  	 If there is a TARGET_DEFAULT, use that.  Otherwise fall back to using
>  	 -mcpu=powerpc, -mcpu=powerpc64, or -mcpu=powerpc64le defaults.  */
> -      HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT
> +      HOST_WIDE_INT flags = ((TARGET_DEFAULT) != 0 ? TARGET_DEFAULT

Why ()s around TARGET_DEFAULT?  If they are needed, they should be provided
in the TARGET_DEFAULT macro definition.  So I think
      HOST_WIDE_INT flags
	= (TARGET_DEFAULT != 0 ? TARGET_DEFAULT
	   : processor_target_table[cpu_index].target_enable);
is what we want to use (the processor_target_table[cpu_index].target_enable
line is too long where it is right now).

>  			     : processor_target_table[cpu_index].target_enable);
>        rs6000_isa_flags |= (flags & ~rs6000_isa_flags_explicit);
>      }


	Jakub



More information about the Gcc-patches mailing list