diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-02 18:05:45 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-02 18:55:47 -0400 |
commit | 67a3b5873944aa2279bf82f5c1f13f35dab3da2a (patch) | |
tree | c6fd916ddca256fa1fde3b123b357de9cc4aa5fe /include | |
parent | 04a0e9ea708b77a3614910ed1c82b0eb4eab7f57 (diff) | |
download | stasis-67a3b5873944aa2279bf82f5c1f13f35dab3da2a.tar.gz |
Use do-while in COE_CHECK_ABORT.
* continue_on_error is always checked
* An additional conditional can be passed. Use `1` to fail normally. Use `0` to never fail.
Diffstat (limited to 'include')
-rw-r--r-- | include/omc.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/omc.h b/include/omc.h index 0d62508..cc1d705 100644 --- a/include/omc.h +++ b/include/omc.h @@ -48,12 +48,13 @@ guard_free(ARR); \ } while (0) -#define COE_CHECK_ABORT(COND, MSG) {\ - if (COND) { \ - msg(OMC_MSG_ERROR, MSG ": Aborting execution (--continue-on-error/-C is not enabled)\n"); \ - exit(1); \ - } \ -} +#define COE_CHECK_ABORT(COND, MSG) \ + do {\ + if (!globals.continue_on_error && COND) { \ + msg(OMC_MSG_ERROR, MSG ": Aborting execution (--continue-on-error/-C is not enabled)\n"); \ + exit(1); \ + } \ + } while (0) struct OMC_GLOBAL { bool verbose; //!< Enable verbose output |