diff --git a/libcxx/include/math.h b/libcxx/include/math.h --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -301,6 +301,10 @@ #ifdef __cplusplus +# ifdef fpclassify +# undef fpclassify +# endif // fpclassify + // We support including .h headers inside 'extern "C"' contexts, so switch // back to C++ linkage before including these C++ headers. extern "C++" { @@ -310,12 +314,52 @@ #include #include -// signbit - # ifdef signbit # undef signbit # endif // signbit +# ifdef isfinite +# undef isfinite +# endif // isfinite + +# ifdef isinf +# undef isinf +# endif // isinf + +# ifdef isnan +# undef isnan +# endif // isnan + +# ifdef isnormal +# undef isnormal +# endif // isnormal + +# ifdef isgreater +# undef isgreater +# endif // isgreater + +# ifdef isgreaterequal +# undef isgreaterequal +# endif // isgreaterequal + +# ifdef isless +# undef isless +# endif // isless + +# ifdef islessequal +# undef islessequal +# endif // islessequal + +# ifdef islessgreater +# undef islessgreater +# endif // islessgreater + +# ifdef isunordered +# undef isunordered +# endif // isunordered + +// signbit + template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { return __builtin_signbit(__x); @@ -333,10 +377,6 @@ // fpclassify -# ifdef fpclassify -# undef fpclassify -# endif // fpclassify - template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); @@ -347,10 +387,10 @@ return __x == 0 ? FP_ZERO : FP_NORMAL; } -// isfinite +// The MSVC runtime already provides these functions as templates +#ifndef _LIBCPP_MSVCRT -# ifdef isfinite -# undef isfinite +// isfinite template ::value && std::numeric_limits<_A1>::has_infinity, int> = 0> @@ -364,13 +404,8 @@ return true; } -# endif // isfinite - // isinf -# ifdef isinf -# undef isinf - template ::value && std::numeric_limits<_A1>::has_infinity, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { @@ -392,13 +427,8 @@ inline _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { return __builtin_isinf(__x); } # endif -# endif // isinf - // isnan -# ifdef isnan -# undef isnan - template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { return __builtin_isnan(__x); @@ -417,13 +447,8 @@ inline _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { return __builtin_isnan(__x); } # endif -# endif // isnan - // isnormal -# ifdef isnormal -# undef isnormal - template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { return __builtin_isnormal(__x); @@ -434,13 +459,8 @@ return __x != 0; } -# endif // isnormal - // isgreater -# ifdef isgreater -# undef isgreater - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -449,13 +469,8 @@ return __builtin_isgreater((type)__x, (type)__y); } -# endif // isgreater - // isgreaterequal -# ifdef isgreaterequal -# undef isgreaterequal - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -464,13 +479,8 @@ return __builtin_isgreaterequal((type)__x, (type)__y); } -# endif // isgreaterequal - // isless -# ifdef isless -# undef isless - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -479,13 +489,8 @@ return __builtin_isless((type)__x, (type)__y); } -# endif // isless - // islessequal -# ifdef islessequal -# undef islessequal - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -494,13 +499,8 @@ return __builtin_islessequal((type)__x, (type)__y); } -# endif // islessequal - // islessgreater -# ifdef islessgreater -# undef islessgreater - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -509,13 +509,8 @@ return __builtin_islessgreater((type)__x, (type)__y); } -# endif // islessgreater - // isunordered -# ifdef isunordered -# undef isunordered - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -524,7 +519,7 @@ return __builtin_isunordered((type)__x, (type)__y); } -# endif // isunordered +#endif // _LIBCPP_MSVCRT // abs //