libspl: ASSERT*: !! for sizeof

sizeof(bitfield.member) is invalid, and this shows up in some FreeBSD
build configurations: work around this by !!ing ‒
this makes the sizeof target the ! result type (_Bool), instead

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Fixes: 42aaf0e ("libspl: ASSERT*: mark arguments as used")
Closes #12984
Closes #12986
This commit is contained in:
наб 2022-01-21 19:20:11 +01:00 committed by GitHub
parent 5a4d282f55
commit bc40713a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 25 deletions

View File

@ -133,14 +133,14 @@ 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 (!!(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)))
/*
* Debugging enabled (--enable-debug)

View File

@ -133,14 +133,14 @@ 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 (!!(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)))
/*
* Debugging enabled (--enable-debug)

View File

@ -120,15 +120,15 @@ 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 (!!(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)))
#else
#define ASSERT3B VERIFY3B
#define ASSERT3S VERIFY3S