[Patch, MIPS] Fix warning from malloc/malloc.c

Carlos O'Donell carlos@redhat.com
Thu Dec 11 01:18:00 GMT 2014


On 12/10/2014 08:13 PM, Carlos O'Donell wrote:
> On 12/10/2014 06:13 PM, Steve Ellcey  wrote:
>> Here is a fix for another warning (now error) found in my MIPS build.
>>
>> 	malloc.c: In function '__posix_memalign':
>> 	malloc.c:4976:50: error: logical not is only applied to the left hand side of comparison [-Werror=logical-not-parentheses]
>> 		|| !powerof2 (alignment / sizeof (void *)) != 0
>>                                                   ^
>> 	cc1: all warnings being treated as errors
>>
>>
>> The fix is to remove the '!= 0' comparision since it is redundant.
> 
> Removing '!= 0' creates a boolean coersion from the int type and we avoid
> this in glibc because it is clearer to say exactly what you mean e.g. != 0 or == 0.
> 
> Is not the right fix to add a bracket to clarify the `!` is applied to the left
> side only e.g. "|| (!powerof2 (alignment / sizeof (void *))) != 0"?

What I said is wrong, I see powerof2 returns a boolean.
  
>> OK to checkin?

OK.

Cheers,
Carlos.




More information about the Libc-alpha mailing list