View | Details | Raw Unified | Return to bug 222433 | Differences between
and this patch

Collapse All | Expand All

(-)b/devel/icu/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	icu
4
PORTNAME=	icu
5
DISTVERSION=	60_2
5
DISTVERSION=	60_2
6
PORTREVISION?=	1 # keep for icu-lx
6
PORTREVISION?=	2 # keep for icu-lx
7
PORTEPOCH?=	1
7
PORTEPOCH?=	1
8
CATEGORIES?=	devel
8
CATEGORIES?=	devel
9
MASTER_SITES=	http://download.icu-project.org/files/icu4c/${PORTVERSION}/ \
9
MASTER_SITES=	http://download.icu-project.org/files/icu4c/${PORTVERSION}/ \
(-)b/devel/icu/files/patch-common_unicode_platform.h (-18 lines)
Lines 11-31 Link Here
11
 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
11
 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
12
     /* gcc */
12
     /* gcc */
13
 #   define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
13
 #   define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
14
@@ -498,11 +498,15 @@
15
 #   define U_CPLUSPLUS_VERSION 1
16
 #endif
17
 
18
-#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
19
+#if defined(__cplusplus) && (U_CPLUSPLUS_VERSION < 11)
20
 // add in std::nullptr_t
21
 namespace std {
22
+#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390)
23
   typedef decltype(nullptr) nullptr_t;
24
-};
25
+#elif defined(__GNUC__) && !defined(__clang__)
26
+  typedef __decltype(__null) nullptr_t;
27
+#endif
28
+}
29
 #endif
30
 
31
 /**
(-)a/devel/icu/files/patch-common_unicode_umachine.h (-11 lines)
Removed Link Here
1
--- common/unicode/umachine.h.orig	2017-03-16 19:01:12 UTC
2
+++ common/unicode/umachine.h
3
@@ -295,7 +295,7 @@ typedef int8_t UBool;
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 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
(-)a/devel/icu/files/patch-common_unicode_unistr.h (-33 lines)
Removed Link Here
1
--- common/unicode/unistr.h.orig	2017-03-29 04:44:37 UTC
2
+++ common/unicode/unistr.h
3
@@ -117,12 +117,20 @@ class UnicodeStringAppendable;  // unicode/appendable.
4
  * The string parameter must be a C string literal.
5
  * The length of the string, not including the terminating
6
  * <code>NUL</code>, must be specified as a constant.
7
+ * The U_STRING_DECL macro should be invoked exactly once for one
8
+ * such string variable before it is used.
9
  * @stable ICU 2.0
10
  */
11
 #if !U_CHAR16_IS_TYPEDEF
12
 # define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length)
13
+#elif defined(U_DECLARE_UTF16)
14
+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t *)U_DECLARE_UTF16(cs), _length)
15
+#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
16
+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t *)L ## cs, _length)
17
+#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
18
+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t *)cs, _length)
19
 #else
20
-# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length)
21
+# define UNICODE_STRING(cs, _length) icu::UnicodeString(cs, _length, US_INV)
22
 #endif
23
 
24
 /**
25
@@ -3985,7 +3993,7 @@ UnicodeString::isBufferWritable() const
26
 inline const char16_t *
27
 UnicodeString::getBuffer() const {
28
   if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
29
-    return nullptr;
30
+    return NULL;
31
   } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) {
32
     return fUnion.fStackFields.fBuffer;
33
   } else {
(-)a/devel/icu/files/patch-revert-r40077 (-297 lines)
Removed Link Here
1
Revert https://ssl.icu-project.org/trac/changeset/40077
2
until https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222433
3
4
--- common/cmemory.h.orig	2017-10-06 01:37:59 UTC
5
+++ common/cmemory.h
6
@@ -162,6 +162,7 @@ class LocalMemory : public LocalPointerBase<T> { (publ
7
      * @param p simple pointer to an array of T items that is adopted
8
      */
9
     explicit LocalMemory(T *p=NULL) : LocalPointerBase<T>(p) {}
10
+#if U_HAVE_RVALUE_REFERENCES
11
     /**
12
      * Move constructor, leaves src with isNull().
13
      * @param src source smart pointer
14
@@ -169,12 +170,14 @@ class LocalMemory : public LocalPointerBase<T> { (publ
15
     LocalMemory(LocalMemory<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
16
         src.ptr=NULL;
17
     }
18
+#endif
19
     /**
20
      * Destructor deletes the memory it owns.
21
      */
