diff --git a/src/assert.hh b/src/assert.hh index 4d6c3782..406420d8 100644 --- a/src/assert.hh +++ b/src/assert.hh @@ -17,12 +17,13 @@ void on_assert_failed(const char* message); #define TOSTRING(X) STRINGIFY(X) #ifdef KAK_DEBUG - #define kak_assert(...) \ + #define kak_assert(...) do { \ if (not (__VA_ARGS__)) \ on_assert_failed("assert failed \"" #__VA_ARGS__ \ - "\" at " __FILE__ ":" TOSTRING(__LINE__)) + "\" at " __FILE__ ":" TOSTRING(__LINE__)); \ + } while (0) #else - #define kak_assert(...) + #define kak_assert(...) do {} while (0) #endif