From f51ba6089c53f07fdbfb9e89ebf0c44f8e44936b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 17 May 2016 19:39:55 +0100 Subject: Use variadic macros for kak_assert to remove the need for COMMA --- src/assert.hh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/assert.hh') 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 -- cgit v1.2.3