File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,11 @@ macros:
3131OMEGA_ASSERT (Condition, Message, addition args for message);
3232OMEGA_REQUIRE(Condition, Message, addition args for message);
3333```
34- These emulate the behavior of the C++ assert function. The `ASSERT` macro
35- is only evaluated in debug builds while the `REQUIRE` macro is always
36- evaluated. These have identical behavior to the critical error macro, but
37- take the additional boolean argument of the condition to be checked.
34+ These emulate the behavior of the C++ assert function in which the condition
35+ is checked and a critical error is thrown if the condition is not met (false).
36+ The `ASSERT` macro is only evaluated in debug builds while the `REQUIRE`
37+ macro is always evaluated. These have identical behavior to the critical error
38+ macro, but take the additional boolean argument of the condition to be checked.
3839
3940The remaining macros operate on or with an Error class that contains an error
4041code and an error message. These can be used as a return code, as in:
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ Error::Error(ErrorCode ErrCode, // [in] error code to assign
213213// / It is only active for debug builds.
214214#ifdef OMEGA_DEBUG
215215#define OMEGA_ASSERT (_Condition, _ErrMsg, ...) \
216- if (_Condition) { \
216+ if (! _Condition) { \
217217 LOG_CRITICAL (_ErrMsg, ##__VA_ARGS__); \
218218 cpptrace::generate_trace ().print (); \
219219 OMEGA::Error::abort (); \
@@ -225,7 +225,7 @@ Error::Error(ErrorCode ErrCode, // [in] error code to assign
225225// / This macro checks for a required condition and exits if not met
226226// / It is always evaluated (unlike ASSERT for debug builds)
227227#define OMEGA_REQUIRE (_Condition, _ErrMsg, ...) \
228- if (_Condition) { \
228+ if (! _Condition) { \
229229 LOG_CRITICAL (_ErrMsg, ##__VA_ARGS__); \
230230 cpptrace::generate_trace ().print (); \
231231 OMEGA::Error::abort (); \
Original file line number Diff line number Diff line change @@ -59,11 +59,11 @@ void passError2(Error &Err) {
5959 // Alternative critical failure tests
6060 // CHECK_ERROR_ABORT(Err, "Expected critical error with args: {} {} {}",
6161 // MsgArgStr, MsgArgInt, MsgArgReal);
62- // OMEGA_REQUIRE(! Err.isSuccess(),
62+ // OMEGA_REQUIRE(Err.isSuccess(),
6363 // "Expected Error with args: {} {} {}", MsgArgStr, MsgArgInt,
6464 // MsgArgReal);
6565 // This one requires a debug build
66- // OMEGA_ASSERT(! Err.isSuccess(),
66+ // OMEGA_ASSERT(Err.isSuccess(),
6767 // "Expected Error with args: {} {} {}", MsgArgStr, MsgArgInt,
6868 // MsgArgReal);
6969}
You can’t perform that action at this time.
0 commit comments