Re: flag to disable -Wextra check for unsigned compared to 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ethan Tira-Thompson <ejt@xxxxxxxxxxxxxx> writes:

> Depending on the target we're compiling for, 'N' could be 0.  In
> which case, all our loops:
> 	for(unsigned i=0; i<NUM_SENSORS; i++) { /* ... */ }
> spew the warning:
> 	warning: comparison of unsigned expression < 0 is always false
> 
> I'd like to keep -W / -Wextra enabled for the other things it
> provides, but this particular warning is gumming up the works.
> 
> As far as I know, there's no flag (a la -Wno-sign-compare) for this
> particular warning.  Correct?

In mainline gcc this is controlled by -Wtype-limits.  Unfortunately,
you are correct that in all released versions of gcc there is no flag
other than -Wextra which controls this warning.  -Wtype-limits will be
new in gcc 4.3.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux