From ed893c2c908e0a2a257fc54f896a10b44b2180ee Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 14 Sep 2023 00:25:12 +0300 Subject: [PATCH] safestringlib: silence unused parameters warning in error handlers The default ignore and abort handlers take ptr parameter which is unused, in addition in the ignore_handler we use debug print macro which might be undefined and render also rest of the parameters unused. Introduce UNUSED() macro that silence the warning. Signed-off-by: Tomas Winkler --- safeclib/abort_handler_s.c | 2 ++ safeclib/ignore_handler_s.c | 4 +++- safeclib/safeclib_private.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/safeclib/abort_handler_s.c b/safeclib/abort_handler_s.c index 55e15d8..e8b90e8 100644 --- a/safeclib/abort_handler_s.c +++ b/safeclib/abort_handler_s.c @@ -44,6 +44,8 @@ void abort_handler_s(const char *msg, void *ptr, errno_t error) { + UNUSED(ptr); + slprintf("ABORT CONSTRAINT HANDLER: (%u) %s\n", error, (msg) ? msg : "Null message"); slabort(); diff --git a/safeclib/ignore_handler_s.c b/safeclib/ignore_handler_s.c index 173d440..76cf596 100644 --- a/safeclib/ignore_handler_s.c +++ b/safeclib/ignore_handler_s.c @@ -40,9 +40,11 @@ void ignore_handler_s(const char *msg, void *ptr, errno_t error) { + UNUSED(ptr); + UNUSED(msg); + UNUSED(error); sldebug_printf("IGNORE CONSTRAINT HANDLER: (%u) %s\n", error, (msg) ? msg : "Null message"); - return; } EXPORT_SYMBOL(ignore_handler_s) diff --git a/safeclib/safeclib_private.h b/safeclib/safeclib_private.h index f62673c..a01acb8 100644 --- a/safeclib/safeclib_private.h +++ b/safeclib/safeclib_private.h @@ -60,6 +60,8 @@ #endif /* __KERNEL__ */ +#define UNUSED(x) (void)(x) + #ifndef sldebug_printf #define sldebug_printf(...) #endif