From: Vadim Zeitlin Date: Fri, 21 May 2010 12:52:12 +0000 (+0000) Subject: Always define SIZEOF_WCHAR_T if it's not defined under Windows. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f2b504977dce8d0d74036b937c7e1372d31fe3a6 Always define SIZEOF_WCHAR_T if it's not defined under Windows. The assumption that SIZEOF_EVERYTHING_ELSE is defined when SIZEOF_INT is is wrong. While wxWidgets configure does define all SIZEOF_XXX at once, SIZEOF_INT could also be defined in some third party headers (e.g. Python.h) and we still need to define the other ones. In particular, doing this fixes the problem with SIZEOF_WCHAR_T not being defined during wxPython build. Closes #12013. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64373 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index 88e0bd9979..03cb08dc51 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -820,21 +820,30 @@ typedef wxUint16 wxWord; #define SIZEOF_VOID_P 4 #define SIZEOF_SIZE_T 4 #elif defined(__WINDOWS__) - /* Win64 uses LLP64 model and so ints and longs have the same size as in */ - /* Win32 */ #if defined(__WIN32__) typedef int wxInt32; typedef unsigned int wxUint32; - /* Assume that if SIZEOF_INT is defined that all the other ones except - SIZEOF_SIZE_T, are too. See next #if below. */ + /* + Win64 uses LLP64 model and so ints and longs have the same size as + in Win32. + */ #ifndef SIZEOF_INT #define SIZEOF_INT 4 + #endif + + #ifndef SIZEOF_LONG #define SIZEOF_LONG 4 + #endif + + #ifndef SIZEOF_WCHAR_T + /* Windows uses UTF-16 */ #define SIZEOF_WCHAR_T 2 + #endif + #ifndef SIZEOF_SIZE_T /* - under Win64 sizeof(size_t) == 8 and so it is neither unsigned + Under Win64 sizeof(size_t) == 8 and so it is neither unsigned int nor unsigned long! */ #ifdef __WIN64__ @@ -847,25 +856,14 @@ typedef wxUint16 wxWord; #define wxSIZE_T_IS_UINT #endif #undef wxSIZE_T_IS_ULONG + #endif + #ifndef SIZEOF_VOID_P #ifdef __WIN64__ #define SIZEOF_VOID_P 8 #else /* Win32 */ #define SIZEOF_VOID_P 4 #endif /* Win64/32 */ - #endif /* !defined(SIZEOF_INT) */ - - /* - If Python.h was included first, it defines all of the SIZEOF's above - except for SIZEOF_SIZE_T, so we need to do it here to avoid - triggering the #error in the ssize_t typedefs below... - */ - #ifndef SIZEOF_SIZE_T - #ifdef __WIN64__ - #define SIZEOF_SIZE_T 8 - #else /* Win32 */ - #define SIZEOF_SIZE_T 4 - #endif #endif #else #error "Unsupported Windows version"