]> git.proxmox.com Git - mirror_spl.git/commitdiff
Add ASSERT0 and VERIFY0 macros
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 10 May 2013 21:27:30 +0000 (14:27 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 18 Jun 2013 18:41:55 +0000 (11:41 -0700)
The Illumos code introduced the ASSERT0 and VERIFY0 macros which
are to be used instead of ASSERT3S(x, ==, 0) and VERIFY3S(x, ==, 0).

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Madhav Suresh <madhav.suresh@delphix.com>
Closes #246

include/sys/debug.h

index 25ff88e3ac21d5119c8fb7b791b98cdbbbb93113..ac716c9a0687f2f72e15c53697c47f1bcabe4aa9 100644 (file)
  * ASSERT3S()  - Assert signed X OP Y is true, if not panic.
  * ASSERT3U()  - Assert unsigned X OP Y is true, if not panic.
  * ASSERT3P()  - Assert pointer X OP Y is true, if not panic.
+ * ASSERT0()   - Assert value is zero, if not panic.
  * VERIFY()    - Verify X is true, if not panic.
  * VERIFY3S()  - Verify signed X OP Y is true, if not panic.
  * VERIFY3U()  - Verify unsigned X OP Y is true, if not panic.
  * VERIFY3P()  - Verify pointer X OP Y is true, if not panic.
+ * VERIFY0()   - Verify value is zero, if not panic.
  */
 
 #ifndef _SPL_DEBUG_H
@@ -79,10 +81,12 @@ do {                                                                        \
 #define VERIFY3U(x,y,z)        VERIFY3_IMPL(x, y, z, uint64_t, "%llu",         \
                                    (unsigned long long))
 #define VERIFY3P(x,y,z)        VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *))
+#define VERIFY0(x)     VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (uint64_t))
 
 #define ASSERT3S(x,y,z)        ((void)0)
 #define ASSERT3U(x,y,z)        ((void)0)
 #define ASSERT3P(x,y,z)        ((void)0)
+#define ASSERT0(x)     ((void)0)
 
 #else /* Debugging Enabled */
 
@@ -130,10 +134,12 @@ do {                                                                      \
 #define VERIFY3U(x,y,z)        VERIFY3_IMPL(x, y, z, uint64_t, "%llu",         \
                                    (unsigned long long))
 #define VERIFY3P(x,y,z)        VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *))
+#define VERIFY0(x)     VERIFY3_IMPL(0, ==, x, int64_t, "%lld", (uint64_t))
 
 #define ASSERT3S(x,y,z)        VERIFY3S(x, y, z)
 #define ASSERT3U(x,y,z)        VERIFY3U(x, y, z)
 #define ASSERT3P(x,y,z)        VERIFY3P(x, y, z)
+#define ASSERT0(x)     VERIFY0(x)
 
 #define ASSERTV(x)     x
 #define VERIFY(x)      ASSERT(x)