luna: Introduce fail(...), a replacement for expect(false, ...)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-02-25 17:41:28 +01:00
parent 8352df5ee8
commit 4fd871fdaa
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,10 @@
if (!(expr)) [[unlikely]] { __check_failed(location, message); } \ if (!(expr)) [[unlikely]] { __check_failed(location, message); } \
} while (0) } while (0)
// Fail with an error message and location.
#define fail(message) __check_failed(SourceLocation::current(), message)
#define fail_at(location, message) __check_failed(location, message)
// Like assert(), but always enabled. // Like assert(), but always enabled.
#define check(expr) \ #define check(expr) \
do { \ do { \

View File

@ -7,7 +7,7 @@ using namespace UBSAN::UBInfo;
[[noreturn]] void ub_panic(SourceLocation caller = SourceLocation::current()) [[noreturn]] void ub_panic(SourceLocation caller = SourceLocation::current())
{ {
expect_at(false, caller, "Undefined behavior"); fail_at(caller, "Undefined behavior");
} }
#define DISPLAY(loc) loc.file, loc.line, loc.column #define DISPLAY(loc) loc.file, loc.line, loc.column