22
     ~LocalMemory() {
23
         uprv_free(LocalPointerBase<T>::ptr);
24
     }
25
+#if U_HAVE_RVALUE_REFERENCES
26
     /**
27
      * Move assignment operator, leaves src with isNull().
28
      * The behavior is undefined if *this and src are the same object.
29
@@ -184,6 +187,7 @@ class LocalMemory : public LocalPointerBase<T> { (publ
30
     LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
31
         return moveFrom(src);
32
     }
33
+#endif
34
     /**
35
      * Move assignment, leaves src with isNull().
36
      * The behavior is undefined if *this and src are the same object.
37
--- common/unicode/localpointer.h.orig	2017-04-26 20:23:44 UTC
38
+++ common/unicode/localpointer.h
39
@@ -213,6 +213,7 @@ class LocalPointer : public LocalPointerBase<T> { (pub
40
             errorCode=U_MEMORY_ALLOCATION_ERROR;
41
         }
42
     }
43
+#if U_HAVE_RVALUE_REFERENCES
44
     /**
45
      * Move constructor, leaves src with isNull().
46
      * @param src source smart pointer
47
@@ -221,6 +222,7 @@ class LocalPointer : public LocalPointerBase<T> { (pub
48
     LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
49
         src.ptr=NULL;
50
     }
51
+#endif
52
     /**
53
      * Destructor deletes the object it owns.
54
      * @stable ICU 4.4
55
@@ -228,6 +230,7 @@ class LocalPointer : public LocalPointerBase<T> { (pub
56
     ~LocalPointer() {
57
         delete LocalPointerBase<T>::ptr;
58
     }
59
+#if U_HAVE_RVALUE_REFERENCES
60
     /**
61
      * Move assignment operator, leaves src with isNull().
62
      * The behavior is undefined if *this and src are the same object.
63
@@ -238,6 +241,7 @@ class LocalPointer : public LocalPointerBase<T> { (pub
64
     LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
65
         return moveFrom(src);
66
     }
67
+#endif
68
     // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
69
     /**
70
      * Move assignment, leaves src with isNull().
71
@@ -358,6 +362,7 @@ class LocalArray : public LocalPointerBase<T> { (publi
72
             errorCode=U_MEMORY_ALLOCATION_ERROR;
73
         }
74
     }
75
+#if U_HAVE_RVALUE_REFERENCES
76
     /**
77
      * Move constructor, leaves src with isNull().
78
      * @param src source smart pointer
79
@@ -366,6 +371,7 @@ class LocalArray : public LocalPointerBase<T> { (publi
80
     LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
81
         src.ptr=NULL;
82
     }
83
+#endif
84
     /**
85
      * Destructor deletes the array it owns.
86
      * @stable ICU 4.4
87
@@ -373,6 +379,7 @@ class LocalArray : public LocalPointerBase<T> { (publi
88
     ~LocalArray() {
89
         delete[] LocalPointerBase<T>::ptr;
90
     }
91
+#if U_HAVE_RVALUE_REFERENCES
92
     /**
93
      * Move assignment operator, leaves src with isNull().
94
      * The behavior is undefined if *this and src are the same object.
95
@@ -383,6 +390,7 @@ class LocalArray : public LocalPointerBase<T> { (publi
96
     LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
97
         return moveFrom(src);
98
     }
99
+#endif
100
     // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
101
     /**
102
      * Move assignment, leaves src with isNull().
103
@@ -484,6 +492,7 @@ class LocalArray : public LocalPointerBase<T> { (publi
104
  * @see LocalPointer
105
  * @stable ICU 4.4
106
  */
107
+#if U_HAVE_RVALUE_REFERENCES
108
 #define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
