Skip to content

Commit 0439e08

Browse files
committed
ASSERT for gcc
1 parent 00a085e commit 0439e08

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

CvGameCoreDLLUtil/include/CvAssert.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ bool CvAssertDlg(const char* expr, const char* szFile, unsigned int uiLine, bool
3333

3434
// shows a message dialog if expr is false and CVASSERT_ENABLE is defined.
3535
// Unlike PRECONDITION, a failed assertion does not cause the game to crash
36+
#ifdef __GNUC__
37+
#define ASSERT(expr, ...) \
38+
{ \
39+
static bool bIgnoreAlways = false; \
40+
if( !bIgnoreAlways && !(expr) ) \
41+
{ \
42+
CvString str; \
43+
CvString::format(str, ## __VA_ARGS__); \
44+
if(CvAssertDlg(#expr, __FILE__, __LINE__, bIgnoreAlways, str.c_str())) \
45+
{ CVASSERT_BREAKPOINT; } \
46+
} \
47+
}
48+
#else
3649
#define ASSERT(expr, ...) \
3750
{ \
3851
static bool bIgnoreAlways = false; \
@@ -44,6 +57,7 @@ bool CvAssertDlg(const char* expr, const char* szFile, unsigned int uiLine, bool
4457
{ CVASSERT_BREAKPOINT; } \
4558
} \
4659
}
60+
#endif
4761

4862
// An assert that only happens in the when CVASSERT_ENABLE is true AND it is a debug build
4963
#ifdef _DEBUG

0 commit comments

Comments
 (0)