]> git.pld-linux.org Git - packages/icu.git/blame - icu-cxx-pre11.patch
- added cxx-pre11 patch (allow using C++ API in GCC c++98/c++03 mode)
[packages/icu.git] / icu-cxx-pre11.patch
CommitLineData
0e2868a5
JB
1--- icu/source/common/unicode/umachine.h.orig 2017-03-16 20:01:12.000000000 +0100
2+++ icu/source/common/unicode/umachine.h 2017-04-24 21:51:37.750924621 +0200
3@@ -295,7 +295,7 @@
4 * If 1, then char16_t is a typedef and not a real type (yet)
5 * @internal
6 */
7-#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
8+#if ((U_PLATFORM == U_PF_AIX) || defined(__GNUC__)) && defined(__cplusplus) && (U_CPLUSPLUS_VERSION < 11)
9 // for AIX, uchar.h needs to be included
10 # include <uchar.h>
11 # define U_CHAR16_IS_TYPEDEF 1
12--- icu/source/common/unicode/char16ptr.h.orig 2017-03-29 06:44:37.000000000 +0200
13+++ icu/source/common/unicode/char16ptr.h 2017-04-25 17:32:39.386782173 +0200
14@@ -61,12 +61,14 @@
15 */
16 inline Char16Ptr(wchar_t *p);
17 #endif
18+#ifdef U_HAS_NULLPTR_T
19 /**
20 * nullptr constructor.
21 * @param p nullptr
22 * @draft ICU 59
23 */
24 inline Char16Ptr(std::nullptr_t p);
25+#endif
26 /**
27 * Destructor.
28 * @draft ICU 59
29@@ -114,7 +116,9 @@
30 #if U_SIZEOF_WCHAR_T==2
31 Char16Ptr::Char16Ptr(wchar_t *p) : p(cast(p)) {}
32 #endif
33+#ifdef U_HAS_NULLPTR_T
34 Char16Ptr::Char16Ptr(std::nullptr_t p) : p(p) {}
35+#endif
36 Char16Ptr::~Char16Ptr() {
37 U_ALIASING_BARRIER(p);
38 }
39@@ -130,7 +134,9 @@
40 #if U_SIZEOF_WCHAR_T==2
41 Char16Ptr::Char16Ptr(wchar_t *p) { u.wp = p; }
42 #endif
43+#ifdef U_HAS_NULLPTR_T
44 Char16Ptr::Char16Ptr(std::nullptr_t p) { u.cp = p; }
45+#endif
46 Char16Ptr::~Char16Ptr() {}
47
48 char16_t *Char16Ptr::get() const { return u.cp; }
49@@ -168,12 +174,14 @@
50 */
51 inline ConstChar16Ptr(const wchar_t *p);
52 #endif
53+#ifdef U_HAS_NULLPTR_T
54 /**
55 * nullptr constructor.
56 * @param p nullptr
57 * @draft ICU 59
58 */
59 inline ConstChar16Ptr(const std::nullptr_t p);
60+#endif
61
62 /**
63 * Destructor.
64@@ -222,7 +230,9 @@
65 #if U_SIZEOF_WCHAR_T==2
66 ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p(cast(p)) {}
67 #endif
68+#ifdef U_HAS_NULLPTR_T
69 ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p(p) {}
70+#endif
71 ConstChar16Ptr::~ConstChar16Ptr() {
72 U_ALIASING_BARRIER(p);
73 }
74@@ -238,7 +248,9 @@
75 #if U_SIZEOF_WCHAR_T==2
76 ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u.wp = p; }
77 #endif
78+#ifdef U_HASH_NULLPTR_T
79 ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u.cp = p; }
80+#endif
81 ConstChar16Ptr::~ConstChar16Ptr() {}
82
83 const char16_t *ConstChar16Ptr::get() const { return u.cp; }
84--- icu/source/common/unicode/platform.h.orig 2017-03-22 20:06:26.000000000 +0100
85+++ icu/source/common/unicode/platform.h 2017-04-25 17:30:01.483450642 +0200
86@@ -503,6 +503,10 @@
87 namespace std {
88 typedef decltype(nullptr) nullptr_t;
89 };
90+# define U_HAS_NULLPTR_T 1
91+#elif defined(__cplusplus) && (U_CPLUSPLUS_VERSION >= 11)
92+# define U_HAS_NULLPTR_T 1
93+// else no U_HAS_NULLPTR_T
94 #endif
95
96 /**
97--- icu/source/common/unicode/unistr.h.orig 2017-03-29 06:44:37.000000000 +0200
98+++ icu/source/common/unicode/unistr.h 2017-04-25 17:33:43.030114781 +0200
99@@ -3049,6 +3049,7 @@
100 * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor,
101 * it should always be available regardless of U_HIDE_DRAFT_API status
102 */
103+#ifdef U_HAS_NULLPTR_T
104 /**
105 * nullptr_t constructor.
106 * Effectively the same as the default constructor, makes an empty string object.
107@@ -3060,6 +3061,7 @@
108 * @draft ICU 59
109 */
110 UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
111+#endif
112
113 /**
114 * char16_t* constructor.
115@@ -3108,6 +3110,7 @@
116 * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor,
117 * it should always be available regardless of U_HIDE_DRAFT_API status
118 */
119+#ifdef U_HAS_NULLPTR_T
120 /**
121 * nullptr_t constructor.
122 * Effectively the same as the default constructor, makes an empty string object.
123@@ -3116,6 +3119,7 @@
124 * @draft ICU 59
125 */
126 inline UnicodeString(const std::nullptr_t text, int32_t length);
127+#endif
128
129 /**
130 * Readonly-aliasing char16_t* constructor.
131@@ -3202,6 +3206,7 @@
132 * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor,
133 * it should always be available regardless of U_HIDE_DRAFT_API status
134 */
135+#ifdef U_HAS_NULLPTR_T
136 /**
137 * Writable-aliasing nullptr_t constructor.
138 * Effectively the same as the default constructor, makes an empty string object.
139@@ -3211,6 +3216,7 @@
140 * @draft ICU 59
141 */
142 inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
143+#endif
144
145 #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
146
147@@ -3924,6 +3930,7 @@
148 fUnion.fStackFields.fLengthAndFlags=kShortString;
149 }
150
151+#ifdef U_HAS_NULLPTR_T
152 inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
153 fUnion.fStackFields.fLengthAndFlags=kShortString;
154 }
155@@ -3935,6 +3942,7 @@
156 inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
157 fUnion.fStackFields.fLengthAndFlags=kShortString;
158 }
159+#endif
160
161 //========================================
162 // Read-only implementation methods
163@@ -3985,7 +3993,11 @@
164 inline const char16_t *
165 UnicodeString::getBuffer() const {
166 if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
167+#ifdef U_HAS_NULLPTR_T
168 return nullptr;
169+#else
170+ return 0;
171+#endif
172 } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) {
173 return fUnion.fStackFields.fBuffer;
174 } else {
This page took 0.078754 seconds and 4 git commands to generate.