diff --git a/AK/Assertions.h b/AK/Assertions.h index b83da2269a1..faba540fc15 100644 --- a/AK/Assertions.h +++ b/AK/Assertions.h @@ -9,9 +9,9 @@ extern "C" __attribute__((noreturn)) void ak_verification_failed(char const*); #define __stringify_helper(x) #x #define __stringify(x) __stringify_helper(x) -#define VERIFY(expr) \ - (__builtin_expect(/* NOLINT(readability-simplify-boolean-expr) */ !(expr), 0) \ - ? ak_verification_failed(#expr " at " __FILE__ ":" __stringify(__LINE__)) \ +#define VERIFY(...) \ + (__builtin_expect(/* NOLINT(readability-simplify-boolean-expr) */ !(__VA_ARGS__), 0) \ + ? ak_verification_failed(#__VA_ARGS__ " at " __FILE__ ":" __stringify(__LINE__)) \ : (void)0) #define VERIFY_NOT_REACHED() VERIFY(false) /* NOLINT(cert-dcl03-c,misc-static-assert) No, this can't be static_assert, it's a runtime check */ static constexpr bool TODO = false; @@ -23,12 +23,12 @@ static constexpr bool TODO = false; extern "C" __attribute__((noreturn)) void ak_assertion_failed(char const*); #ifndef NDEBUG -# define ASSERT(expr) \ - (__builtin_expect(/* NOLINT(readability-simplify-boolean-expr) */ !(expr), 0) \ - ? ak_assertion_failed(#expr " at " __FILE__ ":" __stringify(__LINE__)) \ +# define ASSERT(...) \ + (__builtin_expect(/* NOLINT(readability-simplify-boolean-expr) */ !(__VA_ARGS__), 0) \ + ? ak_assertion_failed(#__VA_ARGS__ " at " __FILE__ ":" __stringify(__LINE__)) \ : (void)0) # define ASSERT_NOT_REACHED ASSERT(false) /* NOLINT(cert-dcl03-c,misc-static-assert) No, this can't be static_assert, it's a runtime check */ #else -# define ASSERT(expr) +# define ASSERT(...) # define ASSERT_NOT_REACHED() __builtin_unreachable() #endif