public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>, passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 2/5] cppcheck: Add workaround for cppcheck bug 14847
Date: Mon, 15 Jun 2026 18:18:30 +1000	[thread overview]
Message-ID: <20260615081833.1061725-3-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20260615081833.1061725-1-david@gibson.dropbear.id.au>

It seems the function pointer argument confuses cppcheck 2.21.0 (at least),
causing it to think do_clone()'s definition has different argument names
than it's declaration, even though that's not the case.  I made a minimal
reproducer and filed a cppcheck bug for this (see link).  In the meanwhile
work around it with an explicit suppression.

Link: https://trac.cppcheck.net/ticket/14847
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 util.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/util.c b/util.c
index 43977d42..ed874f1c 100644
--- a/util.c
+++ b/util.c
@@ -713,8 +713,10 @@ int __clone2(int (*fn)(void *), void *stack_base, size_t stack_size, int flags,
  *
  * Return: thread ID of child, -1 on failure
  */
-int do_clone(int (*fn)(void *), char *stack_area, size_t stack_size, int flags,
-	     void *arg)
+int do_clone(int (*fn)(void *),
+/* false positive, see https://trac.cppcheck.net/ticket/14847 */
+/* cppcheck-suppress [funcArgNamesDifferentUnnamed,unmatchedSuppression] */
+	     char *stack_area, size_t stack_size, int flags, void *arg)
 {
 #ifdef __ia64__
 	return __clone2(fn, stack_area + stack_size / 2, stack_size / 2,
-- 
2.54.0


  parent reply	other threads:[~2026-06-15  8:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15  8:18 [PATCH 0/5] Fix cppcheck-2.21.0 warnings David Gibson
2026-06-15  8:18 ` [PATCH 1/5] cppcheck: Remove unused CPPCHECK_6936 David Gibson
2026-06-15  8:18 ` David Gibson [this message]
2026-06-15  8:18 ` [PATCH 3/5] tcp: Merge common sequence logic from tcp_{buf,vu}_data_from_sock() David Gibson
2026-06-15  8:50   ` Laurent Vivier
2026-06-15  8:18 ` [PATCH 4/5] tcp: Avoid SEQ_*() comparisons against 0 David Gibson
2026-06-15  8:18 ` [PATCH 5/5] tcp: MAX_WINDOW should be unsigned David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260615081833.1061725-3-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).