Use libcxx's default rune table with the Musl C library.
Summary: Also, there are no exported character type tables from Musl so we have to Fallback to the standard functions. This reduces the number of libcxx's test-suite failures down to ~130 for MIPS. Most of the remaining failures come from the atomics (due to the lack of 8-byte atomic-ops in MIPS32) and thread tests. Reviewers: mclow.lists, EricWF, dalias, jroelofs Subscribers: tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D14926 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@253972 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a660757c72
commit
5e00a713ed
@ -804,7 +804,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_STDOUT
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) || defined(__CloudABI__)
|
||||
#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||
#endif
|
||||
|
||||
|
@ -361,7 +361,7 @@ public:
|
||||
typedef __uint32_t mask;
|
||||
# elif defined(__FreeBSD__)
|
||||
typedef unsigned long mask;
|
||||
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
|
||||
typedef unsigned short mask;
|
||||
# endif
|
||||
static const mask space = _CTYPE_S;
|
||||
@ -407,12 +407,8 @@ public:
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
|
||||
#else
|
||||
#if defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
typedef unsigned short mask;
|
||||
#else
|
||||
typedef unsigned long mask;
|
||||
#endif
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
@ -634,7 +630,7 @@ public:
|
||||
#endif
|
||||
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
|
||||
static const mask* classic_table() _NOEXCEPT;
|
||||
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
static const int* __classic_upper_table() _NOEXCEPT;
|
||||
static const int* __classic_lower_table() _NOEXCEPT;
|
||||
#endif
|
||||
|
@ -813,7 +813,7 @@ 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__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
defined(__NetBSD__)
|
||||
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
|
||||
#else
|
||||
return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
|
||||
@ -827,7 +827,7 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
|
||||
defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
defined(__NetBSD__)
|
||||
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
|
||||
: *low;
|
||||
#else
|
||||
@ -842,7 +842,7 @@ 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__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
defined(__NetBSD__)
|
||||
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
|
||||
#else
|
||||
return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
|
||||
@ -856,7 +856,7 @@ ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
|
||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
|
||||
defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
defined(__NetBSD__)
|
||||
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
|
||||
: *low;
|
||||
#else
|
||||
@ -925,7 +925,7 @@ 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__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
return isascii(c) ?
|
||||
static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
|
||||
#else
|
||||
@ -942,7 +942,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__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
*low = isascii(*low) ?
|
||||
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
|
||||
#else
|
||||
@ -959,7 +959,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(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
return isascii(c) ?
|
||||
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
|
||||
#else
|
||||
@ -975,7 +975,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__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
|
||||
*low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
|
||||
#else
|
||||
*low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
|
||||
@ -1016,7 +1016,7 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
|
||||
return low;
|
||||
}
|
||||
|
||||
#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
extern "C" const unsigned short ** __ctype_b_loc();
|
||||
extern "C" const int ** __ctype_tolower_loc();
|
||||
extern "C" const int ** __ctype_toupper_loc();
|
||||
@ -1118,7 +1118,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__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
return *__ctype_b_loc();
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
// Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
|
||||
@ -1161,7 +1161,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
|
||||
return _C_toupper_tab_ + 1;
|
||||
}
|
||||
|
||||
#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
const int*
|
||||
ctype<char>::__classic_lower_table() _NOEXCEPT
|
||||
{
|
||||
@ -1173,7 +1173,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
|
||||
{
|
||||
return *__ctype_toupper_loc();
|
||||
}
|
||||
#endif // __GLIBC__ || __NETBSD__ || __EMSCRIPTEN__ || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#endif // __GLIBC__ || __NETBSD__ || __EMSCRIPTEN__
|
||||
|
||||
// template <> class ctype_byname<char>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user