From d949667436a2c213a25170449894b312fad62d18 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Sat, 8 Jun 2024 16:30:40 +1000 Subject: cppcheck: Suppress constParameterCallback errors We have several functions which are used as callbacks for NS_CALL() which only read their void * parameter, they don't write it. The constParameterCallback warning in cppcheck 2.14.1 complains that this parameter could be const void *, also pointing out that that would require casting the function pointer when used as a callback. 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, suppress these errors. I think it would make logical sense to suppress this globally, but that would cause unmatchedSuppression errors on earlier cppcheck versions. So, instead individually suppress it, along with unmatchedSuppression in the relevant places. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- pasta.c | 1 + 1 file changed, 1 insertion(+) (limited to 'pasta.c') diff --git a/pasta.c b/pasta.c index 31e1e00..b85ea2b 100644 --- a/pasta.c +++ b/pasta.c @@ -176,6 +176,7 @@ struct pasta_spawn_cmd_arg { * * Return: this function never returns */ +/* cppcheck-suppress [constParameterCallback, unmatchedSuppression] */ static int pasta_spawn_cmd(void *arg) { const struct pasta_spawn_cmd_arg *a; -- cgit v1.2.3