Subject: Re: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false

From: Eric Blake <[email-masked]>
Date: Wed, 25 May 2011 13:54:54 -0600

On 05/25/2011 01:23 AM, Voelker, Bernhard wrote:
> Hi *,
> 
> building coreutils-8.12 with '--enable-gcc-warnings' fails on my SLES 10.3 server:
> 
>   CC       uinttostr.o
> cc1: warnings being treated as errors
> In file included from uinttostr.c:3:
> anytostr.c: In function 'uinttostr':
> anytostr.c:39: warning: comparison of unsigned expression < 0 is always false

It would be _really_ nice if there were a way to have gcc shut up that
particular warning when it is the result of a macro expansion that first
checks whether an expresssion is signed or unsigned.  That is, gcc is
issuing the warning for 'is_signed(e) ? (e < 0 ? a : b) : b', even
though the 'e < 0' sub-expression is provably dead code for an unsigned
expression and therefore the warning is spurious.  But we don't know how
to shut up gcc.

This also affects recent gnulib lib/intprops.h, so ideas are welcome.

In the meantime, configure with CFLAGS='-Wno-error' to allow warnings to
still be listed but not halt compilation.

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org