diff --git a/include/os/freebsd/spl/sys/debug.h b/include/os/freebsd/spl/sys/debug.h index 6df76db7e..c3d7a6e83 100644 --- a/include/os/freebsd/spl/sys/debug.h +++ b/include/os/freebsd/spl/sys/debug.h @@ -133,14 +133,20 @@ void spl_dumpstack(void); */ #ifdef NDEBUG -#define ASSERT(x) ((void) sizeof (!!(x))) -#define ASSERT3B(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3S(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3U(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3P(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT0(x) ((void) sizeof (!!(x))) -#define IMPLY(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B))) -#define EQUIV(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B))) +#define ASSERT(x) ((void) sizeof ((uintptr_t)(x))) +#define ASSERT3B(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3S(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3U(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3P(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x))) +#define IMPLY(A, B) \ + ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B))) +#define EQUIV(A, B) \ + ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B))) /* * Debugging enabled (--enable-debug) diff --git a/include/os/linux/spl/sys/debug.h b/include/os/linux/spl/sys/debug.h index 102fc640b..e0ae7e2d6 100644 --- a/include/os/linux/spl/sys/debug.h +++ b/include/os/linux/spl/sys/debug.h @@ -133,14 +133,20 @@ void spl_dumpstack(void); */ #ifdef NDEBUG -#define ASSERT(x) ((void) sizeof (!!(x))) -#define ASSERT3B(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3S(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3U(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3P(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT0(x) ((void) sizeof (!!(x))) -#define IMPLY(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B))) -#define EQUIV(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B))) +#define ASSERT(x) ((void) sizeof ((uintptr_t)(x))) +#define ASSERT3B(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3S(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3U(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3P(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x))) +#define IMPLY(A, B) \ + ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B))) +#define EQUIV(A, B) \ + ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B))) /* * Debugging enabled (--enable-debug) diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index fadff14cc..e129ef7df 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -120,15 +120,21 @@ do { \ __compile_time_assertion__ ## y[(x) ? 1 : -1] #ifdef NDEBUG -#define ASSERT3B(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3S(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3U(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT3P(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) -#define ASSERT0(x) ((void) sizeof (!!(x))) -#define ASSERT(x) ((void) sizeof (!!(x))) -#define assert(x) ((void) sizeof (!!(x))) -#define IMPLY(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B))) -#define EQUIV(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B))) +#define ASSERT3B(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3S(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3U(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT3P(x, y, z) \ + ((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z))) +#define ASSERT0(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) \ + ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B))) +#define EQUIV(A, B) \ + ((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B))) #else #define ASSERT3B VERIFY3B #define ASSERT3S VERIFY3S