From 5acb2307b2edc55335996bf0ff78f6bdca24a98d Mon Sep 17 00:00:00 2001 From: Brian Behlendorf <behlendorf1@llnl.gov> Date: Wed, 24 Jun 2015 14:44:47 -0700 Subject: 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 <behlendorf1@llnl.gov> --- include/sys/debug.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/sys/debug.h') 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 */ -- cgit v1.2.3