diff --git a/luna/include/luna/Check.h b/luna/include/luna/Check.h index ce3b0472..07c5279c 100644 --- a/luna/include/luna/Check.h +++ b/luna/include/luna/Check.h @@ -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 { \ diff --git a/luna/src/UBSAN.cpp b/luna/src/UBSAN.cpp index 15e52676..4f3c25d2 100644 --- a/luna/src/UBSAN.cpp +++ b/luna/src/UBSAN.cpp @@ -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