summaryrefslogtreecommitdiff
path: root/src/assert.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-05-17 19:39:55 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-05-17 19:39:55 +0100
commitf51ba6089c53f07fdbfb9e89ebf0c44f8e44936b (patch)
tree213752076fd5ba302fcae32700f270b1465d9eee /src/assert.hh
parent3b6d6956e24855b02ce1c89ce31e3a7554a8bdae (diff)
Use variadic macros for kak_assert to remove the need for COMMA
Diffstat (limited to 'src/assert.hh')
-rw-r--r--src/assert.hh9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/assert.hh b/src/assert.hh
index 16501e4c..4d6c3782 100644
--- a/src/assert.hh
+++ b/src/assert.hh
@@ -15,15 +15,14 @@ void on_assert_failed(const char* message);
#define STRINGIFY(X) #X
#define TOSTRING(X) STRINGIFY(X)
-#define COMMA ,
#ifdef KAK_DEBUG
- #define kak_assert(condition) \
- if (not (condition)) \
- on_assert_failed("assert failed \"" #condition \
+ #define kak_assert(...) \
+ if (not (__VA_ARGS__)) \
+ on_assert_failed("assert failed \"" #__VA_ARGS__ \
"\" at " __FILE__ ":" TOSTRING(__LINE__))
#else
- #define kak_assert(condition)
+ #define kak_assert(...)
#endif