From 3c8f18483ba2f9ee1645ea3063c2b8c7a306e3a5 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Fri, 30 Dec 2005 13:26:22 +0000 Subject: [PATCH] Make ASSERT_M and FAIL_M into safe function-like macros. --- stepmania/src/global.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stepmania/src/global.h b/stepmania/src/global.h index 21bef59b5b..611d71b656 100644 --- a/stepmania/src/global.h +++ b/stepmania/src/global.h @@ -99,8 +99,8 @@ void NORETURN sm_crash( const char *reason = "Internal error" ); * we get a backtrace. This should probably be used instead of throwing an * exception in most cases we expect never to happen (but not in cases that * we do expect, such as DSound init failure.) */ -#define FAIL_M(MESSAGE) { const char *pStr = (MESSAGE); CHECKPOINT_M(pStr); sm_crash(pStr); } -#define ASSERT_M(COND, MESSAGE) { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } } +#define FAIL_M(MESSAGE) do { const char *pStr = (MESSAGE); CHECKPOINT_M(pStr); sm_crash(pStr); } while(0) +#define ASSERT_M(COND, MESSAGE) do { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } } while(0) #if !defined(CO_EXIST_WITH_MFC) #define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed") #endif