[cfe-commits] [libcxx] r151720 - in /libcxx/trunk: CREDITS.TXT include/__config include/__locale include/cmath include/cstdlib include/cstring src/locale.cpp src/random.cpp src/thread.cpp

David Chisnall csdavec at swan.ac.uk
Wed Feb 29 05:05:08 PST 2012


Author: theraven
Date: Wed Feb 29 07:05:08 2012
New Revision: 151720

URL: http://llvm.org/viewvc/llvm-project?rev=151720&view=rev
Log:
Solaris port.  Currently sees around 200 test failures, mostly related to
Solaris not providing some of the locales that the test suite uses.

Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers.  These will be committed to a branch later
today.


Modified:
    libcxx/trunk/CREDITS.TXT
    libcxx/trunk/include/__config
    libcxx/trunk/include/__locale
    libcxx/trunk/include/cmath
    libcxx/trunk/include/cstdlib
    libcxx/trunk/include/cstring
    libcxx/trunk/src/locale.cpp
    libcxx/trunk/src/random.cpp
    libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/CREDITS.TXT (original)
+++ libcxx/trunk/CREDITS.TXT Wed Feb 29 07:05:08 2012
@@ -23,7 +23,7 @@
 
 N: David Chisnall
 E: theraven at theravensnest dot org
-D: FreeBSD port and libcxxrt support.
+D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
 
 N: Ruben Van Boxem
 E: vanboxem dot ruben at gmail dot com

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Feb 29 07:05:08 2012
@@ -58,6 +58,17 @@
 #  endif
 #endif  // _WIN32
 
+#ifdef __sun__
+# include <sys/isa_defs.h>
+# ifdef _LITTLE_ENDIAN
+#   define _LIBCPP_LITTLE_ENDIAN 1
+#   define _LIBCPP_BIG_ENDIAN    0
+# else
+#   define _LIBCPP_LITTLE_ENDIAN 0
+#   define _LIBCPP_BIG_ENDIAN    1
+# endif
+#endif // __sun__
+
 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
 # include <endian.h>
 # if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -394,7 +405,7 @@
 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
 #endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
 
-#if __APPLE__ || __FreeBSD__ || _WIN32
+#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
 #endif
 #if __FreeBSD__
@@ -405,7 +416,7 @@
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif
 
-#if __APPLE__ || __FreeBSD__
+#if __APPLE__ || __FreeBSD__ || __sun__
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 

Modified: libcxx/trunk/include/__locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Wed Feb 29 07:05:08 2012
@@ -21,7 +21,7 @@
 #include <locale.h>
 #if _WIN32
 # include <support/win32/locale_win32.h>
-#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
+#elif (__GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__)
 # include <xlocale.h>
 #endif  // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
 
@@ -348,7 +348,19 @@
     static const mask punct  = _CTYPE_P;
     static const mask xdigit = _CTYPE_X;
     static const mask blank  = _CTYPE_B;
-#else  // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
+#elif __sun__
+    typedef unsigned int mask;
+    static const mask space  = _ISSPACE;
+    static const mask print  = _ISPRINT;
+    static const mask cntrl  = _ISCNTRL;
+    static const mask upper  = _ISUPPER;
+    static const mask lower  = _ISLOWER;
+    static const mask alpha  = _ISALPHA;
+    static const mask digit  = _ISDIGIT;
+    static const mask punct  = _ISPUNCT;
+    static const mask xdigit = _ISXDIGIT;
+    static const mask blank  = _ISBLANK;
+#else  // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __sun__
     typedef unsigned long mask;
     static const mask space  = 1<<0;
     static const mask print  = 1<<1;

Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Wed Feb 29 07:05:08 2012
@@ -646,13 +646,17 @@
 using ::float_t;
 using ::double_t;
 
+#ifndef __sun__
 // abs
 
+#endif // __sun__
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_floating_point<_A1>::value, _A1>::type
 abs(_A1 __x) {return fabs(__x);}
 
+#ifndef __sun__
+
 // acos
 
 using ::acos;
@@ -769,16 +773,20 @@
 typename enable_if<is_integral<_A1>::value, double>::type
 cosh(_A1 __x) {return cosh((double)__x);}
 
+#endif // __sun__
 // exp
 
 using ::exp;
 using ::expf;
 
+#ifndef __sun__
+
 #ifndef _MSC_VER
 inline _LIBCPP_INLINE_VISIBILITY float       exp(float __x)       {return expf(__x);}
 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);}
 #endif
 
+
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
@@ -816,8 +824,10 @@
 
 // fmod
 
+#endif //__sun__
 using ::fmod;
 using ::fmodf;
+#ifndef __sun__
 
 #ifndef _MSC_VER
 inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __x, float __y)             {return fmodf(__x, __y);}
@@ -840,6 +850,7 @@
     return fmod((__result_type)__x, (__result_type)__y);
 }
 
+
 // frexp
 
 using ::frexp;
@@ -872,8 +883,10 @@
 
 // log
 
+#endif // __sun__
 using ::log;
 using ::logf;
