On Mon, Sep 05, 2016 at 02:08:20PM +0000, Bernd Edlinger wrote: > On 09/05/16 14:03, Marek Polacek wrote: > > On Fri, Sep 02, 2016 at 03:51:49PM +0000, Bernd Edlinger wrote: > >> Hi, > >> > >> > + r += !a == ~b; > >> > + r += !a == ~(int) b; > >> > >> I don't understand why ~b should not be warned at -Wall. > > > > Yeah, there was an RFE for this but I'm not finding it. > > > > I certainly agree that the warning is compeletely misleading here: > > test.c: In function 'f': > test.c:10:11: warning: logical not is only applied to the left hand side > of comparison [-Wlogical-not-parentheses] > r += !a == ~b; > ^~ > test.c:10:8: note: add parentheses around left hand side expression to > silence this warning > r += !a == ~b; > ^~ > ( ) > > this will not fix it, but make it worse. > I think a better warning would be > warning: ~ on boolean value, did you mean ! ? Could you please open a PR? I'll take care of it.
Still not sure about other operations. I guess no one would object to warning on bool1 % bool2, but should we warn for bool1 + bool2? Marek