diff options
author | Aleksa Sarai <[email protected]> | 2022-05-18 20:29:33 +1000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-10-28 09:48:43 -0700 |
commit | 7b3ba296543724611c12c52c18e85a1028f8f19e (patch) | |
tree | 7e460302b76621177564047a59138ce98d643e5a /include/os | |
parent | 86db35c447aa3f4cc848497d78d54ec9c985d1ed (diff) |
debug: add VERIFY_{IMPLY,EQUIV} variants
This allows for much cleaner VERIFY-level assertions.
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Aleksa Sarai <[email protected]>
Closes #14070
Diffstat (limited to 'include/os')
-rw-r--r-- | include/os/linux/spl/sys/debug.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/include/os/linux/spl/sys/debug.h b/include/os/linux/spl/sys/debug.h index 3c6f6d1b8..8bdc0b1d7 100644 --- a/include/os/linux/spl/sys/debug.h +++ b/include/os/linux/spl/sys/debug.h @@ -140,6 +140,16 @@ spl_assert(const char *buf, const char *file, const char *func, int line) (long long) (_verify3_right)); \ } while (0) +#define VERIFY_IMPLY(A, B) \ + ((void)(likely((!(A)) || (B)) || \ + spl_assert("(" #A ") implies (" #B ")", \ + __FILE__, __FUNCTION__, __LINE__))) + +#define VERIFY_EQUIV(A, B) \ + ((void)(likely(!!(A) == !!(B)) || \ + spl_assert("(" #A ") is equivalent to (" #B ")", \ + __FILE__, __FUNCTION__, __LINE__))) + /* * Debugging disabled (--disable-debug) */ @@ -171,14 +181,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line) #define ASSERT3P VERIFY3P #define ASSERT0 VERIFY0 #define ASSERT VERIFY -#define IMPLY(A, B) \ - ((void)(likely((!(A)) || (B)) || \ - spl_assert("(" #A ") implies (" #B ")", \ - __FILE__, __FUNCTION__, __LINE__))) -#define EQUIV(A, B) \ - ((void)(likely(!!(A) == !!(B)) || \ - spl_assert("(" #A ") is equivalent to (" #B ")", \ - __FILE__, __FUNCTION__, __LINE__))) +#define IMPLY VERIFY_IMPLY +#define EQUIV VERIFY_EQUIV #endif /* NDEBUG */ |