From 7fbcab3dc10dfa6e23e0666a79618be313147a9c Mon Sep 17 00:00:00 2001 From: "Richard C. Gobeille" Date: Sat, 9 May 2020 14:02:12 -0700 Subject: [PATCH] Duke3d: VM_ASSERT fix --- source/duke3d/src/gameexec.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 028f53abe..f80421413 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1383,15 +1383,27 @@ static void ResizeArray(int const arrayNum, int const newSize) # define abort_after_error(...) continue // non-threaded dispatch handles this in the loop condition in VM_Execute() #endif -#define VM_ASSERT(condition, ...) \ +#if defined _MSC_VER +#define VM_ASSERT(condition, fmt, ...) \ do \ { \ if (EDUKE32_PREDICT_FALSE(!(condition))) \ { \ - CON_ERRPRINTF(__VA_ARGS__); \ + CON_ERRPRINTF(fmt, __VA_ARGS__); \ abort_after_error(); \ } \ } while (0) +#else +#define VM_ASSERT(condition, fmt, ...) \ + do \ + { \ + if (EDUKE32_PREDICT_FALSE(!(condition))) \ + { \ + CON_ERRPRINTF(fmt __VA_OPT__(, ) __VA_ARGS__); \ + abort_after_error(); \ + } \ + } while (0) +#endif GAMEEXEC_STATIC void VM_Execute(int const loop /*= false*/) {