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 */ +