Index: src/locale.cpp |
diff --git a/src/locale.cpp b/src/locale.cpp |
index 191b2390e20e185f987e68e09e3c137a9a568cf6..de13d79d1adf8e2be8a2513ddad202ea19fc5ba2 100644 |
--- a/src/locale.cpp |
+++ b/src/locale.cpp |
@@ -810,7 +810,8 @@ ctype<wchar_t>::do_toupper(char_type c) const |
{ |
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE |
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c; |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ |
+ defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c; |
#else |
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c; |
@@ -823,7 +824,8 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const |
for (; low != high; ++low) |
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE |
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low; |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ |
+ defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low] |
: *low; |
#else |
@@ -837,7 +839,8 @@ ctype<wchar_t>::do_tolower(char_type c) const |
{ |
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE |
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c; |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ |
+ defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c; |
#else |
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c; |
@@ -850,7 +853,8 @@ ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const |
for (; low != high; ++low) |
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE |
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low; |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \ |
+ defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low] |
: *low; |
#else |
@@ -919,8 +923,8 @@ ctype<char>::do_toupper(char_type c) const |
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c; |
#elif defined(__NetBSD__) |
return static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]); |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) |
- return isascii(c) ? |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
+ return isascii(c) ? |
static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c; |
#else |
return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c; |
@@ -936,7 +940,7 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const |
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low; |
#elif defined(__NetBSD__) |
*low = static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(*low)]); |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
*low = isascii(*low) ? |
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low; |
#else |
@@ -953,7 +957,7 @@ ctype<char>::do_tolower(char_type c) const |
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c; |
#elif defined(__NetBSD__) |
return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]); |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
return isascii(c) ? |
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c; |
#else |
@@ -969,7 +973,7 @@ ctype<char>::do_tolower(char_type* low, const char_type* high) const |
*low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low; |
#elif defined(__NetBSD__) |
*low = static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(*low)]); |
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) |
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
*low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low; |
#else |
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low; |
@@ -1010,7 +1014,7 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault, |
return low; |
} |
-#ifdef __EMSCRIPTEN__ |
+#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
extern "C" const unsigned short ** __ctype_b_loc(); |
extern "C" const int ** __ctype_tolower_loc(); |
extern "C" const int ** __ctype_toupper_loc(); |
@@ -1031,7 +1035,7 @@ ctype<char>::classic_table() _NOEXCEPT |
return _ctype+1; // internal ctype mask table defined in msvcrt.dll |
// This is assumed to be safe, which is a nonsense assumption because we're |
// going to end up dereferencing it later... |
-#elif defined(__EMSCRIPTEN__) |
+#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
return *__ctype_b_loc(); |
#elif defined(_NEWLIB_VERSION) // @LOCALMOD-START |
// Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1]. |
@@ -1076,7 +1080,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT |
return _C_toupper_tab_ + 1; |
} |
-#elif defined(__EMSCRIPTEN__) |
+#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC) |
const int* |
ctype<char>::__classic_lower_table() _NOEXCEPT |
{ |
@@ -1088,7 +1092,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT |
{ |
return *__ctype_toupper_loc(); |
} |
-#endif // __GLIBC__ || __EMSCRIPTEN__ || __NETBSD__ |
+#endif // __GLIBC__ || __NETBSD__ || __EMSCRIPTEN__ || defined(_LIBCPP_HAS_MUSL_LIBC) |
// template <> class ctype_byname<char> |