From 46048603c0cbf4899323447e72720e550a684599 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 15 Jun 2026 18:18:30 +1000 Subject: cppcheck: Add workaround for cppcheck bug 14847 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 Signed-off-by: Stefano Brivio --- util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index 43977d4..ed874f1 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, -- cgit v1.2.3