Add NetBSD support.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@182162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67444034ed
commit
a71a952634
@ -56,6 +56,18 @@
|
|||||||
# endif // __LONG_LONG_SUPPORTED
|
# endif // __LONG_LONG_SUPPORTED
|
||||||
#endif // __FreeBSD__
|
#endif // __FreeBSD__
|
||||||
|
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
# include <sys/endian.h>
|
||||||
|
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
|
# define _LIBCPP_BIG_ENDIAN 0
|
||||||
|
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||||
|
# define _LIBCPP_BIG_ENDIAN 1
|
||||||
|
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||||
|
# define _LIBCPP_HAS_QUICK_EXIT
|
||||||
|
#endif // __NetBSD__
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||||
# define _LIBCPP_BIG_ENDIAN 0
|
# define _LIBCPP_BIG_ENDIAN 0
|
||||||
@ -473,7 +485,7 @@ template <unsigned> struct __static_assert_check {};
|
|||||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__)
|
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
|
||||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||||
#endif
|
#endif
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
@ -339,12 +339,12 @@ public:
|
|||||||
static const mask punct = _PUNCT;
|
static const mask punct = _PUNCT;
|
||||||
static const mask xdigit = _HEX;
|
static const mask xdigit = _HEX;
|
||||||
static const mask blank = _BLANK;
|
static const mask blank = _BLANK;
|
||||||
#elif (defined(__APPLE__) || defined(__FreeBSD__)) || defined(EMSCRIPTEN)
|
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
typedef __uint32_t mask;
|
typedef __uint32_t mask;
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
typedef unsigned long mask;
|
typedef unsigned long mask;
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
typedef unsigned short mask;
|
typedef unsigned short mask;
|
||||||
#endif
|
#endif
|
||||||
static const mask space = _CTYPE_S;
|
static const mask space = _CTYPE_S;
|
||||||
@ -356,7 +356,11 @@ public:
|
|||||||
static const mask digit = _CTYPE_D;
|
static const mask digit = _CTYPE_D;
|
||||||
static const mask punct = _CTYPE_P;
|
static const mask punct = _CTYPE_P;
|
||||||
static const mask xdigit = _CTYPE_X;
|
static const mask xdigit = _CTYPE_X;
|
||||||
|
# if defined(__NetBSD__)
|
||||||
|
static const mask blank = _CTYPE_BL;
|
||||||
|
# else
|
||||||
static const mask blank = _CTYPE_B;
|
static const mask blank = _CTYPE_B;
|
||||||
|
# endif
|
||||||
#elif defined(__sun__)
|
#elif defined(__sun__)
|
||||||
typedef unsigned int mask;
|
typedef unsigned int mask;
|
||||||
static const mask space = _ISSPACE;
|
static const mask space = _ISSPACE;
|
||||||
@ -596,6 +600,10 @@ public:
|
|||||||
static const int* __classic_upper_table() _NOEXCEPT;
|
static const int* __classic_upper_table() _NOEXCEPT;
|
||||||
static const int* __classic_lower_table() _NOEXCEPT;
|
static const int* __classic_lower_table() _NOEXCEPT;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__NetBSD__)
|
||||||
|
static const short* __classic_upper_table() _NOEXCEPT;
|
||||||
|
static const short* __classic_lower_table() _NOEXCEPT;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~ctype();
|
~ctype();
|
||||||
|
@ -206,6 +206,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||||||
|
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
# define _LIBCPP_GET_C_LOCALE 0
|
# define _LIBCPP_GET_C_LOCALE 0
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
|
||||||
#else
|
#else
|
||||||
# define _LIBCPP_GET_C_LOCALE __cloc()
|
# define _LIBCPP_GET_C_LOCALE __cloc()
|
||||||
// Get the C locale object
|
// Get the C locale object
|
||||||
|
@ -790,7 +790,7 @@ ctype<wchar_t>::do_toupper(char_type c) const
|
|||||||
{
|
{
|
||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
|
||||||
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
|
#elif defined(__GLIBC__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
|
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
|
||||||
#else
|
#else
|
||||||
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
|
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
|
||||||
@ -803,7 +803,7 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
|
|||||||
for (; low != high; ++low)
|
for (; low != high; ++low)
|
||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
|
||||||
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
|
#elif defined(__GLIBC__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
|
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
|
||||||
: *low;
|
: *low;
|
||||||
#else
|
#else
|
||||||
@ -817,7 +817,7 @@ ctype<wchar_t>::do_tolower(char_type c) const
|
|||||||
{
|
{
|
||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
|
||||||
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
|
#elif defined(__GLIBC__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
|
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
|
||||||
#else
|
#else
|
||||||
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
|
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
|
||||||
@ -830,7 +830,7 @@ ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
|
|||||||
for (; low != high; ++low)
|
for (; low != high; ++low)
|
||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
|
||||||
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
|
#elif defined(__GLIBC__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
|
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
|
||||||
: *low;
|
: *low;
|
||||||
#else
|
#else
|
||||||
@ -897,9 +897,11 @@ ctype<char>::do_toupper(char_type c) const
|
|||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
return isascii(c) ?
|
return isascii(c) ?
|
||||||
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
|
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)
|
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
|
||||||
return isascii(c) ?
|
return isascii(c) ?
|
||||||
static_cast<char>(__classic_upper_table()[static_cast<size_t>(c)]) : c;
|
static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
|
||||||
#else
|
#else
|
||||||
return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
|
return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
|
||||||
#endif
|
#endif
|
||||||
@ -912,6 +914,8 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
|
|||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
*low = isascii(*low) ?
|
*low = isascii(*low) ?
|
||||||
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
|
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)
|
||||||
*low = isascii(*low) ?
|
*low = isascii(*low) ?
|
||||||
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
|
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
|
||||||
@ -927,7 +931,9 @@ ctype<char>::do_tolower(char_type c) const
|
|||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
return isascii(c) ?
|
return isascii(c) ?
|
||||||
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
|
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
|
||||||
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
|
#elif defined(__NetBSD__)
|
||||||
|
return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]);
|
||||||
|
#elif defined(__GLIBC__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
|
||||||
return isascii(c) ?
|
return isascii(c) ?
|
||||||
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
|
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
|
||||||
#else
|
#else
|
||||||
@ -941,6 +947,8 @@ ctype<char>::do_tolower(char_type* low, const char_type* high) const
|
|||||||
for (; low != high; ++low)
|
for (; low != high; ++low)
|
||||||
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||||
*low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
|
*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)
|
||||||
*low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
|
*low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
|
||||||
#else
|
#else
|
||||||
@ -993,6 +1001,8 @@ ctype<char>::classic_table() _NOEXCEPT
|
|||||||
{
|
{
|
||||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
return _DefaultRuneLocale.__runetype;
|
return _DefaultRuneLocale.__runetype;
|
||||||
|
#elif defined(__NetBSD__)
|
||||||
|
return _C_ctype_tab_ + 1;
|
||||||
#elif defined(__GLIBC__)
|
#elif defined(__GLIBC__)
|
||||||
return __cloc()->__ctype_b;
|
return __cloc()->__ctype_b;
|
||||||
#elif __sun__
|
#elif __sun__
|
||||||
@ -1024,9 +1034,20 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
|
|||||||
{
|
{
|
||||||
return __cloc()->__ctype_toupper;
|
return __cloc()->__ctype_toupper;
|
||||||
}
|
}
|
||||||
#endif // __GLIBC__
|
#elif __NetBSD__
|
||||||
|
const short*
|
||||||
|
ctype<char>::__classic_lower_table() _NOEXCEPT
|
||||||
|
{
|
||||||
|
return _C_tolower_tab_ + 1;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(EMSCRIPTEN)
|
const short*
|
||||||
|
ctype<char>::__classic_upper_table() _NOEXCEPT
|
||||||
|
{
|
||||||
|
return _C_toupper_tab_ + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(EMSCRIPTEN)
|
||||||
const int*
|
const int*
|
||||||
ctype<char>::__classic_lower_table() _NOEXCEPT
|
ctype<char>::__classic_lower_table() _NOEXCEPT
|
||||||
{
|
{
|
||||||
@ -1038,7 +1059,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
|
|||||||
{
|
{
|
||||||
return *__ctype_toupper_loc();
|
return *__ctype_toupper_loc();
|
||||||
}
|
}
|
||||||
#endif // EMSCRIPTEN
|
#endif // __GLIBC__ || EMSCRIPTEN || __NETBSD__
|
||||||
|
|
||||||
// template <> class ctype_byname<char>
|
// template <> class ctype_byname<char>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user