109
     class LocalPointerClassName : public LocalPointerBase<Type> { \
110
     public: \
111
@@ -517,6 +526,34 @@ class LocalArray : public LocalPointerBase<T> { (publi
112
             ptr=p; \
113
         } \
114
     }
115
+#else
116
+#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
117
+    class LocalPointerClassName : public LocalPointerBase<Type> { \
118
+    public: \
119
+        using LocalPointerBase<Type>::operator*; \
120
+        using LocalPointerBase<Type>::operator->; \
121
+        explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
122
+        ~LocalPointerClassName() { closeFunction(ptr); } \
123
+        LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
124
+            if (ptr != NULL) { closeFunction(ptr); } \
125
+            LocalPointerBase<Type>::ptr=src.ptr; \
126
+            src.ptr=NULL; \
127
+            return *this; \
128
+        } \
129
+        void swap(LocalPointerClassName &other) U_NOEXCEPT { \
130
+            Type *temp=LocalPointerBase<Type>::ptr; \
131
+            LocalPointerBase<Type>::ptr=other.ptr; \
132
+            other.ptr=temp; \
133
+        } \
134
+        friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \
135
+            p1.swap(p2); \
136
+        } \
137
+        void adoptInstead(Type *p) { \
138
+            if (ptr != NULL) { closeFunction(ptr); } \
139
+            ptr=p; \
140
+        } \
141
+    }
142
+#endif
143
 
144
 U_NAMESPACE_END
145
 
