From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 8A3325A004F for ; Sat, 08 Jun 2024 08:32:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1717828367; bh=cr4j6U6QcmBI+uD4zFhwyjkOJwgc0+GbkmUCQWonFRs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QCvo7IxhuhEPPbjcvYcAcpbhB86vbwg8kEwPZRc6l0HTGO8ANrqNZQUGL6/YZdbmy utZoInkm9eigre3ndPKAdcFW14IVZVnGm4FPhgIa5Q0y55AB+YCqN//IE1kkmVAD/2 QpYHm9mZelZ436sgb5YQMsOYJyvTsLu2zA5r7cCDx5J07ftG41RZXek/ZXKPg7+YJw N0ALGIVCd39zCEqJI7Jczm/dtBYRAMUu9cCnqlFNr/InL3Vj0A88EuOH4efiK5LaEQ rOp04kfaywDxqUQMmP5lPk0fGyvkPw/+1JgqukBz3kCsnNiVleqn1YTeh7Fj6J6F6w oniDAnE+LVjlg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Vx7Xv1V7vz4wx6; Sat, 8 Jun 2024 16:32:47 +1000 (AEST) Date: Sat, 8 Jun 2024 16:32:22 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 3/9] cppcheck: Suppress constParameterCallback errors Message-ID: References: <20240606100949.1250958-1-david@gibson.dropbear.id.au> <20240606100949.1250958-4-david@gibson.dropbear.id.au> <20240607204940.5a1de94f@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="heS6gDVDCv7yCUtT" Content-Disposition: inline In-Reply-To: <20240607204940.5a1de94f@elisabeth> Message-ID-Hash: A6D6PGUE7YPIRKTU4MSQCT4VJSVIJBWN X-Message-ID-Hash: A6D6PGUE7YPIRKTU4MSQCT4VJSVIJBWN X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --heS6gDVDCv7yCUtT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 07, 2024 at 08:49:40PM +0200, Stefano Brivio wrote: > On Thu, 6 Jun 2024 20:09:43 +1000 > David Gibson wrote: >=20 > > We have several functions which are used as callbacks for NS_CALL() whi= ch > > only read their void * parameter, they don't write it. The new > > constParameterCallback warning in cppcheck 2.14.1 complains that this > > parameter could be const void *, also pointing out that that would requ= ire > > casting the function pointer when used as a callback. > >=20 > > Casting the function pointers seems substantially uglier than using a > > non-const void * as the parameter, especially since in each case we cast > > the void * to a const pointer of specific type immediately. So, suppre= ss > > that error from cppcheck. > >=20 > > Signed-off-by: David Gibson > > --- > > Makefile | 1 + > > 1 file changed, 1 insertion(+) > >=20 > > diff --git a/Makefile b/Makefile > > index 8ea17576..22f05813 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -314,5 +314,6 @@ cppcheck: $(SRCS) $(HEADERS) > > $(SYSTEM_INCLUDES:%=3D--suppress=3DunmatchedSuppression:%/*) \ > > --inline-suppr \ > > --suppress=3DunusedStructMember \ > > + --suppress=3DconstParameterCallback \ >=20 > On versions before 2.14, this now raises an unmatchedSuppression... I'm > not sure how to deal with this. Should we give up and just add a > --suppress=3DunmatchedSuppression for all the source files? I can't think > of anything better at the moment. No, I don't think we want to do that, that's likely to leave stale suppressions about. Although it logically makes sense to suppress this globally, there are only three spots it actually occurs, so I'll rewrite to suppress in just those places, along with a similarly local unmatchedSuppression suppression. > I applied the rest of the series, just not this patch. Nice.. although this was the only one actually blocking other work. --=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 --heS6gDVDCv7yCUtT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmZj+ugACgkQzQJF27ox 2GeA6Q//d6bbsn6V6zgnWSfqkZJizYEc8pvIL74IIig5AgjO+rHwHgKX6Ujw31jn vVWnh7WtKwgkWwEp7cywHppYaNdqDQmUjn8aXedrZJRmxfo0GATImGmdHB3itBOg vfwk208iX+iYoBgSB+SWTcTV+M6DgfjkfUSCKk7Ta22s/ztmpAeTN8jXaCki9CGi Q2wBP0DhEJ8rNTbYYF8XxJZS4hIeMOw4yVn95X8NKT5u9tf5uZvjUzSdhNJSpbsh CX6/PD23pxxF5BDY/vXJuKdTdgsoROieP3JIYRYOUpWXmJQGfuESrCiBZq8AEZTQ 0XjNmSgFXwNnL0wINEiOnl0XD3kyyfz8jdnCXuxN8HwkpecEiRjZNecc1WLoHWeJ qsNvHMcQ0FAQibKy0HuPbtcA9Fp2yAPAqb1qvBEC/Ks5guU98UN4NHsfWXykmXbc vvc5SivLe0Dolzat0L5OA/GMFxKE04opTdIXyrYPWrJ012qBq61o3H4dbyK4OBns p5qDjvd9p219Zz4l5XSnXhkJkzAEMM6KB/P+iSIAt3Jc36GuCShOlyP5GrHDQOQS gz7do6lyvZ7Jz/dvu//apFUbc/6toXEqqe26tfiQ6ELhVj0CvmyZPzbmw6me3bIP ruELy2+zpdmekkoDYAsFZ0o7zMU5QaCgteiG0gsz8Jkko6X94KQ= =t4V+ -----END PGP SIGNATURE----- --heS6gDVDCv7yCUtT--