mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add VERIFY0P() and ASSERT0P() macros.
These macros are similar to VERIFY0() and ASSERT0() but are intended for pointers, and therefore use uintptr_t instead of int64_t. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Kay Pedersen <mail@mkwg.de> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Dag-Erling Smørgrav <des@FreeBSD.org> Closes #15225
This commit is contained in:
committed by
Tony Hutter
parent
d6da6cbd74
commit
5dda8c0910
@@ -123,6 +123,15 @@ do { \
|
||||
(u_longlong_t)__left); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY0P(LEFT) \
|
||||
do { \
|
||||
const uintptr_t __left = (uintptr_t)(LEFT); \
|
||||
if (!(__left == 0)) \
|
||||
libspl_assertf(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"%s == 0 (%p == 0)", #LEFT, \
|
||||
(void *)__left); \
|
||||
} while (0)
|
||||
|
||||
#ifdef assert
|
||||
#undef assert
|
||||
#endif
|
||||
@@ -137,6 +146,7 @@ do { \
|
||||
#define ASSERT3P(x, y, z) \
|
||||
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||
#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x)))
|
||||
#define ASSERT0P(x) ((void) sizeof ((uintptr_t)(x)))
|
||||
#define ASSERT(x) ((void) sizeof ((uintptr_t)(x)))
|
||||
#define assert(x) ((void) sizeof ((uintptr_t)(x)))
|
||||
#define IMPLY(A, B) \
|
||||
@@ -149,6 +159,7 @@ do { \
|
||||
#define ASSERT3U VERIFY3U
|
||||
#define ASSERT3P VERIFY3P
|
||||
#define ASSERT0 VERIFY0
|
||||
#define ASSERT0P VERIFY0P
|
||||
#define ASSERT VERIFY
|
||||
#define assert VERIFY
|
||||
#define IMPLY(A, B) \
|
||||
|
||||
Reference in New Issue
Block a user