2159
|
1 |
From 497270fcc17db1f0cb12d8aa2c49b74805c7195a Mon Sep 17 00:00:00 2001
|
|
2 |
From: Vadim Zeitlin <[email protected]>
|
|
3 |
Date: Wed, 9 Sep 2009 15:39:27 +0200
|
|
4 |
Subject: [PATCH 3/5] Don't define _T() when using Sun compiler if possible.
|
|
5 |
|
|
6 |
Avoid defining _T() if possible as it conflicts with the use of this
|
|
7 |
identifier in standard headers. Do still define it when building wx itself or
|
|
8 |
when the special symbol wxNEEDS__T is explicitly predefined.
|
|
9 |
|
|
10 |
See #10660.
|
|
11 |
---
|
|
12 |
include/wx/wxchar.h | 50 +++++++++++++++++++++++++++++++-------------------
|
|
13 |
1 files changed, 31 insertions(+), 19 deletions(-)
|
|
14 |
|
|
15 |
diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h
|
|
16 |
index 2620fba..0850ef4 100644
|
|
17 |
--- a/include/wx/wxchar.h
|
|
18 |
+++ b/include/wx/wxchar.h
|
|
19 |
@@ -227,29 +227,41 @@
|
|
20 |
#endif /* ASCII/Unicode */
|
|
21 |
|
|
22 |
/* ---------------------------------------------------------------------------- */
|
|
23 |
-/* define _T() and related macros */
|
|
24 |
+/* define wxT() and related macros */
|
|
25 |
/* ---------------------------------------------------------------------------- */
|
|
26 |
|
|
27 |
-/* BSD systems define _T() to be something different in ctype.h, override it */
|
|
28 |
-#if defined(__FreeBSD__) || defined(__DARWIN__)
|
|
29 |
- #include <ctype.h>
|
|
30 |
- #undef _T
|
|
31 |
+#if wxUSE_UNICODE
|
|
32 |
+ /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
|
|
33 |
+ #define wxT(x) wxCONCAT_HELPER(L, x)
|
|
34 |
+#else /* !Unicode */
|
|
35 |
+ #define wxT(x) x
|
|
36 |
+#endif /* Unicode/!Unicode */
|
|
37 |
+
|
|
38 |
+/*
|
|
39 |
+ We define _T() as a synonym of wxT() for backwards compatibility and also
|
|
40 |
+ for the benefit of Windows programmers used to it. But this identifier is a
|
|
41 |
+ reserved one and this does create problems in practice, notably with Sun CC
|
|
42 |
+ which uses it in the recent versions of its standard headers. So avoid
|
|
43 |
+ defining it for this compiler at all, unless it was explicitly requested by
|
|
44 |
+ predefining wxNEEDS__T macro before including this header or if we're
|
|
45 |
+ building wx itself which does need and compiles fine thanks to the special
|
|
46 |
+ workarounds for Sun CC in wx/{before,after}std.h.
|
|
47 |
+ */
|
|
48 |
+#ifndef wxNEEDS__T
|
|
49 |
+ #if defined(WXBUILDING) || !(defined (__SUNPRO_C) || defined(__SUNPRO_CC))
|
|
50 |
+ #define wxNEEDS__T
|
|
51 |
+ #endif
|
|
52 |
#endif
|
|
53 |
|
|
54 |
-/* could already be defined by tchar.h (it's quasi standard) */
|
|
55 |
-#ifndef _T
|
|
56 |
- #if !wxUSE_UNICODE
|
|
57 |
- #define _T(x) x
|
|
58 |
- #else /* Unicode */
|
|
59 |
- /* use wxCONCAT_HELPER so that x could be expanded if it's a macro */
|
|
60 |
- #define _T(x) wxCONCAT_HELPER(L, x)
|
|
61 |
- #endif /* ASCII/Unicode */
|
|
62 |
-#endif /* !defined(_T) */
|
|
63 |
-
|
|
64 |
-/* although global macros with such names are normally bad, we want to have */
|
|
65 |
-/* another name for _T() which should be used to avoid confusion between _T() */
|
|
66 |
-/* and _() in wxWidgets sources */
|
|
67 |
-#define wxT(x) _T(x)
|
|
68 |
+#ifdef wxNEEDS__T
|
|
69 |
+ /* BSDs define _T() to be something different in ctype.h, override it */
|
|
70 |
+ #if defined(__FreeBSD__) || defined(__DARWIN__)
|
|
71 |
+ #include <ctype.h>
|
|
72 |
+ #endif
|
|
73 |
+ #undef _T
|
|
74 |
+
|
|
75 |
+ #define _T(x) wxT(x)
|
|
76 |
+#endif /* wxNEEDS__T */
|
|
77 |
|
|
78 |
/* this macro exists only for forward compatibility with wx 3.0 */
|
|
79 |
#define wxS(x) _T(x)
|
|
80 |
--
|
|
81 |
1.6.3.3
|
|
82 |
|