From: Vadim Zeitlin Date: Sun, 30 Sep 2001 17:15:14 +0000 (+0000) Subject: handle _DEBUG/NDEBUG correctly X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8b0bd21b3d4b68146272a124fcadfad02eba6599 handle _DEBUG/NDEBUG correctly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/debug.h b/include/wx/debug.h index 9010e74c63..85dee4be29 100644 --- a/include/wx/debug.h +++ b/include/wx/debug.h @@ -16,6 +16,32 @@ #include "wx/wxchar.h" +// ---------------------------------------------------------------------------- +// Defines controlling the debugging macros +// ---------------------------------------------------------------------------- + +// if _DEBUG is defined (MS VC++ and others use it in debug builds), define +// __WXDEBUG__ too +#ifdef _DEBUG + #ifndef __WXDEBUG__ + #define __WXDEBUG__ + #endif // !__WXDEBUG__ +#endif // _DEBUG + +// if NDEBUG is defined ( uses it), undef __WXDEBUG__ and WXDEBUG +#ifdef NDEBUG + #undef __WXDEBUG__ + #undef WXDEBUG +#endif // NDEBUG + +// if __WXDEBUG__ is defined, make sure that WXDEBUG is defined and >= 1 +#ifdef __WXDEBUG__ + #if !defined(WXDEBUG) || !WXDEBUG + #undef WXDEBUG + #define WXDEBUG 1 + #endif // !WXDEBUG +#endif // __WXDEBUG__ + // ---------------------------------------------------------------------------- // Debugging macros // @@ -36,10 +62,6 @@ // a judicious use of them might increase your program's stability. // ---------------------------------------------------------------------------- -// Use of these suppresses compiler warnings about testing constant expression -WXDLLEXPORT_DATA(extern const bool) wxTrue; -WXDLLEXPORT_DATA(extern const bool) wxFalse; - // Macros which are completely disabled in 'release' mode // // NB: these functions are implemented in src/common/appcmn.cpp @@ -95,6 +117,10 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse; #define wxASSERT_MSG(x, m) #endif //__WXDEBUG__ +// Use of wxFalse instead of FALSE suppresses compiler warnings about testing +// constant expression +WXDLLEXPORT_DATA(extern const bool) wxFalse; + // special form of assert: always triggers it (in debug mode) #define wxFAIL wxASSERT(wxFalse)