From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: Re: [PATCH 20/28] cppcheck: Suppress same-value-in-ternary branches warning Date: Thu, 29 Sep 2022 11:00:55 +1000 Message-ID: In-Reply-To: <20220928225806.101066a9@elisabeth> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4778371828822737315==" --===============4778371828822737315== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Sep 28, 2022 at 10:58:06PM +0200, Stefano Brivio wrote: > On Wed, 28 Sep 2022 14:33:31 +1000 > David Gibson wrote: >=20 > > TIMER_INTERVAL is the minimum of two separately defined intervals which > > happen to have the same value at present. This results in an expression > > which has the same value in both branches of a ternary operator, which > > cppcheck warngs about. This is logically sound in this case, so suppress > > the error (we appear to already have a similar suppression for clang-tidy= ). > >=20 > > Also add an unmatchedSuppression suppression, since only some cppcheck > > versions complain about this instance. > >=20 > > Signed-off-by: David Gibson > > --- > > passt.c | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/passt.c b/passt.c > > index 4796c89..2c4a986 100644 > > --- a/passt.c > > +++ b/passt.c > > @@ -305,6 +305,7 @@ int main(int argc, char **argv) > > =20 > > loop: > > /* NOLINTNEXTLINE(bugprone-branch-clone): intervals can be the same */ > > + /* cppcheck-suppress [duplicateValueTernary, unmatchedSuppression] */ >=20 > Somewhat surprisingly to me, NOLINTNEXTLINE means "next line of code", > not next line altogether -- given that this still works (I wouldn't > have even tried). Yeah, I wondered about that and came to the same conclusion. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --===============4778371828822737315== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ0FBZEZpRUVvVUx4V3U0L1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