luna: Introduce fail(...), a replacement for expect(false, ...)

This commit is contained in:
apio 2023-02-25 17:41:28 +01:00
parent 5f6a659fa1
commit dc795ff491
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); } \
} 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.
#define check(expr) \
do { \

View File

@ -7,7 +7,7 @@ using namespace UBSAN::UBInfo;
[[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