From 4d7d8e7d10f0e29a4b509425678cd583e7e4e180 Mon Sep 17 00:00:00 2001 From: Sebastian Gottschall Date: Fri, 19 Apr 2024 17:17:39 +0700 Subject: [PATCH] use original Signed-off-by: Sebastian Gottschall --- lib/libspl/include/assert.h | 66 ++++++------------------------------- 1 file changed, 10 insertions(+), 56 deletions(-) diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index 27505295a3eb..155bbab3020a 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -63,77 +63,32 @@ libspl_assert(const char *buf, const char *file, const char *func, int line) #ifdef verify #undef verify #endif -#ifdef NDEBUG -#define VERIFY(cond) (void) ((!(cond))) -#define verify(cond) (void) ((!(cond))) #define PANIC(fmt, a...) \ libspl_assertf(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define VERIFY3B(LEFT, OP, RIGHT) \ -do { \ - const boolean_t __left __attribute__((unused)) = \ - (boolean_t)(LEFT); \ - const boolean_t __right __attribute__((unused)) = \ - (boolean_t)(RIGHT); \ -} while (0) - -#define VERIFY3S(LEFT, OP, RIGHT) \ -do { \ - const int64_t __left __attribute__((unused)) = \ - (int64_t)(LEFT); \ - const int64_t __right __attribute__((unused)) = \ - (int64_t)(RIGHT); \ -} while (0) - -#define VERIFY3U(LEFT, OP, RIGHT) \ -do { \ - const uint64_t __left __attribute__((unused)) = \ - (uint64_t)(LEFT); \ - const uint64_t __right __attribute__((unused)) = \ - (uint64_t)(RIGHT); \ -} while (0) - -#define VERIFY3P(LEFT, OP, RIGHT) \ -do { \ - const uintptr_t __left __attribute__((unused)) = \ - (uintptr_t)(LEFT); \ - const uintptr_t __right __attribute__((unused)) = \ - (uintptr_t)(RIGHT); \ -} while (0) - -#define VERIFY0(LEFT) \ -do { \ - const uint64_t __left __attribute__((unused)) = \ - (uint64_t)(LEFT); \ -} while (0) -#else - #define VERIFY(cond) \ (void) ((!(cond)) && \ - libspl_assert(#cond, "unknown", __FUNCTION__, __LINE__)) + libspl_assert(#cond, __FILE__, __FUNCTION__, __LINE__)) #define VERIFYF(cond, STR, ...) \ do { \ if (!(cond)) \ - libspl_assertf( "unknown", __FUNCTION__, __LINE__, \ + libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \ "%s " STR, #cond, \ __VA_ARGS__); \ } while (0) #define verify(cond) \ (void) ((!(cond)) && \ - libspl_assert(#cond, "unknown", __FUNCTION__, __LINE__)) - -#define PANIC(fmt, a...) \ - libspl_assertf("unknown", __FUNCTION__, __LINE__, fmt, ## a) + libspl_assert(#cond, __FILE__, __FUNCTION__, __LINE__)) #define VERIFY3B(LEFT, OP, RIGHT) \ do { \ const boolean_t __left = (boolean_t)(LEFT); \ const boolean_t __right = (boolean_t)(RIGHT); \ if (!(__left OP __right)) \ - libspl_assertf("unknown", __FUNCTION__, __LINE__, \ + libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \ "%s %s %s (0x%llx %s 0x%llx)", #LEFT, #OP, #RIGHT, \ (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ } while (0) @@ -143,7 +98,7 @@ do { \ const int64_t __left = (int64_t)(LEFT); \ const int64_t __right = (int64_t)(RIGHT); \ if (!(__left OP __right)) \ - libspl_assertf("unknown", __FUNCTION__, __LINE__, \ + libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \ "%s %s %s (0x%llx %s 0x%llx)", #LEFT, #OP, #RIGHT, \ (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ } while (0) @@ -153,7 +108,7 @@ do { \ const uint64_t __left = (uint64_t)(LEFT); \ const uint64_t __right = (uint64_t)(RIGHT); \ if (!(__left OP __right)) \ - libspl_assertf("unknown", __FUNCTION__, __LINE__, \ + libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \ "%s %s %s (0x%llx %s 0x%llx)", #LEFT, #OP, #RIGHT, \ (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ } while (0) @@ -163,7 +118,7 @@ do { \ const uintptr_t __left = (uintptr_t)(LEFT); \ const uintptr_t __right = (uintptr_t)(RIGHT); \ if (!(__left OP __right)) \ - libspl_assertf("unknown", __FUNCTION__, __LINE__, \ + libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \ "%s %s %s (%p %s %p)", #LEFT, #OP, #RIGHT, \ (void *)__left, #OP, (void *)__right); \ } while (0) @@ -172,7 +127,7 @@ do { \ do { \ const uint64_t __left = (uint64_t)(LEFT); \ if (!(__left == 0)) \ - libspl_assertf("unknown", __FUNCTION__, __LINE__, \ + libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \ "%s == 0 (0x%llx == 0)", #LEFT, \ (u_longlong_t)__left); \ } while (0) @@ -258,7 +213,6 @@ do { \ "%s == 0 (%p == 0) " STR, #LEFT, \ (u_longlong_t)__left, __VA_ARGS__); \ } while (0) -#endif #ifdef assert #undef assert @@ -308,11 +262,11 @@ do { \ #define IMPLY(A, B) \ ((void)(((!(A)) || (B)) || \ libspl_assert("(" #A ") implies (" #B ")", \ - "unknown", __FUNCTION__, __LINE__))) + __FILE__, __FUNCTION__, __LINE__))) #define EQUIV(A, B) \ ((void)((!!(A) == !!(B)) || \ libspl_assert("(" #A ") is equivalent to (" #B ")", \ - "unknown", __FUNCTION__, __LINE__))) + __FILE__, __FUNCTION__, __LINE__))) #endif /* NDEBUG */