fix assert not requiring ; at the end
parent
650af9877f
commit
465f1a4fc8
|
@ -35,13 +35,13 @@ namespace blt
|
||||||
}
|
}
|
||||||
|
|
||||||
// prints error with stack trace if assertion fails. Does not stop execution.
|
// prints error with stack trace if assertion fails. Does not stop execution.
|
||||||
#define blt_assert(expr) static_cast<bool>(expr) ? void(0) : blt::b_assert_failed(#expr, __FILE__, __LINE__)
|
#define blt_assert(expr) do {static_cast<bool>(expr) ? void(0) : blt::b_assert_failed(#expr, __FILE__, __LINE__) } while (0)
|
||||||
// prints error with stack trace then exits with failure.
|
// prints error with stack trace then exits with failure.
|
||||||
#define BLT_ASSERT(expr) {static_cast<bool>(expr) ? void(0) : blt::b_assert_failed(#expr, __FILE__, __LINE__); std::exit(EXIT_FAILURE); }
|
#define BLT_ASSERT(expr) do {static_cast<bool>(expr) ? void(0) : blt::b_assert_failed(#expr, __FILE__, __LINE__); std::exit(EXIT_FAILURE); } while (0)
|
||||||
// prints as error but does not throw the exception.
|
// prints as error but does not throw the exception.
|
||||||
#define blt_throw(throwable) {blt::b_throw(throwable.what(), __FILE__, __LINE__);}
|
#define blt_throw(throwable) do {blt::b_throw(throwable.what(), __FILE__, __LINE__);} while (0)
|
||||||
// prints as error with stack trace and throws the exception.
|
// prints as error with stack trace and throws the exception.
|
||||||
#define BLT_THROW(throwable) {blt::b_throw(throwable.what(), __FILE__, __LINE__); throw throwable;}
|
#define BLT_THROW(throwable) do {blt::b_throw(throwable.what(), __FILE__, __LINE__); throw throwable;} while(0)
|
||||||
|
|
||||||
|
|
||||||
#endif //BLT_ASSERT_H
|
#endif //BLT_ASSERT_H
|
||||||
|
|
Loading…
Reference in New Issue