diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-01 03:05:40 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-01 03:05:40 +0000 |
| commit | c4f593ba1a72e0d9d74e440ea7e627e6b0f16689 (patch) | |
| tree | 2264e88d0977c71285c2514a735a74802b309559 /libcxx/include/math.h | |
| parent | 3678be89f7e6a8a94643e3807c78b84efcb389ef (diff) | |
| download | bcm5719-llvm-c4f593ba1a72e0d9d74e440ea7e627e6b0f16689.tar.gz bcm5719-llvm-c4f593ba1a72e0d9d74e440ea7e627e6b0f16689.zip | |
Fix return type of isinf(double) and isnan(double) where possible.
When using an old version of glibc, a ::isinf(double) and ::isnan(double)
function is provided, rather than just the macro required by C and C++.
Displace this function using _LIBCPP_PREFERRED_OVERLOAD where possible.
The only remaining case where we should get the wrong return type is now
glibc + libc++ + a non-clang compiler.
llvm-svn: 331241
Diffstat (limited to 'libcxx/include/math.h')
| -rw-r--r-- | libcxx/include/math.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libcxx/include/math.h b/libcxx/include/math.h index cd055caef72..658ba93be01 100644 --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -483,6 +483,20 @@ typename std::enable_if< isinf(_A1) _NOEXCEPT { return false; } +#ifdef _LIBCPP_PREFERRED_OVERLOAD +inline _LIBCPP_INLINE_VISIBILITY +bool +isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD +bool +isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY +bool +isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } +#endif + #endif // isinf // isnan @@ -513,6 +527,20 @@ typename std::enable_if<std::is_integral<_A1>::value, bool>::type isnan(_A1) _NOEXCEPT { return false; } +#ifdef _LIBCPP_PREFERRED_OVERLOAD +inline _LIBCPP_INLINE_VISIBILITY +bool +isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD +bool +isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY +bool +isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } +#endif + #endif // isnan // isnormal |

