mirror of
https://passt.top/passt
synced 2025-05-22 09:15:34 +02:00
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
8a83b530fe
commit
d949667436
3 changed files with 3 additions and 0 deletions
1
tcp.c
1
tcp.c
|
@ -3079,6 +3079,7 @@ void tcp_ns_sock_init(const struct ctx *c, in_port_t port)
|
|||
*
|
||||
* Return: 0
|
||||
*/
|
||||
/* cppcheck-suppress [constParameterCallback, unmatchedSuppression] */
|
||||
static int tcp_ns_socks_init(void *arg)
|
||||
{
|
||||
const struct ctx *c = (const struct ctx *)arg;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue