luna: Introduce fail(...), a replacement for expect(false, ...)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8352df5ee8
commit
4fd871fdaa
@ -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 { \
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user