diff options
author | Brian Behlendorf <[email protected]> | 2015-06-24 14:44:47 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-06-24 14:44:47 -0700 |
commit | 5acb2307b2edc55335996bf0ff78f6bdca24a98d (patch) | |
tree | 7ff6761fec915ebbc7ba4c23601dc634f5f9c6a8 /include/sys/debug.h | |
parent | 2345368646151718fa59986d9e2d9d38bcdecb2c (diff) |
Add IMPLY() and EQUIV() macros
Added for upstream compatibility, they are of the form:
* IMPLY(a, b) - if (a) then (b)
* EQUIV(a, b) - if (a) then (b) *AND* if (b) then (a)
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'include/sys/debug.h')
-rw-r--r-- | include/sys/debug.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/sys/debug.h b/include/sys/debug.h index cae2d49e4..a37740036 100644 --- a/include/sys/debug.h +++ b/include/sys/debug.h @@ -92,6 +92,8 @@ void spl_dumpstack(void); #define ASSERT3U(x,y,z) ((void)0) #define ASSERT3P(x,y,z) ((void)0) #define ASSERT0(x) ((void)0) +#define IMPLY(A, B) ((void)0) +#define EQUIV(A, B) ((void)0) /* * Debugging enabled (--enable-debug) @@ -105,6 +107,14 @@ void spl_dumpstack(void); #define ASSERT3U(x,y,z) VERIFY3U(x, y, z) #define ASSERT3P(x,y,z) VERIFY3P(x, y, z) #define ASSERT0(x) VERIFY0(x) +#define IMPLY(A, B) \ + ((void)(((!(A)) || (B)) || \ + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ + "(" #A ") implies (" #B ")"))) +#define EQUIV(A, B) \ + ((void)((!!(A) == !!(B)) || \ + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ + "(" #A ") is equivalent to (" #B ")"))) #endif /* NDEBUG */ |