add the _IF variant to INVARIANT_ASSERT
authorChristian Thaeter <ct@pipapo.org>
Wed, 9 Jun 2010 06:10:00 +0000 (08:10 +0200)
committerChristian Thaeter <ct@pipapo.org>
Fri, 16 Jul 2010 04:08:07 +0000 (06:08 +0200)
turned out to be useful in edge cases

src/nobug.h

index 6bee74d..d94b6c6 100644 (file)
 #define NOBUG_INVARIANT_ASSERT(expr, ...) \
  NOBUG_ASSERT_(expr, "INVARIANT", invariant_context, ""__VA_ARGS__)
 
+#define NOBUG_INVARIANT_ASSERT_IF(when, expr, ...)                      \
+ NOBUG_WHEN (when,                                                      \
+   NOBUG_ASSERT_(expr, "INVARIANT", invariant_context, ""__VA_ARGS__)   \
+ )
 
 /*
   checked/unchecked tagged scopes
@@ -1772,6 +1776,9 @@ NOBUG_IFNOT(NOBUG_USE_VALGRIND, 0)
 #ifndef INVARIANT_ASSERT
 #define INVARIANT_ASSERT NOBUG_INVARIANT_ASSERT
 #endif
+#ifndef INVARIANT_ASSERT_IF
+#define INVARIANT_ASSERT_IF NOBUG_INVARIANT_ASSERT_IF
+#endif
 #ifndef DUMP
 #define DUMP NOBUG_DUMP
 #endif