diff -rupN a/stdlib/public/stubs/UnicodeNormalization.cpp b/stdlib/public/stubs/UnicodeNormalization.cpp --- a/stdlib/public/stubs/UnicodeNormalization.cpp 2017-05-02 15:42:43.465819610 -0700 +++ b/stdlib/public/stubs/UnicodeNormalization.cpp 2017-05-02 15:46:47.788404828 -0700 @@ -86,11 +86,7 @@ private: for (unsigned char c = 0; c < 128; ++c) { UErrorCode ErrorCode = U_ZERO_ERROR; intptr_t NumCollationElts = 0; -#if defined(__CYGWIN__) || defined(_MSC_VER) UChar Buffer[1]; -#else - uint16_t Buffer[1]; -#endif Buffer[0] = c; UCollationElements *CollationIterator = @@ -127,18 +123,12 @@ swift::_swift_stdlib_unicode_compare_utf int32_t LeftLength, const uint16_t *RightString, int32_t RightLength) { -#if defined(__CYGWIN__) || defined(_MSC_VER) - // ICU UChar type is platform dependent. In Cygwin, it is defined - // as wchar_t which size is 2. It seems that the underlying binary + // ICU UChar type is always char16_t as of ICU 59. + // It seems that the underlying binary // representation is same with swift utf16 representation. return ucol_strcoll(GetRootCollator(), reinterpret_cast(LeftString), LeftLength, reinterpret_cast(RightString), RightLength); -#else - return ucol_strcoll(GetRootCollator(), - LeftString, LeftLength, - RightString, RightLength); -#endif } /// Compares the strings via the Unicode Collation Algorithm on the root locale. @@ -156,12 +146,8 @@ swift::_swift_stdlib_unicode_compare_utf UErrorCode ErrorCode = U_ZERO_ERROR; uiter_setUTF8(&LeftIterator, reinterpret_cast(LeftString), LeftLength); -#if defined(__CYGWIN__) || defined(_MSC_VER) uiter_setString(&RightIterator, reinterpret_cast(RightString), RightLength); -#else - uiter_setString(&RightIterator, RightString, RightLength); -#endif uint32_t Diff = ucol_strcollIter(GetRootCollator(), &LeftIterator, &RightIterator, &ErrorCode); @@ -199,14 +185,9 @@ swift::_swift_stdlib_unicode_compare_utf void *swift::_swift_stdlib_unicodeCollationIterator_create( const __swift_uint16_t *Str, __swift_uint32_t Length) { UErrorCode ErrorCode = U_ZERO_ERROR; -#if defined(__CYGWIN__) || defined(_MSC_VER) UCollationElements *CollationIterator = ucol_openElements( GetRootCollator(), reinterpret_cast(Str), Length, &ErrorCode); -#else - UCollationElements *CollationIterator = ucol_openElements( - GetRootCollator(), Str, Length, &ErrorCode); -#endif if (U_FAILURE(ErrorCode)) { swift::crash("_swift_stdlib_unicodeCollationIterator_create: ucol_openElements() failed."); } @@ -244,17 +225,11 @@ swift::_swift_stdlib_unicode_strToUpper( const uint16_t *Source, int32_t SourceLength) { UErrorCode ErrorCode = U_ZERO_ERROR; -#if defined(__CYGWIN__) || defined(_MSC_VER) uint32_t OutputLength = u_strToUpper(reinterpret_cast(Destination), DestinationCapacity, reinterpret_cast(Source), SourceLength, "", &ErrorCode); -#else - uint32_t OutputLength = u_strToUpper(Destination, DestinationCapacity, - Source, SourceLength, - "", &ErrorCode); -#endif if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) { swift::crash("u_strToUpper: Unexpected error uppercasing unicode string."); } @@ -271,17 +246,11 @@ swift::_swift_stdlib_unicode_strToLower( const uint16_t *Source, int32_t SourceLength) { UErrorCode ErrorCode = U_ZERO_ERROR; -#if defined(__CYGWIN__) || defined(_MSC_VER) uint32_t OutputLength = u_strToLower(reinterpret_cast(Destination), DestinationCapacity, reinterpret_cast(Source), SourceLength, "", &ErrorCode); -#else - uint32_t OutputLength = u_strToLower(Destination, DestinationCapacity, - Source, SourceLength, - "", &ErrorCode); -#endif if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) { swift::crash("u_strToLower: Unexpected error lowercasing unicode string."); }