From a86d0f8d6564b6346faf2afe2ea2569ffdc062c0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 21 Jun 2017 19:07:43 +0200 Subject: [PATCH] Move wx/debug.h inclusion after SIZEOF_WCHAR_T in wx/defs.h This is required now because wx/debug.h includes wx/chartype.h which uses SIZEOF_WCHAR_T to define wxUSE_UNICODE_UTF16. --- include/wx/defs.h | 80 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index f21937cd23..b63bd7491c 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -672,47 +672,6 @@ typedef short int WXTYPE; /* breaks C++ code) */ #include -#ifdef __cplusplus - -// everybody gets the assert and other debug macros -#include "wx/debug.h" - - // delete pointer if it is not NULL and NULL it afterwards - template - inline void wxDELETE(T*& ptr) - { - typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; - - if ( ptr != NULL ) - { - delete ptr; - ptr = NULL; - } - } - - // delete an array and NULL it (see comments above) - template - inline void wxDELETEA(T*& ptr) - { - typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; - - if ( ptr != NULL ) - { - delete [] ptr; - ptr = NULL; - } - } - - // trivial implementation of std::swap() for primitive types - template - inline void wxSwap(T& first, T& second) - { - T tmp(first); - first = second; - second = tmp; - } -#endif /*__cplusplus*/ - /* size of statically declared array */ #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) @@ -1227,6 +1186,45 @@ typedef wxUint32 wxDword; #endif #ifdef __cplusplus + +// everybody gets the assert and other debug macros +#include "wx/debug.h" + + // delete pointer if it is not NULL and NULL it afterwards + template + inline void wxDELETE(T*& ptr) + { + typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; + + if ( ptr != NULL ) + { + delete ptr; + ptr = NULL; + } + } + + // delete an array and NULL it (see comments above) + template + inline void wxDELETEA(T*& ptr) + { + typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; + + if ( ptr != NULL ) + { + delete [] ptr; + ptr = NULL; + } + } + + // trivial implementation of std::swap() for primitive types + template + inline void wxSwap(T& first, T& second) + { + T tmp(first); + first = second; + second = tmp; + } + /* And also define a couple of simple functions to cast pointer to/from it. */ inline wxUIntPtr wxPtrToUInt(const void *p) {