From 78b1977508764732bf7465262907b3cb7c42fdc0 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 15 Mar 2017 18:08:36 +0000 Subject: [PATCH] ICU-12766 aix/escaper: tests now build on AIX * fix to UNICODE_STRING_SIMPLE for char16_t aliasing X-SVN-Rev: 39821 --- icu4c/source/common/unicode/umachine.h | 5 ++++- icu4c/source/common/unicode/unistr.h | 15 ++++++--------- icu4c/source/extra/uconv/uconv.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index e43b215f689..3ba9161d2a5 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -291,9 +291,12 @@ typedef int8_t UBool; #define U_SIZEOF_UCHAR 2 /** - * for AIX, uchar.h needs to be included + * \def U_CHAR16_IS_TYPEDEF + * 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) +// for AIX, uchar.h needs to be included # include # define U_CHAR16_IS_TYPEDEF 1 #else diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h index e5132f19223..428793f17c8 100644 --- a/icu4c/source/common/unicode/unistr.h +++ b/icu4c/source/common/unicode/unistr.h @@ -119,7 +119,11 @@ class UnicodeStringAppendable; // unicode/appendable.h * NUL, must be specified as a constant. * @stable ICU 2.0 */ -#define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) +#if !U_CHAR16_IS_TYPEDEF +# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) +#else +# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) +#endif /** * Unicode String literals in C++. @@ -3033,7 +3037,6 @@ public: UnicodeString(ConstChar16Ptr(text)) {} #endif -#if !U_NO_NULLPTR_T /** * nullptr_t constructor. * Effectively the same as the default constructor, makes an empty string object. @@ -3045,7 +3048,6 @@ public: * @draft ICU 59 */ UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); -#endif /** * char16_t* constructor. @@ -3082,7 +3084,6 @@ public: UnicodeString(ConstChar16Ptr(text), length) {} #endif -#if !U_NO_NULLPTR_T /** * nullptr_t constructor. * Effectively the same as the default constructor, makes an empty string object. @@ -3091,7 +3092,7 @@ public: * @draft ICU 59 */ inline UnicodeString(const std::nullptr_t text, int32_t length); -#endif + /** * Readonly-aliasing char16_t* constructor. * The text will be used for the UnicodeString object, but @@ -3165,7 +3166,6 @@ public: UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} #endif -#if !U_NO_NULLPTR_T /** * Writable-aliasing nullptr_t constructor. * Effectively the same as the default constructor, makes an empty string object. @@ -3175,7 +3175,6 @@ public: * @draft ICU 59 */ inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); -#endif #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION @@ -3889,7 +3888,6 @@ UnicodeString::UnicodeString() { fUnion.fStackFields.fLengthAndFlags=kShortString; } -#if !U_NO_NULLPTR_T inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { fUnion.fStackFields.fLengthAndFlags=kShortString; } @@ -3901,7 +3899,6 @@ inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*len inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { fUnion.fStackFields.fLengthAndFlags=kShortString; } -#endif //======================================== // Read-only implementation methods diff --git a/icu4c/source/extra/uconv/uconv.cpp b/icu4c/source/extra/uconv/uconv.cpp index ba5d06af3ac..3bc807c819d 100644 --- a/icu4c/source/extra/uconv/uconv.cpp +++ b/icu4c/source/extra/uconv/uconv.cpp @@ -659,7 +659,7 @@ ConvertFile::convertFile(const char *pname, parse.line = -1; if (uprv_strchr(translit, ':') || uprv_strchr(translit, '>') || uprv_strchr(translit, '<') || uprv_strchr(translit, '>')) { - t = Transliterator::createFromRules(UnicodeString(u"Uconv"), str, UTRANS_FORWARD, parse, err); + t = Transliterator::createFromRules(UNICODE_STRING_SIMPLE("Uconv"), str, UTRANS_FORWARD, parse, err); } else { t = Transliterator::createInstance(UnicodeString(translit, -1, US_INV), UTRANS_FORWARD, err); } -- 2.40.0