|
|
|
@ -368,13 +368,19 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
|
|
|
|
|
|
|
|
|
|
// removed because we always check assert (even in release mode) #if defined(NL_DEBUG)
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && _MSC_VER >= 1900
|
|
|
|
|
#define nlassume(exp) do { __analysis_assume(exp); } while (0) // __analysis_assume doesn't evaluate the expression at runtime
|
|
|
|
|
#else
|
|
|
|
|
#define nlassume(exp) do { ) while (0)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef NL_NO_DEBUG
|
|
|
|
|
# define nlassert(exp) if(false)
|
|
|
|
|
# define nlassertonce(exp) if(false)
|
|
|
|
|
# define nlassertex(exp, str) if(false)
|
|
|
|
|
# define nlverify(exp) { exp; }
|
|
|
|
|
# define nlverifyonce(exp) { exp; }
|
|
|
|
|
# define nlverifyex(exp, str) { exp; }
|
|
|
|
|
# define nlassert(exp) nlassume(exp)
|
|
|
|
|
# define nlassertonce(exp) nlassume(exp)
|
|
|
|
|
# define nlassertex(exp, str) nlassume(exp)
|
|
|
|
|
# define nlverify(exp) do { exp; nlassume(exp); } while (0)
|
|
|
|
|
# define nlverifyonce(exp) do { exp; nlassume(exp); } while (0)
|
|
|
|
|
# define nlverifyex(exp, str) do { exp; nlassume(exp); } while (0)
|
|
|
|
|
#else // NL_NO_DEBUG
|
|
|
|
|
|
|
|
|
|
# ifdef NL_OS_UNIX
|
|
|
|
@ -383,25 +389,29 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
|
|
|
|
|
|
|
|
|
|
#define nlassert(exp) \
|
|
|
|
|
do { \
|
|
|
|
|
if (!(exp)) { \
|
|
|
|
|
bool _expResult_ = (exp) ? true : false; \
|
|
|
|
|
if (!(_expResult_)) { \
|
|
|
|
|
NLMISC::createDebug (); \
|
|
|
|
|
NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \
|
|
|
|
|
NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlassertonce(exp) nlassert(exp)
|
|
|
|
|
|
|
|
|
|
#define nlassertex(exp, str) \
|
|
|
|
|
do { \
|
|
|
|
|
if (!(exp)) { \
|
|
|
|
|
bool _expResult_ = (exp) ? true : false; \
|
|
|
|
|
if (!(_expResult_)) { \
|
|
|
|
|
NLMISC::createDebug (); \
|
|
|
|
|
NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \
|
|
|
|
|
NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \
|
|
|
|
|
NLMISC::INelContext::getInstance().getAssertLog()->displayRawNL str; \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlverify(exp) nlassert(exp)
|
|
|
|
@ -419,16 +429,19 @@ do { \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlassertonce(exp) \
|
|
|
|
|
do { \
|
|
|
|
|
static bool ignoreNextTime = false; \
|
|
|
|
|
if (!ignoreNextTime && !(exp)) { \
|
|
|
|
|
bool _expResult_ = (exp) ? true : false; \
|
|
|
|
|
if (!ignoreNextTime && !(_expResult_)) { \
|
|
|
|
|
ignoreNextTime = true; \
|
|
|
|
|
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlassertex(exp, str) \
|
|
|
|
@ -442,6 +455,7 @@ do { \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlverify(exp) \
|
|
|
|
@ -453,6 +467,7 @@ do { \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlverifyonce(exp) \
|
|
|
|
@ -464,6 +479,7 @@ do { \
|
|
|
|
|
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
#define nlverifyex(exp, str) \
|
|
|
|
@ -477,6 +493,7 @@ do { \
|
|
|
|
|
NLMISC_BREAKPOINT; \
|
|
|
|
|
} \
|
|
|
|
|
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
|
|
|
|
|
nlassume(_expResult_); \
|
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
# endif // NL_OS_UNIX
|
|
|
|
|