+#ifndef __sun__
 
 #ifndef _MSC_VER
 inline _LIBCPP_INLINE_VISIBILITY float       log(float __x)       {return logf(__x);}
@@ -885,6 +898,7 @@
 typename enable_if<is_integral<_A1>::value, double>::type
 log(_A1 __x) {return log((double)__x);}
 
+
 // log10
 
 using ::log10;
@@ -912,9 +926,12 @@
 
 // pow
 
+#endif // __sun__ 
 using ::pow;
 using ::powf;
 
+#ifndef __sun__
+
 #ifndef _MSC_VER
 inline _LIBCPP_INLINE_VISIBILITY float       pow(float __x, float __y)             {return powf(__x, __y);}
 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);}
@@ -936,6 +953,7 @@
     return pow((__result_type)__x, (__result_type)__y);
 }
 
+
 // sin
 
 using ::sin;
@@ -968,10 +986,12 @@
 
 // sqrt
 
+#endif // __sun__
 using ::sqrt;
 using ::sqrtf;
 
-#ifndef _MSC_VER
+
+#if !(defined(_MSC_VER) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __x)       {return sqrtf(__x);}
 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);}
 #endif
@@ -981,10 +1001,14 @@
 typename enable_if<is_integral<_A1>::value, double>::type
 sqrt(_A1 __x) {return sqrt((double)__x);}
 
+#ifndef __sun__
+
 // tan
 
+#endif // __sun__
 using ::tan;
 using ::tanf;
+#ifndef __sun__
 
 #ifndef _MSC_VER
 inline _LIBCPP_INLINE_VISIBILITY float       tan(float __x)       {return tanf(__x);}
@@ -1294,11 +1318,13 @@
 inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __x)       {return lgammaf(__x);}
 inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) {return lgammal(__x);}
 
+
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
 lgamma(_A1 __x) {return lgamma((double)__x);}
 
+
 // llrint
 
 using ::llrint;
@@ -1392,8 +1418,10 @@
 
 // nan
 
+#endif // __sun__
 using ::nan;
 using ::nanf;
+#ifndef __sun__
 
 // nearbyint
 
@@ -1635,6 +1663,10 @@
 using ::truncl;
 #endif // !_MSC_VER
 
+#else 
+using ::lgamma;
+using ::lgammaf;
+#endif // __sun__
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_CMATH

Modified: libcxx/trunk/include/cstdlib
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdlib?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/include/cstdlib (original)
+++ libcxx/trunk/include/cstdlib Wed Feb 29 07:05:08 2012
@@ -132,7 +132,8 @@
 using ::mbstowcs;
 using ::wcstombs;
 
-#ifndef _MSC_VER // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
+// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
+#if !defined(_MSC_VER) && !defined(__sun__)
 inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) {return  labs(__x);}
 inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
 

Modified: libcxx/trunk/include/cstring
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstring?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/include/cstring (original)
+++ libcxx/trunk/include/cstring Wed Feb 29 07:05:08 2012
@@ -94,7 +94,7 @@
 using ::strstr;
 
 // MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
-#if !defined(__GLIBC__) && !defined(_MSC_VER)
+#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__)
 inline _LIBCPP_INLINE_VISIBILITY       char* strchr(      char* __s, int __c) {return ::strchr(__s, __c);}
 inline _LIBCPP_INLINE_VISIBILITY       char* strpbrk(      char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
 inline _LIBCPP_INLINE_VISIBILITY       char* strrchr(      char* __s, int __c) {return ::strrchr(__s, __c);}

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Wed Feb 29 07:05:08 2012
@@ -7,6 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+// On Solaris, we need to define something to make the C99 parts of localeconv
+// visible.
+#ifdef __sun__
+#define _LCONV_C99
+#endif
+
 #include "string"
 #include "locale"
 #include "codecvt"
@@ -925,11 +931,16 @@
     return _DefaultRuneLocale.__runetype;
 #elif defined(__GLIBC__)
     return __cloc()->__ctype_b;
+#elif __sun__
+    return __ctype_mask;
 #elif _WIN32
     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...
 #else
+    // Platform not supported: abort so the person doing the port knows what to
+    // fix
+    abort();
     return NULL;
 #endif
 }

Modified: libcxx/trunk/src/random.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/random.cpp?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/src/random.cpp (original)
+++ libcxx/trunk/src/random.cpp Wed Feb 29 07:05:08 2012
@@ -10,6 +10,9 @@
 #include "random"
 #include "system_error"
 
+#ifdef __sun__
+#define rename solaris_headers_are_broken
+#endif
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>

Modified: libcxx/trunk/src/thread.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=151720&r1=151719&r2=151720&view=diff
==============================================================================
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Wed Feb 29 07:05:08 2012
@@ -12,7 +12,7 @@
 #include "vector"
 #include "future"
 #include <sys/types.h>
-#if !_WIN32
+#if !_WIN32 && !__sun__
 #include <sys/sysctl.h>
 #endif // _WIN32
 





More information about the cfe-commits mailing list