On 11/07/2016 08:15 AM, Bernd Edlinger wrote:
On Fri, Oct 28, 2016 at 09:12:29AM -0600, Jeff Law wrote:
 >
 > The PPC port is stumbling over the new integer in boolean context
warnings.
 >
 > In particular this code from rs6000_option_override_internal is
 > problematical:
 >
 >       HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT
 >                              :
 > processor_target_table[cpu_index].target_enable);
 >
 > The compiler is flagging the (TARGET_DEFAULT) condition.  That's
 > supposed to to be a boolean.
 >
 > After all the macro expansions are done it ultimately looks something
 > like this:
 >
 >      long flags = (((1L << 7)) ? (1L << 7)
 >         : processor_target_table[cpu_index].target_enable);
 >
 > Note the (1L << 7) used as the condition for the ternary.  That's what
 > has the int-in-boolean-context warning tripping.  It's a false positive
 > IMHO.

Hmm...

 From the warning's perspective it would look far less suspicious,
if we make this an unsigned shift op.

I looked at options.h and I think we could also use one bit more
if the shift was unsigned.

Furthermore there are macros TARGET_..._P which do not put
brackets around the macro parameter.

So how about this?

Cross-compiler for powerpc-eabi builds without warning.

Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Bernd.


patch-options.diff


2016-11-07  Bernd Edlinger  <bernd.edlin...@hotmail.de>

        * opth-gen.awk: Use unsigned shifts for bit masks.  Allow all bits
        to be used.  Add brackets around macro argument.
Looks good. I went ahead and committed as I want to start another config-list.mk run today and I'd like to see all the ppc targets pass this time :-0

jeff

Reply via email to