From 9ff9127930f14159ddfe533c89d6683a7030e80e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 9 Sep 2009 22:29:51 +0000 Subject: [PATCH] Undef _T before including standard headers and redefine it later. This change fixes the build of wxWidgets itself by undefining _T() before including any standard headers and redefining it after including them. See #10660. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@61871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/afterstd.h | 23 +++++++++++++++++++++++ include/wx/beforestd.h | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/wx/afterstd.h b/include/wx/afterstd.h index 6fdbb315b3..7c7f5c60ef 100644 --- a/include/wx/afterstd.h +++ b/include/wx/afterstd.h @@ -46,3 +46,26 @@ #endif #endif +/* + Redefine _T if we undefined it in wx/beforestd.h (see comment there about + why do we do it) and if we need it (we always do when building wx itself + and might also need when compiling the user code but this must be indicated + by the special wxNEEDS__T macro) + */ +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) + #if defined(WXBUILDING) || defined(wxNEEDS_T) + /* + Undefine _T in case it was defined in the standard header. + */ + #undef _T + + /* + And define it again in the same way as it's done in wx/wxchar.h. + */ + #if wxUSE_UNICODE + #define _T(x) wxCONCAT_HELPER(L, x) + #else /* !Unicode */ + #define _T(x) x + #endif /* Unicode/!Unicode */ + #endif /* we need _T() to be defined */ +#endif /* defined(__SUNPRO_CC) || defined(__SUNPRO_C) */ diff --git a/include/wx/beforestd.h b/include/wx/beforestd.h index 684b8428c3..024df1d74c 100644 --- a/include/wx/beforestd.h +++ b/include/wx/beforestd.h @@ -63,3 +63,13 @@ #pragma warning(disable:4786) #endif // VC++ < 7 +/* + Recent versions of Sun C++ compiler use _T in their standard headers and + our definition of it in wx/wxchar.h conflicts with them and breaks + compilation, so undefine _T before including them and redefine it back in + wx/afterstd.h if needed. + */ +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) + #undef _T +#endif /* SUNCC */ +