From 67a3b5873944aa2279bf82f5c1f13f35dab3da2a Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 2 Apr 2024 18:05:45 -0400 Subject: 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. --- include/omc.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/omc.h') 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 -- cgit