Re: c-family PATCH to improve -Wbool-compare (PR c/64610)

2015-04-30 Thread Andreas Schwab
Marek Polacek writes: > diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c > index 7d314f8..ada8e8a 100644 > --- gcc/c-family/c-common.c > +++ gcc/c-family/c-common.c > @@ -11924,6 +11924,17 @@ maybe_warn_bool_compare (location_t loc, enum > tree_code code, tree op0, > } >else i

Re: c-family PATCH to improve -Wbool-compare (PR c/64610)

2015-04-30 Thread Marek Polacek
On Thu, Apr 30, 2015 at 11:42:18AM +0200, Andreas Schwab wrote: > Marek Polacek writes: > > > PR c/64610 > > * c-common.c (maybe_warn_bool_compare): Warn when comparing a boolean > > with 0/1. > > /usr/local/gcc/gcc-20150430/Build/./prev-gcc/xg++ > -B/usr/local/gcc/gcc-20150430/Buil

Re: c-family PATCH to improve -Wbool-compare (PR c/64610)

2015-04-30 Thread Andreas Schwab
Marek Polacek writes: > PR c/64610 > * c-common.c (maybe_warn_bool_compare): Warn when comparing a boolean > with 0/1. /usr/local/gcc/gcc-20150430/Build/./prev-gcc/xg++ -B/usr/local/gcc/gcc-20150430/Build/./prev-gcc/ -B/usr/aarch64-suse-linux/bin/ -nostdinc++ -B/usr/local/gc

Re: c-family PATCH to improve -Wbool-compare (PR c/64610)

2015-04-28 Thread Jeff Law
On 04/28/2015 04:49 AM, Marek Polacek wrote: This improves -Wbool-compare a bit: boolean >= 0 is always true, on the other hand boolean < 0 is always false, and similar. One feature/bug is that in C++ we don't warn for e.g. bool >= false, since the warning cares about CMP or CMP . I can fix

c-family PATCH to improve -Wbool-compare (PR c/64610)

2015-04-28 Thread Marek Polacek
This improves -Wbool-compare a bit: boolean >= 0 is always true, on the other hand boolean < 0 is always false, and similar. One feature/bug is that in C++ we don't warn for e.g. bool >= false, since the warning cares about CMP or CMP . I can fix that in a follow-up if anyone wants me to. Boo