Skip to content

Commit 10b4938

Browse files
author
Tomas Winkler
committed
safestringlib: silence unused paramters 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 <tomas.winkler@intel.com>
1 parent 4ee034f commit 10b4938

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

safeclib/abort_handler_s.c

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444

4545
void abort_handler_s(const char *msg, void *ptr, errno_t error)
4646
{
47+
UNUSED(ptr);
48+
4749
slprintf("ABORT CONSTRAINT HANDLER: (%u) %s\n", error,
4850
(msg) ? msg : "Null message");
4951
slabort();

safeclib/ignore_handler_s.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@
4040

4141
void ignore_handler_s(const char *msg, void *ptr, errno_t error)
4242
{
43+
UNUSED(ptr);
44+
UNUSED(msg);
45+
UNUSED(error);
4346

4447
sldebug_printf("IGNORE CONSTRAINT HANDLER: (%u) %s\n", error,
4548
(msg) ? msg : "Null message");
46-
return;
4749
}
4850
EXPORT_SYMBOL(ignore_handler_s)

safeclib/safeclib_private.h

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060

6161
#endif /* __KERNEL__ */
6262

63+
#define UNUSED(x) (void)(x)
64+
6365
#ifndef sldebug_printf
6466
#define sldebug_printf(...)
6567
#endif

0 commit comments

Comments
 (0)