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