require invariant functions to be prefixed with 'nobug_'
authorChristian Thaeter <ct@pipapo.org>
Sun, 18 Apr 2010 20:23:14 +0000 (22:23 +0200)
committerChristian Thaeter <ct@pipapo.org>
Sun, 18 Apr 2010 20:23:14 +0000 (22:23 +0200)
src/nobug.h
tests/test_nobug.c

index 323b0ac..1260cda 100644 (file)
 //assertions
 // 'invariant_context' must be passed in
 */
-#define NOBUG_INVARIANT(type, pointer, depth, extra)                            \
-  NOBUG_IF_ALPHA(                                                               \
-                 NOBUG_WHEN (NOBUG_SCOPE_UNCHECKED,                             \
-                             NOBUG_CAT(type,_invariant)(pointer, depth,         \
-                                                        NOBUG_CONTEXT, extra)   \
-                             )                                                  \
+#define NOBUG_INVARIANT(type, pointer, depth, extra)                                    \
+  NOBUG_IF_ALPHA(                                                                       \
+                 NOBUG_WHEN (NOBUG_SCOPE_UNCHECKED,                                     \
+                             NOBUG_CAT3(nobug_, type,_invariant)(pointer, depth,        \
+                                                        NOBUG_CONTEXT, extra)           \
+                             )                                                          \
   )
 
 
-#define NOBUG_INVARIANT_IF(when, type, pointer, depth, extra)   \
-  NOBUG_IF_ALPHA(                                               \
-    NOBUG_WHEN (NOBUG_SCOPE_UNCHECKED,                          \
-      NOBUG_WHEN (when,                                         \
-                  NOBUG_CAT(type,_invariant)(pointer, depth,    \
-                                             NOBUG_CONTEXT,     \
-                                             extra)             \
-                  )                                             \
+#define NOBUG_INVARIANT_IF(when, type, pointer, depth, extra)           \
+  NOBUG_IF_ALPHA(                                                       \
+    NOBUG_WHEN (NOBUG_SCOPE_UNCHECKED,                                  \
+      NOBUG_WHEN (when,                                                 \
+                  NOBUG_CAT3(nobug_, type,_invariant)(pointer, depth,   \
+                                             NOBUG_CONTEXT,             \
+                                             extra)                     \
+                  )                                                     \
   ))
 
 #define NOBUG_INVARIANT_ASSERT(expr, ...) \
index fda98a6..bddaa53 100644 (file)
@@ -7,14 +7,14 @@ struct foo
   struct foo* bar;
 };
 
-void foo_invariant (struct foo* self, int depth, const struct nobug_context invariant_context, void* extra)
+void nobug_foo_invariant (struct foo* self, int depth, const struct nobug_context invariant_context, void* extra)
 {
   if (!depth) return;
 
   INVARIANT_ASSERT(self->b != 8);
 
   if (self->bar)
-    foo_invariant (self->bar, depth-1, invariant_context, extra);
+    nobug_foo_invariant (self->bar, depth-1, invariant_context, extra);
 }
 
 void nobug_foo_dump (const struct foo* self, const int depth, const struct nobug_context dump_context, void* extra)