diff options
| author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-26 18:24:54 +0000 |
|---|---|---|
| committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-26 18:24:54 +0000 |
| commit | 64f91bdc6c66b1bc7b832cb4cb296ed424f1867c (patch) | |
| tree | 253a8e89ce7d5885ccd6131af8d42a636a2d28a8 /libstdc++-v3/include/c_std | |
| parent | b4ac3759f7a68557a5c75bf2eab95a3eb30eab4f (diff) | |
| download | ppe42-gcc-64f91bdc6c66b1bc7b832cb4cb296ed424f1867c.tar.gz ppe42-gcc-64f91bdc6c66b1bc7b832cb4cb296ed424f1867c.zip | |
2007-11-26 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/25913
* include/c_std/cmath (std::fpclassify, isfinite, isinf, isnan,
isnormal, signbit, isgreater, isgreaterequal, isless, islessequal,
islessgreater, isunordered): Guard with __enable_if and forward
with __promote.
* include/c_global/cmath: Likewise.
* testsuite/26_numerics/headers/cmath/25913.cc: New.
* include/c_std/cmath (__gnu_cxx::__capture_isfinite,
__capture_isinf, __capture_isnan, __capture_isnormal,
__capture_signbit, __capture_isgreater, __capture_isgreaterequal,
__capture_isless, __capture_islessequal, __capture_islessgreater,
__capture_isunordered): Remove.
(std::isfinite, isinf, isnan, isnormal, signbit, isgreater,
isgreaterequal, isless, islessequal, islessgreater, isunordered):
Forward to the corresponding builtin.
* include/c_global/cmath: Likewise.
* include/c_global/cmath (std::atan2, pow): Guard with __enable_if.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130443 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/c_std')
| -rw-r--r-- | libstdc++-v3/include/c_std/cmath | 154 |
1 files changed, 80 insertions, 74 deletions
diff --git a/libstdc++-v3/include/c_std/cmath b/libstdc++-v3/include/c_std/cmath index 897290ac089..52c1d2a3505 100644 --- a/libstdc++-v3/include/c_std/cmath +++ b/libstdc++-v3/include/c_std/cmath @@ -1,6 +1,7 @@ // -*- C++ -*- C forwarding header. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -467,55 +468,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) inline int __capture_fpclassify(_Tp __f) { return fpclassify(__f); } - template<typename _Tp> - inline int - __capture_isfinite(_Tp __f) { return isfinite(__f); } - - template<typename _Tp> - inline int - __capture_isinf(_Tp __f) { return isinf(__f); } - - template<typename _Tp> - inline int - __capture_isnan(_Tp __f) { return isnan(__f); } - - template<typename _Tp> - inline int - __capture_isnormal(_Tp __f) { return isnormal(__f); } - - template<typename _Tp> - inline int - __capture_signbit(_Tp __f) { return signbit(__f); } - - template<typename _Tp> - inline int - __capture_isgreater(_Tp __f1, _Tp __f2) - { return isgreater(__f1, __f2); } - - template<typename _Tp> - inline int - __capture_isgreaterequal(_Tp __f1, _Tp __f2) - { return isgreaterequal(__f1, __f2); } - - template<typename _Tp> - inline int - __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); } - - template<typename _Tp> - inline int - __capture_islessequal(_Tp __f1, _Tp __f2) - { return islessequal(__f1, __f2); } - - template<typename _Tp> - inline int - __capture_islessgreater(_Tp __f1, _Tp __f2) - { return islessgreater(__f1, __f2); } - - template<typename _Tp> - inline int - __capture_isunordered(_Tp __f1, _Tp __f2) - { return isunordered(__f1, __f2); } - _GLIBCXX_END_NAMESPACE // Only undefine the C99 FP macros, if actually captured for namespace movement @@ -535,58 +487,112 @@ _GLIBCXX_END_NAMESPACE _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _Tp> - inline int - fpclassify(_Tp __f) { return ::__gnu_cxx::__capture_fpclassify(__f); } + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type + fpclassify(_Tp __f) + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return ::__gnu_cxx::__capture_fpclassify(__type(__f)); + } template<typename _Tp> - inline int - isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); } + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type + isfinite(_Tp __f) + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isfinite(__type(__f)); + } template<typename _Tp> - inline int - isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); } + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type + isinf(_Tp __f) + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isinf(__type(__f)); + } template<typename _Tp> - inline int - isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); } + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type + isnan(_Tp __f) + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isnan(__type(__f)); + } template<typename _Tp> - inline int - isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); } + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type + isnormal(_Tp __f) + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isnormal(__type(__f)); + } template<typename _Tp> - inline int - signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); } + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type + signbit(_Tp __f) + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_signbit(__type(__f)); + } template<typename _Tp> - inline int + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type isgreater(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); } + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isgreater(__type(__f1), __type(__f2)); + } template<typename _Tp> - inline int + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type isgreaterequal(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); } + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isgreaterequal(__type(__f1), __type(__f2)); + } template<typename _Tp> - inline int + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type isless(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isless(__f1, __f2); } + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isless(__type(__f1), __type(__f2)); + } template<typename _Tp> - inline int + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type islessequal(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); } + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_islessequal(__type(__f1), __type(__f2)); + } template<typename _Tp> - inline int + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type islessgreater(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); } + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_islessgreater(__type(__f1), __type(__f2)); + } template<typename _Tp> - inline int + inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, + int>::__type isunordered(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); } + { + typedef typename __gnu_cxx::__promote<_Tp>::__type __type; + return __builtin_isunordered(__type(__f1), __type(__f2)); + } _GLIBCXX_END_NAMESPACE |

