This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: comparisons..
Andrew Morton <andrewm@uow.edu.au> writes:
> "Martin v. Loewis" wrote:
> >
> > > Drat. I've wasted your time. Sorry.
> > >
> > > pwold011:/home/morton> gcc -v
> > > Reading specs from /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3/specs
> > > gcc version 2.7.2.3
> > >
> > > Any chance of a backport? :)
> >
> > mira% kgcc -v
> > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs
> > gcc version 2.7.2.3
> > mira% kgcc -S -W a.c
> > a.c: In function `y':
> > a.c:5: warning: unsigned value < 0 is always 0
> >
> > What do you get?
>
> Enlightenment :)
>
> The kernel uses -Wall, and this particular warning is not enabled with
> -Wall.
>
> Unfortunately using `-W' in the kernel makefiles generates a truckload
> of warnings. Is there a way of unbundling the `if (unsigned < 0)'
> warning with a standalone flag? Like -Wnegative-unsigned? It appears
> not.
>
> The whole reason I brought this up is that someone found an `if
> (unsigned < 0)' bug today. Made my ears prick up.
RTFM applies here. You'll find a big section on the additional -W options
that'll do what you need.
Will -Wsign-compare or -Wno-sign-compare do the trick ?
Nick.