1 diff -ruNp icu.orig/source/common/unicode/char16ptr.h icu/source/common/unicode/char16ptr.h
2 --- icu.orig/source/common/unicode/char16ptr.h 2018-06-21 11:39:21.000000000 +0200
3 +++ icu/source/common/unicode/char16ptr.h 2018-08-23 19:27:23.581839560 +0200
4 @@ -59,12 +59,14 @@ public:
6 inline Char16Ptr(wchar_t *p);
8 +#ifdef U_HAS_NULLPTR_T
10 * nullptr constructor.
14 inline Char16Ptr(std::nullptr_t p);
19 @@ -112,7 +114,9 @@ Char16Ptr::Char16Ptr(uint16_t *p) : p_(c
20 #if U_SIZEOF_WCHAR_T==2
21 Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {}
23 +#ifdef U_HAS_NULLPTR_T
24 Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {}
26 Char16Ptr::~Char16Ptr() {
27 U_ALIASING_BARRIER(p_);
29 @@ -128,7 +132,9 @@ Char16Ptr::Char16Ptr(uint16_t *p) { u_.u
30 #if U_SIZEOF_WCHAR_T==2
31 Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; }
33 +#ifdef U_HAS_NULLPTR_T
34 Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; }
36 Char16Ptr::~Char16Ptr() {}
38 char16_t *Char16Ptr::get() const { return u_.cp; }
39 @@ -164,12 +170,14 @@ public:
41 inline ConstChar16Ptr(const wchar_t *p);
43 +#ifdef U_HAS_NULLPTR_T
45 * nullptr constructor.
49 inline ConstChar16Ptr(const std::nullptr_t p);
54 @@ -218,7 +226,9 @@ ConstChar16Ptr::ConstChar16Ptr(const uin
55 #if U_SIZEOF_WCHAR_T==2
56 ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {}
58 +#ifdef U_HAS_NULLPTR_T
59 ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {}
61 ConstChar16Ptr::~ConstChar16Ptr() {
62 U_ALIASING_BARRIER(p_);
64 @@ -234,7 +244,9 @@ ConstChar16Ptr::ConstChar16Ptr(const uin
65 #if U_SIZEOF_WCHAR_T==2
66 ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; }
68 +#ifdef U_HASH_NULLPTR_T
69 ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; }
71 ConstChar16Ptr::~ConstChar16Ptr() {}
73 const char16_t *ConstChar16Ptr::get() const { return u_.cp; }
74 diff -ruNp icu.orig/source/common/unicode/platform.h icu/source/common/unicode/platform.h
75 --- icu.orig/source/common/unicode/platform.h 2018-06-21 11:39:21.000000000 +0200
76 +++ icu/source/common/unicode/platform.h 2018-08-23 19:28:11.562612934 +0200
79 typedef decltype(nullptr) nullptr_t;
81 +# define U_HAS_NULLPTR_T 1
82 +#elif defined(__cplusplus) && (U_CPLUSPLUS_VERSION >= 11)
83 +# define U_HAS_NULLPTR_T 1
84 +// else no U_HAS_NULLPTR_T
88 diff -ruNp icu.orig/source/common/unicode/umachine.h icu/source/common/unicode/umachine.h
89 --- icu.orig/source/common/unicode/umachine.h 2018-06-21 11:39:21.000000000 +0200
90 +++ icu/source/common/unicode/umachine.h 2018-08-23 19:24:06.688770067 +0200
91 @@ -295,7 +295,7 @@ typedef int8_t UBool;
92 * If 1, then char16_t is a typedef and not a real type (yet)
95 -#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
96 +#if ((U_PLATFORM == U_PF_AIX) || defined(__GNUC__)) && defined(__cplusplus) && (U_CPLUSPLUS_VERSION < 11)
97 // for AIX, uchar.h needs to be included
99 # define U_CHAR16_IS_TYPEDEF 1
100 diff -ruNp icu.orig/source/common/unicode/unistr.h icu/source/common/unicode/unistr.h
101 --- icu.orig/source/common/unicode/unistr.h 2018-06-21 11:39:21.000000000 +0200
102 +++ icu/source/common/unicode/unistr.h 2018-08-23 19:31:55.790554495 +0200
103 @@ -3026,6 +3026,7 @@ public:
104 UnicodeString(ConstChar16Ptr(text)) {}
107 +#ifdef U_HAS_NULLPTR_T
109 * nullptr_t constructor.
110 * Effectively the same as the default constructor, makes an empty string object.
111 @@ -3037,6 +3038,7 @@ public:
114 UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
118 * char16_t* constructor.
119 @@ -3073,6 +3075,7 @@ public:
120 UnicodeString(ConstChar16Ptr(text), textLength) {}
123 +#ifdef U_HAS_NULLPTR_T
125 * nullptr_t constructor.
126 * Effectively the same as the default constructor, makes an empty string object.
127 @@ -3081,6 +3084,7 @@ public:
130 inline UnicodeString(const std::nullptr_t text, int32_t textLength);
134 * Readonly-aliasing char16_t* constructor.
135 @@ -3155,6 +3159,7 @@ public:
136 UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
139 +#ifdef U_HAS_NULLPTR_T
141 * Writable-aliasing nullptr_t constructor.
142 * Effectively the same as the default constructor, makes an empty string object.
143 @@ -3164,6 +3169,7 @@ public:
146 inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
149 #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
151 @@ -3875,6 +3881,7 @@ UnicodeString::UnicodeString() {
152 fUnion.fStackFields.fLengthAndFlags=kShortString;
155 +#ifdef U_HAS_NULLPTR_T
156 inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
157 fUnion.fStackFields.fLengthAndFlags=kShortString;
159 @@ -3886,6 +3893,7 @@ inline UnicodeString::UnicodeString(cons
160 inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
161 fUnion.fStackFields.fLengthAndFlags=kShortString;
165 //========================================
166 // Read-only implementation methods
167 @@ -3936,7 +3944,11 @@ UnicodeString::isBufferWritable() const
168 inline const char16_t *
169 UnicodeString::getBuffer() const {
170 if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
171 +#ifdef U_HAS_NULLPTR_T
176 } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) {
177 return fUnion.fStackFields.fBuffer;