146
--- common/unicode/platform.h.orig	2017-10-05 00:47:38 UTC
147
+++ common/unicode/platform.h
148
@@ -499,6 +499,22 @@ namespace std {
149
 #endif
150
 
151
 /**
152
+ * \def U_HAVE_RVALUE_REFERENCES
153
+ * Set to 1 if the compiler supports rvalue references.
154
+ * C++11 feature, necessary for move constructor & move assignment.
155
+ * @internal
156
+ */
157
+#ifdef U_HAVE_RVALUE_REFERENCES
158
+    /* Use the predefined value. */
159
+#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_rvalue_references) \
160
+        || defined(__GXX_EXPERIMENTAL_CXX0X__) \
161
+        || (defined(_MSC_VER) && _MSC_VER >= 1600)  /* Visual Studio 2010 */
162
+#   define U_HAVE_RVALUE_REFERENCES 1
163
+#else
164
+#   define U_HAVE_RVALUE_REFERENCES 0
165
+#endif
166
+
167
+/**
168
  * \def U_NOEXCEPT
169
  * "noexcept" if supported, otherwise empty.
170
  * Some code, especially STL containers, uses move semantics of objects only
171
--- common/unicode/unistr.h.orig	2017-09-14 19:20:49 UTC
172
+++ common/unicode/unistr.h
173
@@ -1891,6 +1891,7 @@ class U_COMMON_API UnicodeString : public Replaceable 
174
    */
175
   UnicodeString &fastCopyFrom(const UnicodeString &src);
176
 
177
+#if U_HAVE_RVALUE_REFERENCES
178
   /**
179
    * Move assignment operator, might leave src in bogus state.
180
    * This string will have the same contents and state that the source string had.
181
@@ -1902,7 +1903,7 @@ class U_COMMON_API UnicodeString : public Replaceable 
182
   UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT {
183
     return moveFrom(src);
184
   }
185
-
186
+#endif
187
   // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
188
   /**
189
    * Move assignment, might leave src in bogus state.
190
@@ -3349,6 +3350,7 @@ class U_COMMON_API UnicodeString : public Replaceable 
191
    */
192
   UnicodeString(const UnicodeString& that);
193
 
194
+#if U_HAVE_RVALUE_REFERENCES
195
   /**
196
    * Move constructor, might leave src in bogus state.
197
    * This string will have the same contents and state that the source string had.
198
@@ -3356,6 +3358,7 @@ class U_COMMON_API UnicodeString : public Replaceable 
199
    * @stable ICU 56
200
    */
201
   UnicodeString(UnicodeString &&src) U_NOEXCEPT;
202
+#endif
203
 
204
   /**
205
    * 'Substring' constructor from tail of source string.
206
--- common/unistr.cpp.orig	2017-04-26 20:23:44 UTC
207
+++ common/unistr.cpp
208
@@ -308,10 +308,12 @@ UnicodeString::UnicodeString(const UnicodeString& that
209
   copyFrom(that);
210
 }
211
 
212
+#if U_HAVE_RVALUE_REFERENCES
213
 UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT {
214
   fUnion.fFields.fLengthAndFlags = kShortString;
215
   moveFrom(src);
216
 }
217
+#endif
218
 
219
 UnicodeString::UnicodeString(const UnicodeString& that,
220
                              int32_t srcStart) {
221
--- test/intltest/itutil.cpp.orig	2017-04-26 20:23:44 UTC
222
+++ test/intltest/itutil.cpp
223
@@ -375,6 +375,7 @@ void LocalPointerTest::TestLocalPointerMoveSwap() {
224
     if(s3.getAlias() != p1 || s1.isValid()) {
225
         errln("LocalPointer.moveFrom() did not move");
226
     }
227
+#if U_HAVE_RVALUE_REFERENCES
228
     infoln("TestLocalPointerMoveSwap() with rvalue references");
229
     s1 = static_cast<LocalPointer<UnicodeString> &&>(s3);
230
     if(s1.getAlias() != p1 || s3.isValid()) {
231
@@ -384,6 +385,9 @@ void LocalPointerTest::TestLocalPointerMoveSwap() {
232
     if(s4.getAlias() != p2 || s2.isValid()) {
233
         errln("LocalPointer move constructor did not move");
234
     }
235
+#else
236
+    infoln("TestLocalPointerMoveSwap() without rvalue references");
237
+#endif
238
 
239
     // Move self assignment leaves the object valid but in an undefined state.
240
     // Do it to make sure there is no crash,
241
@@ -468,6 +472,7 @@ void LocalPointerTest::TestLocalArrayMoveSwap() {
242
     if(a3.getAlias() != p1 || a1.isValid()) {
243
         errln("LocalArray.moveFrom() did not move");
244
     }
245
+#if U_HAVE_RVALUE_REFERENCES
246
     infoln("TestLocalArrayMoveSwap() with rvalue references");
247
     a1 = static_cast<LocalArray<UnicodeString> &&>(a3);
248
     if(a1.getAlias() != p1 || a3.isValid()) {
249
@@ -477,6 +482,9 @@ void LocalPointerTest::TestLocalArrayMoveSwap() {
250
     if(a4.getAlias() != p2 || a2.isValid()) {
251
         errln("LocalArray move constructor did not move");
252
     }
253
+#else
254
+    infoln("TestLocalArrayMoveSwap() without rvalue references");
255
+#endif
256
 
257
     // Move self assignment leaves the object valid but in an undefined state.
258
     // Do it to make sure there is no crash,
259
@@ -636,6 +644,7 @@ void LocalPointerTest::TestLocalXyzPointerMoveSwap() {
260
     if(f3.getAlias() != p1 || f1.isValid()) {
261
         errln("LocalUNormalizer2Pointer.moveFrom() did not move");
262
     }
263
+#if U_HAVE_RVALUE_REFERENCES
264
     infoln("TestLocalXyzPointerMoveSwap() with rvalue references");
265
     f1 = static_cast<LocalUNormalizer2Pointer &&>(f3);
266
     if(f1.getAlias() != p1 || f3.isValid()) {
267
@@ -645,6 +654,9 @@ void LocalPointerTest::TestLocalXyzPointerMoveSwap() {
268
     if(f4.getAlias() != p2 || f2.isValid()) {
269
         errln("LocalUNormalizer2Pointer move constructor did not move");
270
     }
271
+#else
272
+    infoln("TestLocalXyzPointerMoveSwap() without rvalue references");
273
+#endif
274
     // Move self assignment leaves the object valid but in an undefined state.
275
     // Do it to make sure there is no crash,
276
     // but do not check for any particular resulting value.
277
--- test/intltest/ustrtest.cpp.orig	2017-09-21 23:45:08 UTC
278
+++ test/intltest/ustrtest.cpp
279
@@ -2160,6 +2160,7 @@ UnicodeStringTest::TestMoveSwap() {
280
     if(s6.getBuffer() != abc || s6.length() != 3) {
281
         errln("UnicodeString.moveFrom(alias) did not move");
282
     }
283
+#if U_HAVE_RVALUE_REFERENCES
284
     infoln("TestMoveSwap() with rvalue references");
285
     s1 = static_cast<UnicodeString &&>(s6);
286
     if(s1.getBuffer() != abc || s1.length() != 3) {
287
@@ -2169,6 +2170,10 @@ UnicodeStringTest::TestMoveSwap() {
288
     if(s7.getBuffer() != p || s7.length() != 100 || !s4.isBogus()) {
289
         errln("UnicodeString move constructor did not move");
290
     }
291
+#else
292
+    infoln("TestMoveSwap() without rvalue references");
293
+    UnicodeString s7;
294
+#endif
295
 
296
     // Move self assignment leaves the object valid but in an undefined state.
297
     // Do it to make sure there is no crash,

Return to bug 222433