[libcxx] r278716 - Fix PR28506. Re-enable missing math.h C++11 decls on SunOS. Patch from Michal Gorny.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 11:58:58 PDT 2016


Author: ericwf
Date: Mon Aug 15 13:58:57 2016
New Revision: 278716

URL: http://llvm.org/viewvc/llvm-project?rev=278716&view=rev
Log:
Fix PR28506. Re-enable missing math.h C++11 decls on SunOS. Patch from Michal Gorny.

Modified:
    libcxx/trunk/include/cmath
    libcxx/trunk/include/math.h

Modified: libcxx/trunk/include/cmath
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?rev=278716&r1=278715&r2=278716&view=diff
==============================================================================
--- libcxx/trunk/include/cmath (original)
+++ libcxx/trunk/include/cmath Mon Aug 15 13:58:57 2016
@@ -331,7 +331,6 @@ using ::double_t;
 using ::abs;
 #endif
 
-#ifndef __sun__
 using ::acos;
 using ::acosf;
 using ::asin;
@@ -346,54 +345,44 @@ using ::cos;
 using ::cosf;
 using ::cosh;
 using ::coshf;
-#endif // __sun__
 
 using ::exp;
 using ::expf;
 
-#ifndef __sun__
 using ::fabs;
 using ::fabsf;
 using ::floor;
 using ::floorf;
-#endif //__sun__
 
 using ::fmod;
 using ::fmodf;
 
-#ifndef __sun__
 using ::frexp;
 using ::frexpf;
 using ::ldexp;
 using ::ldexpf;
-#endif // __sun__
 
 using ::log;
 using ::logf;
 
-#ifndef __sun__
 using ::log10;
 using ::log10f;
 using ::modf;
 using ::modff;
-#endif // __sun__ 
 
 using ::pow;
 using ::powf;
 
-#ifndef __sun__
 using ::sin;
 using ::sinf;
 using ::sinh;
 using ::sinhf;
-#endif // __sun__
 
 using ::sqrt;
 using ::sqrtf;
 using ::tan;
 using ::tanf;
 
-#ifndef __sun__
 using ::tanh;
 using ::tanhf;
 
@@ -449,14 +438,12 @@ using ::lrintf;
 using ::lround;
 using ::lroundf;
 #endif // _LIBCPP_MSVCRT
-#endif // __sun__
 
 #ifndef _LIBCPP_MSVCRT
 using ::nan;
 using ::nanf;
 #endif // _LIBCPP_MSVCRT
 
-#ifndef __sun__
 #ifndef _LIBCPP_MSVCRT
 using ::nearbyint;
 using ::nearbyintf;
@@ -547,11 +534,6 @@ using ::tgammal;
 using ::truncl;
 #endif // !_LIBCPP_MSVCRT
 
-#else 
-using ::lgamma;
-using ::lgammaf;
-#endif // __sun__
-
 #if _LIBCPP_STD_VER > 14
 inline _LIBCPP_INLINE_VISIBILITY float       hypot(       float x,       float y,       float z ) { return sqrt(x*x + y*y + z*z); }
 inline _LIBCPP_INLINE_VISIBILITY double      hypot(      double x,      double y,      double z ) { return sqrt(x*x + y*y + z*z); }

Modified: libcxx/trunk/include/math.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/math.h?rev=278716&r1=278715&r2=278716&view=diff
==============================================================================
--- libcxx/trunk/include/math.h (original)
+++ libcxx/trunk/include/math.h Mon Aug 15 13:58:57 2016
@@ -636,11 +636,9 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y)
 
 #endif  // isunordered
 
-#ifndef __sun__
-
 // abs
 
-#if !defined(_AIX)
+#if !(defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY
 float
 abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
