r373743 - [NFCI] Improve the -Wbool-operation's warning message

Dávid Bolvanský via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 15:58:20 PDT 2019


Hm, there is no "bitwise negation of a boolean expression always
evaluates to 'true'; did you mean logical negation?" for chromium
case. I will try to fix it.

ut 8. 10. 2019 o 0:03 Dávid Bolvanský <david.bolvansky at gmail.com> napísal(a):
>
> "FWIW I found the "always evaluates to 'true'" bit important to
> understand the warning."
>
> Yeah. I moved this check somewhere else, so we can print precise message:
> r373973 should emit "bitwise negation of a boolean expression always
> evaluates to 'true'; did you mean logical negation?" where possible.
> In the suspicious case like int i = ~b there is a general message
> "bitwise negation of a boolean expression; did you mean logical
> negation?".
>
> I like it now. What do you think? fine for you?
>
> po 7. 10. 2019 o 17:29 Dávid Bolvanský <david.bolvansky at gmail.com> napísal(a):
> >
> > Typo was fixed some days ago :)
> >
> > Odoslané z iPhonu
> >
> > Dňa 7. 10. 2019 o 17:22 užívateľ Arthur O'Dwyer <arthur.j.odwyer at gmail.com> napísal:
> >
> > 
> > On Mon, Oct 7, 2019 at 10:59 AM Dávid Bolvanský via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> >>
> >> Okey, I will see what I can do (I know I need to move checking code somewhere else).
> >>
> >> > Dňa 7. 10. 2019 o 16:54 užívateľ Nico Weber <thakis at chromium.org> napísal:
> >> > FWIW I found the "always evaluates to 'true'" bit important to understand the warning.
> >
> >
> > +1, I think "always evaluates to true" is useful, especially for people who don't immediately intuit the difference between "bitwise negation" and "logical negation." (Although the fixit will help clear up the difference.)
> >
> > Also, Dávid, you misspelled "logical" as "logicial" in the patch I saw. So you might need to push a fix for that typo, unless you already caught it.
> > My suggested message follows—
> >
> > -  "bitwise negation of a boolean expression; did you mean a logicial negation?">,
> > +  "bitwise negation of a boolean expression is always true; did you mean logical negation?">,
> >
> > my $.02,
> > –Arthur


More information about the cfe-commits mailing list