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:
Joerg Sonnenberger
2013-05-17 21:17:34 +00:00
parent 67444034ed
commit a71a952634
4 changed files with 55 additions and 12 deletions

View File

@@ -56,6 +56,18 @@
# endif // __LONG_LONG_SUPPORTED
#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
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
@@ -473,7 +485,7 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#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
#endif
#ifdef __FreeBSD__

View File

@@ -339,12 +339,12 @@ public:
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#elif (defined(__APPLE__) || defined(__FreeBSD__)) || defined(EMSCRIPTEN)
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(EMSCRIPTEN) || defined(__NetBSD__)
#ifdef __APPLE__
typedef __uint32_t mask;
#elif defined(__FreeBSD__)
typedef unsigned long mask;
#elif defined(EMSCRIPTEN)
#elif defined(EMSCRIPTEN) || defined(__NetBSD__)
typedef unsigned short mask;
#endif
static const mask space = _CTYPE_S;
@@ -356,7 +356,11 @@ public:
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
# if defined(__NetBSD__)
static const mask blank = _CTYPE_BL;
# else
static const mask blank = _CTYPE_B;
# endif
#elif defined(__sun__)
typedef unsigned int mask;
static const mask space = _ISSPACE;
@@ -596,6 +600,10 @@ public:
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__NetBSD__)
static const short* __classic_upper_table() _NOEXCEPT;
static const short* __classic_lower_table() _NOEXCEPT;
#endif
protected:
~ctype();

View File

@@ -206,6 +206,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
# define _LIBCPP_GET_C_LOCALE 0
#elif defined(__NetBSD__)
# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
#else
# define _LIBCPP_GET_C_LOCALE __cloc()
// Get the C locale object