@@ -652,11 +650,11 @@ abs(double __lcpp_x) _NOEXCEPT {return f
 inline _LIBCPP_INLINE_VISIBILITY
 long double
 abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
-#endif // !defined(_AIX)
+#endif // !(defined(_AIX) || defined(__sun__))
 
 // acos
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXCEPT       {return acosf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
 #endif
@@ -668,7 +666,7 @@ acos(_A1 __lcpp_x) _NOEXCEPT {return aco
 
 // asin
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXCEPT       {return asinf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
 #endif
@@ -680,7 +678,7 @@ asin(_A1 __lcpp_x) _NOEXCEPT {return asi
 
 // atan
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXCEPT       {return atanf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
 #endif
@@ -692,7 +690,7 @@ atan(_A1 __lcpp_x) _NOEXCEPT {return ata
 
 // atan2
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return atan2f(__lcpp_y, __lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
 #endif
@@ -715,7 +713,7 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXC
 
 // ceil
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXCEPT       {return ceilf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
 #endif
@@ -727,7 +725,7 @@ ceil(_A1 __lcpp_x) _NOEXCEPT {return cei
 
 // cos
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       cos(float __lcpp_x) _NOEXCEPT       {return cosf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
 #endif
@@ -739,7 +737,7 @@ cos(_A1 __lcpp_x) _NOEXCEPT {return cos(
 
 // cosh
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __lcpp_x) _NOEXCEPT       {return coshf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
 #endif
@@ -751,7 +749,7 @@ cosh(_A1 __lcpp_x) _NOEXCEPT {return cos
 
 // exp
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       exp(float __lcpp_x) _NOEXCEPT       {return expf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
 #endif
@@ -763,7 +761,7 @@ exp(_A1 __lcpp_x) _NOEXCEPT {return exp(
 
 // fabs
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __lcpp_x) _NOEXCEPT       {return fabsf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
 #endif
@@ -775,7 +773,7 @@ fabs(_A1 __lcpp_x) _NOEXCEPT {return fab
 
 // floor
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       floor(float __lcpp_x) _NOEXCEPT       {return floorf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
 #endif
@@ -787,7 +785,7 @@ floor(_A1 __lcpp_x) _NOEXCEPT {return fl
 
 // fmod
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmodf(__lcpp_x, __lcpp_y);}
 inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
 #endif
@@ -810,7 +808,7 @@ fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCE
 
 // frexp
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT       {return frexpf(__lcpp_x, __lcpp_e);}
 inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
 #endif
@@ -822,7 +820,7 @@ frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEX
 
 // ldexp
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT       {return ldexpf(__lcpp_x, __lcpp_e);}
 inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
 #endif
@@ -834,7 +832,7 @@ ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXC
 
 // log
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       log(float __lcpp_x) _NOEXCEPT       {return logf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
 #endif
@@ -846,7 +844,7 @@ log(_A1 __lcpp_x) _NOEXCEPT {return log(
 
 // log10
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       log10(float __lcpp_x) _NOEXCEPT       {return log10f(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
 #endif
@@ -858,14 +856,14 @@ log10(_A1 __lcpp_x) _NOEXCEPT {return lo
 
 // modf
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT             {return modff(__lcpp_x, __lcpp_y);}
 inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
 #endif
 
 // pow
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
 #endif
@@ -888,7 +886,7 @@ pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEP
 
 // sin
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       sin(float __lcpp_x) _NOEXCEPT       {return sinf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
 #endif
@@ -900,7 +898,7 @@ sin(_A1 __lcpp_x) _NOEXCEPT {return sin(
 
 // sinh
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __lcpp_x) _NOEXCEPT       {return sinhf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
 #endif
@@ -912,21 +910,19 @@ sinh(_A1 __lcpp_x) _NOEXCEPT {return sin
 
 // sqrt
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return sqrtf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
 #endif
 
-#endif // __sun__
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_integral<_A1>::value, double>::type
 sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
-#ifndef __sun__
 
 // tan
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       tan(float __lcpp_x) _NOEXCEPT       {return tanf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
 #endif
@@ -938,7 +934,7 @@ tan(_A1 __lcpp_x) _NOEXCEPT {return tan(
 
 // tanh
 
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
 inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __lcpp_x) _NOEXCEPT       {return tanhf(__lcpp_x);}
 inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
 #endif
@@ -1410,7 +1406,6 @@ typename std::enable_if<std::is_integral
 trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
 
 #endif // !_LIBCPP_MSVCRT
-#endif // __sun__
 
 } // extern "C++"
 




More information about the cfe-commits mailing list