6 #ifndef _INC_cDebugAssert_H
7 #define _INC_cDebugAssert_H
19 #if defined(_MSC_VER) && ( _MSC_VER >= 1600 )
20 #define STATIC_ASSERT(exp, name) static_assert(exp,#name)
21 #elif defined(__GNUC__)
22 #define STATIC_ASSERT(exp, name) static_assert(exp,#name)
24 #define STATIC_ASSERT(exp, name) typedef int static_assert_##name [(exp) ? 1 : -1]
39 cDebugSourceLine(
const char* pszFile =
"",
const char* pszFunction =
"", WORD uLine = 0) noexcept
49 #define DEBUGSOURCELINE ::Gray::cDebugSourceLine( __FILE__, __FUNCTION__, (WORD) __LINE__ )
68 #define ASSERT_THROW(exp) if (!(exp)) { ::Gray::cDebugAssert::Assert_Throw(#exp, DEBUGSOURCELINE ); }
70 #define ASSERT_N(exp) ASSERT_THROW(exp)
72 #if defined(_DEBUG) || defined(_DEBUG_FAST)
77 #define ASSERT(exp) (void)((!!(exp)) || (::Gray::cDebugAssert::Assert_Fail(#exp, DEBUGSOURCELINE ), 0))
79 #define DEBUG_CHECK(exp) (void)((!!(exp)) || (::Gray::cDebugAssert::Debug_Fail(#exp, DEBUGSOURCELINE ), 0))
81 #define DEBUG_ASSERT(exp,sDesc) (void)((!!(exp)) || (::Gray::cDebugAssert::Debug_Fail(sDesc, DEBUGSOURCELINE ), 0))
87 #define ASSERT(exp) __noop
90 #define DEBUG_CHECK(exp) __noop
93 #define DEBUG_ASSERT(exp,sDesc) __noop
#define CATTR_NORETURN
Definition: GrayCore.h:93
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
const cDebugSourceLine & src
Definition: cDebugAssert.h:51
typedef bool(CALLBACK AssertCallback_t)(const char *pszExp
Definition: cDebugAssert.h:54
static AssertCallback_t * sm_pAssertCallback
redirect callback on Assert_Fail usually used for unit tests.
Definition: cDebugAssert.h:59
static bool sm_bAssertTest
Just testing. not a real assert.
Definition: cDebugAssert.h:60
Definition: cDebugAssert.h:29
WORD m_uLine
line number in the source file. (1 based) LINE
Definition: cDebugAssert.h:36
cDebugSourceLine(const char *pszFile="", const char *pszFunction="", WORD uLine=0) noexcept
Definition: cDebugAssert.h:39
const char * m_pszFile
name of the source file. static text. FILE
Definition: cDebugAssert.h:34
const char * m_pszFunction
Definition: cDebugAssert.h:35