2023-02-22 01:17:21 +02:00
|
|
|
#pragma once
|
|
|
|
|
2024-03-04 11:41:54 +02:00
|
|
|
#define __ban_assert_stringify_helper(s) #s
|
|
|
|
#define __ban_assert_stringify(s) __ban_assert_stringify_helper(s)
|
2023-10-30 15:12:38 +02:00
|
|
|
|
2024-03-04 11:41:54 +02:00
|
|
|
#define ASSERT(cond) \
|
|
|
|
(__builtin_expect(!(cond), 0) \
|
|
|
|
? __ban_assertion_failed(__FILE__ ":" __ban_assert_stringify(__LINE__), "ASSERT(" #cond ") failed") \
|
|
|
|
: (void)0)
|
2023-10-30 15:12:38 +02:00
|
|
|
|
2024-03-08 22:11:39 +02:00
|
|
|
#define ASSERT_NOT_REACHED() \
|
|
|
|
__ban_assertion_failed(__FILE__ ":" __ban_assert_stringify(__LINE__), "ASSERT_NOT_REACHED() reached")
|
2023-10-30 15:12:38 +02:00
|
|
|
|
2024-03-04 11:41:54 +02:00
|
|
|
[[noreturn]] void __ban_assertion_failed(const char* location, const char* msg);
|