From d080c38196cb8cc9961637287806b5188d518f3d Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 27 Dec 2012 11:00:06 -0500 Subject: [PATCH] war on -Werror, part 9: static inline > macros. At least, according to the new wisdom of today. --- src/global.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/global.h b/src/global.h index e8d3c1e493..4c960faf2d 100644 --- a/src/global.h +++ b/src/global.h @@ -125,8 +125,20 @@ void NORETURN sm_crash( const char *reason = "Internal error" ); * 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) do { CHECKPOINT_M(MESSAGE); sm_crash(MESSAGE); } while(0) -#define ASSERT_M(COND, MESSAGE) do { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } } while(0) +static inline void FAIL_M(const char * MESSAGE) +{ + CHECKPOINT_M(MESSAGE); + sm_crash(MESSAGE); +} + +static inline void ASSERT_M(bool COND, const char * MESSAGE) +{ + if (unlikely(!(COND))) + { + FAIL_M(MESSAGE); + } +} + #if !defined(CO_EXIST_WITH_MFC) #define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed") #endif