Skip to content

Commit

Permalink
ASSERT for gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
Hello71 committed Feb 4, 2025
1 parent 00a085e commit 0439e08
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CvGameCoreDLLUtil/include/CvAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ bool CvAssertDlg(const char* expr, const char* szFile, unsigned int uiLine, bool

// shows a message dialog if expr is false and CVASSERT_ENABLE is defined.
// Unlike PRECONDITION, a failed assertion does not cause the game to crash
#ifdef __GNUC__
#define ASSERT(expr, ...) \
{ \
static bool bIgnoreAlways = false; \
if( !bIgnoreAlways && !(expr) ) \
{ \
CvString str; \
CvString::format(str, ## __VA_ARGS__); \
if(CvAssertDlg(#expr, __FILE__, __LINE__, bIgnoreAlways, str.c_str())) \
{ CVASSERT_BREAKPOINT; } \
} \
}
#else
#define ASSERT(expr, ...) \
{ \
static bool bIgnoreAlways = false; \
Expand All @@ -44,6 +57,7 @@ bool CvAssertDlg(const char* expr, const char* szFile, unsigned int uiLine, bool
{ CVASSERT_BREAKPOINT; } \
} \
}
#endif

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

0 comments on commit 0439e08

Please sign in to comment.