summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-08-01 14:25:01 +0200
committerMaria Matejka <mq@ucw.cz>2020-04-28 16:21:06 +0200
commit8029ae527edde4d47a51b55efdbdea546296c5ef (patch)
tree167f7a6af1ca7da34af08d0b859e2edbe381ae86
parentd607205486d7ea11f2cbf3dcc3d5e7e6b53f1d0f (diff)
More assertion categories
-rw-r--r--lib/birdlib.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h
index 5202b0c8..4adc42cd 100644
--- a/lib/birdlib.h
+++ b/lib/birdlib.h
@@ -162,10 +162,14 @@ void debug(const char *msg, ...); /* Printf to debug output */
#define DBG(x, y...) do { } while(0)
#endif
+#define ASSERT_DIE(x) do { if (!(x)) bug("Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0)
+
#ifdef DEBUGGING
-#define ASSERT(x) do { if (!(x)) bug("Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0)
+#define ASSERT(x) ASSERT_DIE(x)
+#define ASSUME(x) ASSERT_DIE(x)
#else
#define ASSERT(x) do { if (!(x)) log(L_BUG "Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0)
+#define ASSUME(x) /* intentionally left blank */
#endif
#ifdef DEBUGGING