diff options
author | Matthew Macy <[email protected]> | 2019-12-05 12:37:00 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-12-05 12:37:00 -0800 |
commit | 2a8ba608d3eace43010174aa4f67c8b8af4aacf3 (patch) | |
tree | b6393b38c9f31ee69fac7f42414b09ca900f2737 /lib/libspl | |
parent | 12395c7b0bbd2eaaae96d4105bdc83c3d0c73bec (diff) |
Replace ASSERTV macro with compiler annotation
Remove the ASSERTV macro and handle suppressing unused
compiler warnings for variables only in ASSERTs using the
__attribute__((unused)) compiler annotation. The annotation
is understood by both gcc and clang.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Jorgen Lundman <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9671
Diffstat (limited to 'lib/libspl')
-rw-r--r-- | lib/libspl/include/assert.h | 2 | ||||
-rw-r--r-- | lib/libspl/include/sys/debug.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index b7b406850..19b25f7dd 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -145,7 +145,6 @@ do { \ #define ASSERT0(x) ((void)0) #define ASSERT(x) ((void)0) #define assert(x) ((void)0) -#define ASSERTV(x) #define IMPLY(A, B) ((void)0) #define EQUIV(A, B) ((void)0) #else @@ -156,7 +155,6 @@ do { \ #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define assert VERIFY -#define ASSERTV(x) x #define IMPLY(A, B) \ ((void)(((!(A)) || (B)) || \ libspl_assert("(" #A ") implies (" #B ")", \ diff --git a/lib/libspl/include/sys/debug.h b/lib/libspl/include/sys/debug.h index c6a8c6784..af18da948 100644 --- a/lib/libspl/include/sys/debug.h +++ b/lib/libspl/include/sys/debug.h @@ -33,4 +33,8 @@ #define __printflike(x, y) __attribute__((__format__(__printf__, x, y))) #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #endif |