On Mon, Sep 05, 2016 at 12:35:13PM +0200, Bernd Schmidt wrote: > On 09/02/2016 05:13 PM, Marek Polacek wrote: > > diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi > > index 87da1f1..38d55d4 100644 > > --- gcc/doc/invoke.texi > > +++ gcc/doc/invoke.texi > > @@ -5437,8 +5437,8 @@ if (a < 0 && a < 0) @{ @dots{} @} > > @opindex Wlogical-not-parentheses > > @opindex Wno-logical-not-parentheses > > Warn about logical not used on the left hand side operand of a comparison. > > -This option does not warn if the RHS operand is of a boolean type. Its > > -purpose is to detect suspicious code like the following: > > +This option does not warn if the right operand is considered to be a > > Boolean > > +expression. Its purpose is to detect suspicious code like the following: > > I think "Boolean" shouldn't be capitalized. The patch looks ok to me > otherwise. No strong opinions, but looking at https://en.wikipedia.org/wiki/Boolean_expression I see that it's capitalized there, so I think let's keep "Boolean".
> > + r += !a == (b | c); > > I do wonder whether we should give a different warning for this though. I > personally prefer code involving bools to use || to show it's a logical > operation. Bit-wise may indicate mistakes where the programmer thought he > was operating on integers. Yea. I'd swear that I've seen an RFE somewhere for this in the GCC BZ, I mean to warn for bool1 * bool2, bool1 / bool2, etc. Though I'm not sure if warning for bool1 | bool2 would be desirable. Thanks, I think I'll commit this later today. Marek