While usually it is enough -- and more convenient -- to just override
OnAssertFailure(), to handle all assertion failures, including those
- occurring even before wxApp object creation of after its destruction you
+ occurring even before wxApp object creation or after its destruction you
need to provide your assertion handler function.
This function also provides a simple way to disable all asserts: simply
#else // !wxDEBUG_LEVEL
-// provide empty subs in case assertions are completely disabled
+// provide empty stubs in case assertions are completely disabled
//
// NB: can't use WXUNUSED() here as we're included from wx/defs.h before it is
// defined
// wxFAIL is a special form of assert: it always triggers (and so is
// usually used in normally unreachable code)
#define wxFAIL_COND_MSG(cond, msg) \
- wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, cond, msg)
+ if ( !wxTheAssertHandler ) \
+ {} \
+ else \
+ wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, cond, msg)
#define wxFAIL_MSG(msg) wxFAIL_COND_MSG("Assert failure", msg)
#define wxFAIL wxFAIL_MSG((const char*)NULL)
#else // !wxDEBUG_LEVEL
#define wxASSERT_LEVEL_2_MSG(cond, msg) wxASSERT_MSG(cond, msg)
#define wxASSERT_LEVEL_2(cond) wxASSERT(cond)
#else // wxDEBUG_LEVEL < 2
- #define wxASSERT_LEVEL_2_MSG
- #define wxASSERT_LEVEL_2
+ #define wxASSERT_LEVEL_2_MSG(cond, msg)
+ #define wxASSERT_LEVEL_2(cond)
#endif