[LyX/master] Fix Clang 14 warning -Wbitwise-instead-of-logical
Kornel Benko
kornel at lyx.org
Fri Apr 29 18:11:55 UTC 2022
Am Fri, 29 Apr 2022 12:35:37 -0400
schrieb Scott Kostyshak <skostysh at lyx.org>:
> On Fri, Apr 29, 2022 at 10:46:23AM +0200, Kornel Benko wrote:
> > Am Fri, 29 Apr 2022 03:02:23 +0200 (CEST)
> > schrieb Scott Kostyshak <skostysh at lyx.org>:
> >
> > > commit a83159f05170733069a2baf2237e81c033f33916
> > > Author: Scott Kostyshak <skostysh at lyx.org>
> > > Date: Thu Apr 28 21:06:37 2022 -0400
> > >
> > > Fix Clang 14 warning -Wbitwise-instead-of-logical
> > >
> > > Use the boolean operator '||' with bools instead of the bitwise
> > > operator '|'.
> > > ---
> > > src/BufferView.cpp | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/src/BufferView.cpp b/src/BufferView.cpp
> > > index 32c890c..30944cc 100644
> > > --- a/src/BufferView.cpp
> > > +++ b/src/BufferView.cpp
> > > @@ -2531,7 +2531,7 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
> > >
> > > // Notify left insets
> > > if (cur != old) {
> > > - bool badcursor = old.fixIfBroken() | cur.fixIfBroken();
> > > + bool badcursor = old.fixIfBroken() || cur.fixIfBroken();
> > > badcursor |= notifyCursorLeavesOrEnters(old, cur);
> > > if (badcursor)
> > > cursor().fixIfBroken();
> >
> > Shouldn't be (for the same reason) also
> > badcursor = badcursor || notifyCursorLeavesOrEnters(old, cur);
> > ?
>
> I would support that change (please commit). Clang for some reason
> doesn't warn about it. I wonder if Clang just doesn't detect it or if |=
> is somehow overloaded for bools while | is not?
>
> Scott
Done at 48c069fa.
Kornel
--
lyx-devel mailing list
lyx-devel at lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20220429/ef4154bb/attachment.asc>
More information about the lyx-devel
mailing list