aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-11-26 18:24:54 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-11-26 18:24:54 +0000
commit0e7edcd5ebda4d219143e42f6daaa9633779e71b (patch)
tree253a8e89ce7d5885ccd6131af8d42a636a2d28a8 /libstdc++-v3/include
parente072c21779512f4831d34f943e317a78749c4297 (diff)
downloadgcc-0e7edcd5ebda4d219143e42f6daaa9633779e71b.zip
gcc-0e7edcd5ebda4d219143e42f6daaa9633779e71b.tar.gz
gcc-0e7edcd5ebda4d219143e42f6daaa9633779e71b.tar.bz2
re PR libstdc++/25913 (Client's isnormal function is broken by cmath)
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. From-SVN: r130443
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/c_global/cmath163
-rw-r--r--libstdc++-v3/include/c_std/cmath154
2 files changed, 168 insertions, 149 deletions
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index e37f4e8..f7be4d0 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -166,7 +166,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __builtin_atan2l(__y, __x); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
atan2(_Tp __y, _Up __x)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
@@ -377,7 +381,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __builtin_powil(__x, __n); }
template<typename _Tp, typename _Up>
- inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
+ inline
+ typename __gnu_cxx::__promote_2<
+ typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
+ && __is_arithmetic<_Up>::__value,
+ _Tp>::__type, _Up>::__type
pow(_Tp __x, _Up __y)
{
typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
@@ -478,55 +486,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
@@ -546,58 +505,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
diff --git a/libstdc++-v3/include/c_std/cmath b/libstdc++-v3/include/c_std/cmath
index 897290a..52c1d2a 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