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
---
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