Skip to content

Commit

Permalink
safestringlib: silence unused paramters warning in error handlers
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tomasbw committed Jan 23, 2024
1 parent 4ee034f commit 10b4938
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions safeclib/abort_handler_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion safeclib/ignore_handler_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions safeclib/safeclib_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@

#endif /* __KERNEL__ */

#define UNUSED(x) (void)(x)

#ifndef sldebug_printf
#define sldebug_printf(...)
#endif
Expand Down

0 comments on commit 10b4938

Please sign in to comment.