[PATCH][libcxx] Add support for Bitrig

Patrick Wildt mail at patrick-wildt.de
Sun Apr 27 11:17:22 PDT 2014


Hi,

I've been working on porting libc++/libc++abi to Bitrig.

This diff adds the proper defines and config for us.

\Patrick

diff --git a/include/__config b/include/__config
index fb775c6..b290fb7 100644
--- a/include/__config
+++ b/include/__config
@@ -56,6 +56,17 @@
 # endif  // __LONG_LONG_SUPPORTED
 #endif  // __FreeBSD__
 
+#ifdef __Bitrig__
+# include <machine/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
+#endif  // __Bitrig__
+
 #ifdef __NetBSD__
 # include <sys/endian.h>
 #  if _BYTE_ORDER == _LITTLE_ENDIAN
@@ -314,7 +325,7 @@ typedef __char32_t char32_t;
 #endif
 
 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__Bitrig__)
 #define _LIBCPP_HAS_QUICK_EXIT
 #define _LIBCPP_HAS_C11_FEATURES
 #elif defined(__linux__)
@@ -585,7 +596,7 @@ template <unsigned> struct __static_assert_check {};
 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__) || defined(__Bitrig__)
 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
 #endif
 
@@ -593,11 +604,11 @@ template <unsigned> struct __static_assert_check {};
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__Bitrig__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) || defined(__Bitrig__)
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 
diff --git a/include/__locale b/include/__locale
index fb5b196..c705444 100644
--- a/include/__locale
+++ b/include/__locale
@@ -23,7 +23,7 @@
 # include <support/win32/locale_win32.h>
 #elif defined(_AIX)
 # include <support/ibm/xlocale.h>
-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)
+#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__) || defined(__Bitrig__)
 # include <xlocale.h>
 #endif  // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
 
@@ -341,10 +341,10 @@ public:
     static const mask punct  = _PUNCT;
     static const mask xdigit = _HEX;
     static const mask blank  = _BLANK;
-#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || defined(__Bitrig__)
 #ifdef __APPLE__
     typedef __uint32_t mask;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__Bitrig__)
     typedef unsigned long mask;
 #elif defined(__EMSCRIPTEN__) ||  defined(__NetBSD__)
     typedef unsigned short mask;
diff --git a/src/locale.cpp b/src/locale.cpp
index 4877f2b..37f0ed9 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -1021,7 +1021,7 @@ extern "C" const int ** __ctype_toupper_loc();
 const ctype<char>::mask*
 ctype<char>::classic_table()  _NOEXCEPT
 {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__Bitrig__)
     return _DefaultRuneLocale.__runetype;
 #elif defined(__NetBSD__)
     return _C_ctype_tab_ + 1;




More information about the cfe-commits mailing list