libspl: cast to uintptr_t instead of !!ing
This led to these two warning types: debug.h:139:67: warning: the address of ‘ARC_anon’ will always evaluate as ‘true’ [-Waddress] 139 | #define ASSERT3P(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) | ^ arc.c:1591:2: note: in expansion of macro ‘ASSERT3P’ 1591 | ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); | ^~~~~~~~ and arc.h:66:44: warning: ‘<<’ in boolean context, did you mean ‘<’? [-Wint-in-bool-context] 66 | #define HDR_GET_LSIZE(hdr) ((hdr)->b_lsize << SPA_MINBLOCKSHIFT) debug.h:138:46: note: in definition of macro ‘ASSERT3U’ 138 | #define ASSERT3U(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z))) | ^ arc.c:1760:12: note: in expansion of macro ‘HDR_GET_LSIZE’ 1760 | ASSERT3U(HDR_GET_LSIZE(hdr), !=, 0); | ^~~~~~~~~~~~~ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13009
This commit is contained in:
parent
cd26b217dc
commit
a9e2788ffe
|
@ -133,14 +133,20 @@ void spl_dumpstack(void);
|
||||||
*/
|
*/
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
|
||||||
#define ASSERT(x) ((void) sizeof (!!(x)))
|
#define ASSERT(x) ((void) sizeof ((uintptr_t)(x)))
|
||||||
#define ASSERT3B(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
#define ASSERT3B(x, y, z) \
|
||||||
#define ASSERT3S(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define ASSERT3U(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
#define ASSERT3S(x, y, z) \
|
||||||
#define ASSERT3P(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define ASSERT0(x) ((void) sizeof (!!(x)))
|
#define ASSERT3U(x, y, z) \
|
||||||
#define IMPLY(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define EQUIV(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B)))
|
#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)
|
* Debugging enabled (--enable-debug)
|
||||||
|
|
|
@ -133,14 +133,20 @@ void spl_dumpstack(void);
|
||||||
*/
|
*/
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
|
||||||
#define ASSERT(x) ((void) sizeof (!!(x)))
|
#define ASSERT(x) ((void) sizeof ((uintptr_t)(x)))
|
||||||
#define ASSERT3B(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
#define ASSERT3B(x, y, z) \
|
||||||
#define ASSERT3S(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define ASSERT3U(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
#define ASSERT3S(x, y, z) \
|
||||||
#define ASSERT3P(x,y,z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define ASSERT0(x) ((void) sizeof (!!(x)))
|
#define ASSERT3U(x, y, z) \
|
||||||
#define IMPLY(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define EQUIV(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B)))
|
#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)
|
* Debugging enabled (--enable-debug)
|
||||||
|
|
|
@ -120,15 +120,21 @@ do { \
|
||||||
__compile_time_assertion__ ## y[(x) ? 1 : -1]
|
__compile_time_assertion__ ## y[(x) ? 1 : -1]
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define ASSERT3B(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
#define ASSERT3B(x, y, z) \
|
||||||
#define ASSERT3S(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define ASSERT3U(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
#define ASSERT3S(x, y, z) \
|
||||||
#define ASSERT3P(x, y, z) ((void) sizeof (!!(x)), (void) sizeof (!!(z)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define ASSERT0(x) ((void) sizeof (!!(x)))
|
#define ASSERT3U(x, y, z) \
|
||||||
#define ASSERT(x) ((void) sizeof (!!(x)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define assert(x) ((void) sizeof (!!(x)))
|
#define ASSERT3P(x, y, z) \
|
||||||
#define IMPLY(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B)))
|
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
|
||||||
#define EQUIV(A, B) ((void) sizeof (!!(A)), (void) sizeof (!!(B)))
|
#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
|
#else
|
||||||
#define ASSERT3B VERIFY3B
|
#define ASSERT3B VERIFY3B
|
||||||
#define ASSERT3S VERIFY3S
|
#define ASSERT3S VERIFY3S
|
||||||
|
|
Loading…
Reference in New Issue