]> git.pld-linux.org Git - packages/icu.git/blobdiff - 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
diff --git a/icu-cxx-pre11.patch b/icu-cxx-pre11.patch
new file mode 100644 (file)
index 0000000..3a4457a
--- /dev/null
@@ -0,0 +1,174 @@
+--- icu/source/common/unicode/umachine.h.orig  2017-03-16 20:01:12.000000000 +0100
++++ icu/source/common/unicode/umachine.h       2017-04-24 21:51:37.750924621 +0200
+@@ -295,7 +295,7 @@
+  * If 1, then char16_t is a typedef and not a real type (yet)
+  * @internal
+  */
+-#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
++#if ((U_PLATFORM == U_PF_AIX) || defined(__GNUC__)) && defined(__cplusplus) && (U_CPLUSPLUS_VERSION < 11)
+ // for AIX, uchar.h needs to be included
+ # include <uchar.h>
+ # define U_CHAR16_IS_TYPEDEF 1
+--- icu/source/common/unicode/char16ptr.h.orig 2017-03-29 06:44:37.000000000 +0200
++++ icu/source/common/unicode/char16ptr.h      2017-04-25 17:32:39.386782173 +0200
+@@ -61,12 +61,14 @@
+      */
+     inline Char16Ptr(wchar_t *p);
+ #endif
++#ifdef U_HAS_NULLPTR_T
+     /**
+      * nullptr constructor.
+      * @param p nullptr
+      * @draft ICU 59
+      */
+     inline Char16Ptr(std::nullptr_t p);
++#endif
+     /**
+      * Destructor.
+      * @draft ICU 59
+@@ -114,7 +116,9 @@
+ #if U_SIZEOF_WCHAR_T==2
+ Char16Ptr::Char16Ptr(wchar_t *p) : p(cast(p)) {}
+ #endif
++#ifdef U_HAS_NULLPTR_T
+ Char16Ptr::Char16Ptr(std::nullptr_t p) : p(p) {}
++#endif
+ Char16Ptr::~Char16Ptr() {
+     U_ALIASING_BARRIER(p);
+ }
+@@ -130,7 +134,9 @@
+ #if U_SIZEOF_WCHAR_T==2
+ Char16Ptr::Char16Ptr(wchar_t *p) { u.wp = p; }
+ #endif
++#ifdef U_HAS_NULLPTR_T
+ Char16Ptr::Char16Ptr(std::nullptr_t p) { u.cp = p; }
++#endif
+ Char16Ptr::~Char16Ptr() {}
+ char16_t *Char16Ptr::get() const { return u.cp; }
+@@ -168,12 +174,14 @@
+      */
+     inline ConstChar16Ptr(const wchar_t *p);
+ #endif
++#ifdef U_HAS_NULLPTR_T
+     /**
+      * nullptr constructor.
+      * @param p nullptr
+      * @draft ICU 59
+      */
+     inline ConstChar16Ptr(const std::nullptr_t p);
++#endif
+     /**
+      * Destructor.
+@@ -222,7 +230,9 @@
+ #if U_SIZEOF_WCHAR_T==2
+ ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p(cast(p)) {}
+ #endif
++#ifdef U_HAS_NULLPTR_T
+ ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p(p) {}
++#endif
+ ConstChar16Ptr::~ConstChar16Ptr() {
+     U_ALIASING_BARRIER(p);
+ }
+@@ -238,7 +248,9 @@
+ #if U_SIZEOF_WCHAR_T==2
+ ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u.wp = p; }
+ #endif
++#ifdef U_HASH_NULLPTR_T
+ ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u.cp = p; }
++#endif
+ ConstChar16Ptr::~ConstChar16Ptr() {}
+ const char16_t *ConstChar16Ptr::get() const { return u.cp; }
+--- icu/source/common/unicode/platform.h.orig  2017-03-22 20:06:26.000000000 +0100
++++ icu/source/common/unicode/platform.h       2017-04-25 17:30:01.483450642 +0200
+@@ -503,6 +503,10 @@
+ namespace std {
+   typedef decltype(nullptr) nullptr_t;
+ };
++#   define U_HAS_NULLPTR_T 1
++#elif defined(__cplusplus) && (U_CPLUSPLUS_VERSION >= 11)
++#   define U_HAS_NULLPTR_T 1
++// else no U_HAS_NULLPTR_T
+ #endif
+ /**
+--- icu/source/common/unicode/unistr.h.orig    2017-03-29 06:44:37.000000000 +0200
++++ icu/source/common/unicode/unistr.h 2017-04-25 17:33:43.030114781 +0200
+@@ -3049,6 +3049,7 @@
+    * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor,
+    * it should always be available regardless of U_HIDE_DRAFT_API status
+    */
++#ifdef U_HAS_NULLPTR_T
+   /**
+    * nullptr_t constructor.
+    * Effectively the same as the default constructor, makes an empty string object.
+@@ -3060,6 +3061,7 @@
+    * @draft ICU 59
+    */
+   UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text);
++#endif
+   /**
+    * char16_t* constructor.
+@@ -3108,6 +3110,7 @@
+    * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor,
+    * it should always be available regardless of U_HIDE_DRAFT_API status
+    */
++#ifdef U_HAS_NULLPTR_T
+   /**
+    * nullptr_t constructor.
+    * Effectively the same as the default constructor, makes an empty string object.
+@@ -3116,6 +3119,7 @@
+    * @draft ICU 59
+    */
+   inline UnicodeString(const std::nullptr_t text, int32_t length);
++#endif
+   /**
+    * Readonly-aliasing char16_t* constructor.
+@@ -3202,6 +3206,7 @@
+    * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor,
+    * it should always be available regardless of U_HIDE_DRAFT_API status
+    */
++#ifdef U_HAS_NULLPTR_T
+   /**
+    * Writable-aliasing nullptr_t constructor.
+    * Effectively the same as the default constructor, makes an empty string object.
+@@ -3211,6 +3216,7 @@
+    * @draft ICU 59
+    */
+   inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity);
++#endif
+ #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
+@@ -3924,6 +3930,7 @@
+   fUnion.fStackFields.fLengthAndFlags=kShortString;
+ }
++#ifdef U_HAS_NULLPTR_T
+ inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) {
+   fUnion.fStackFields.fLengthAndFlags=kShortString;
+ }
+@@ -3935,6 +3942,7 @@
+ inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) {
+   fUnion.fStackFields.fLengthAndFlags=kShortString;
+ }
++#endif
+ //========================================
+ // Read-only implementation methods
+@@ -3985,7 +3993,11 @@
+ inline const char16_t *
+ UnicodeString::getBuffer() const {
+   if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) {
++#ifdef U_HAS_NULLPTR_T
+     return nullptr;
++#else
++    return 0;
++#endif
+   } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) {
+     return fUnion.fStackFields.fBuffer;
+   } else {
This page took 0.10473 seconds and 4 git commands to generate.