diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8a2f2fc94cf..218b2257b64 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,31 @@ +2006-03-10 Paolo Carlini + + * include/tr1/cmath: Add atan2 and pow bits; add using declarations. + * include/tr1/math.h: Add using declarations. + * include/tr1/complex: Add using declarations. + * testsuite/tr1/8_c_compatibility/cmath/functions.cc: Fully + qualify calls. + * testsuite/tr1/8_c_compatibility/cmath/overloads.cc: Likewise; + add atan2 and pow bits. + * testsuite/tr1/8_c_compatibility/complex/overloads_float.cc: Likewise. + * testsuite/tr1/8_c_compatibility/complex/overloads_int.cc: Likewise; + adjust polar bits. + + * acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add checks for double_t + and float_t typedefs. + * include/tr1/cmath: Add double_t and float_t. + * testsuite/tr1/8_c_compatibility/cmath/types.cc: New. + + * include/tr1/ctgmath: New. + * include/tr1/tgmath.h: Likewise. + * include/Makefile.am: Add. + * testsuite/tr1/headers.cc: Update. + + * include/Makefile.in: Regenerate. + * configure: Likewise. + + * docs/html/ext/tr1.html: Update. + 2006-03-08 Paolo Carlini Implement the resolution of DR 455, [DR]. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 4dc38b883ac..fbfb3f79c16 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1194,7 +1194,9 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ AC_MSG_CHECKING([for ISO C99 support to TR1 in ]) AC_CACHE_VAL(ac_c99_math_tr1, [ AC_TRY_COMPILE([#include ], - [acosh(0.0); + [typedef double_t my_double_t; + typedef float_t my_float_t; + acosh(0.0); acoshf(0.0f); acoshl(0.0l); asinh(0.0); diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 9afb94d1a27..fd588134f41 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -30651,7 +30651,9 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -acosh(0.0); +typedef double_t my_double_t; + typedef float_t my_float_t; + acosh(0.0); acoshf(0.0f); acoshl(0.0l); asinh(0.0); diff --git a/libstdc++-v3/docs/html/ext/tr1.html b/libstdc++-v3/docs/html/ext/tr1.html index dcce47327c4..d416e3f2499 100644 --- a/libstdc++-v3/docs/html/ext/tr1.html +++ b/libstdc++-v3/docs/html/ext/tr1.html @@ -1790,7 +1790,7 @@ release. missing - + DR 551 8.3 @@ -1798,7 +1798,7 @@ release. missing - + DR 551 8.4 @@ -1918,7 +1918,7 @@ release. done - abs, div: issue with _Longlong + DR 557 8.11.2 @@ -1963,9 +1963,9 @@ release. 8.16 Additions to header <cmath> + done - missing @@ -1995,17 +1995,17 @@ release. 8.16.4 Additional overloads + done - missing - + DR 568; DR 550 8.17 Additions to header <math.h> + done - missing @@ -2163,18 +2163,18 @@ release. 8.27 Header <ctgmath> + done - missing - + DR 551 8.28 Header <tgmath.h> + done - missing - + DR 551 8.29 @@ -2307,7 +2307,7 @@ permitted in any medium, provided this notice is preserved.
- Last modified 2006-02-26 + Last modified 2006-03-10 diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 0d179c9bfbd..37538b47cba 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -497,6 +497,7 @@ tr1_headers = \ ${tr1_srcdir}/cstdint \ ${tr1_srcdir}/cstdio \ ${tr1_srcdir}/cstdlib \ + ${tr1_srcdir}/ctgmath \ ${tr1_srcdir}/ctime \ ${tr1_srcdir}/ctype.h \ ${tr1_srcdir}/cwchar \ @@ -519,6 +520,7 @@ tr1_headers = \ ${tr1_srcdir}/stdint.h \ ${tr1_srcdir}/stdio.h \ ${tr1_srcdir}/stdlib.h \ + ${tr1_srcdir}/tgmath.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/type_traits \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index c749a2c9a42..7e2f744002a 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -716,6 +716,7 @@ tr1_headers = \ ${tr1_srcdir}/cstdint \ ${tr1_srcdir}/cstdio \ ${tr1_srcdir}/cstdlib \ + ${tr1_srcdir}/ctgmath \ ${tr1_srcdir}/ctime \ ${tr1_srcdir}/ctype.h \ ${tr1_srcdir}/cwchar \ @@ -738,6 +739,7 @@ tr1_headers = \ ${tr1_srcdir}/stdint.h \ ${tr1_srcdir}/stdio.h \ ${tr1_srcdir}/stdlib.h \ + ${tr1_srcdir}/tgmath.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/type_traits \ diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath index 0bde0570175..74b407127fb 100644 --- a/libstdc++-v3/include/tr1/cmath +++ b/libstdc++-v3/include/tr1/cmath @@ -146,11 +146,35 @@ #undef truncf #undef truncl +// Workaround for c++/21682. +namespace __gnu_internal +{ + template + inline typename + std::__enable_if::__type, + (std::__is_floating<_Tp>::__value + || std::__is_floating<_Up>::__value)>::__type + atan2(_Tp __y, _Up __x) + { + typedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type; + return std::atan2(__type(__y), __type(__x)); + } +} + +#endif + // namespace std::tr1 namespace std { _GLIBCXX_BEGIN_NAMESPACE(tr1) +#if _GLIBCXX_USE_C99_MATH_TR1 + + // types + using ::double_t; + using ::float_t; + + // functions using ::acosh; using ::acoshf; using ::acoshl; @@ -291,18 +315,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) using ::truncf; using ::truncl; -_GLIBCXX_END_NAMESPACE -} - #endif -// namespace std::tr1 -namespace std -{ -_GLIBCXX_BEGIN_NAMESPACE(tr1) - #if _GLIBCXX_USE_C99_MATH #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC + + /// @brief Function template definitions [8.16.3]. + // using std::signbit; using std::fpclassify; @@ -325,6 +344,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) /// @brief Additional overloads [8.16.4]. // + using std::acos; + inline float acosh(float __x) { return __builtin_acoshf(__x); } @@ -341,6 +362,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return acosh(__type(__x)); } + using std::asin; + inline float asinh(float __x) { return __builtin_asinhf(__x); } @@ -357,6 +380,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return asinh(__type(__x)); } + using std::atan; + using std::atan2; + + // Workaround for c++/21682. + using __gnu_internal::atan2; + inline float atanh(float __x) { return __builtin_atanhf(__x); } @@ -389,6 +418,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return cbrt(__type(__x)); } + using std::ceil; + inline float copysign(float __x, float __y) { return __builtin_copysignf(__x, __y); } @@ -405,6 +436,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return copysign(__type(__x), __type(__y)); } + using std::cos; + using std::cosh; + inline float erf(float __x) { return __builtin_erff(__x); } @@ -437,6 +471,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return erfc(__type(__x)); } + using std::exp; + inline float exp2(float __x) { return __builtin_exp2f(__x); } @@ -469,6 +505,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return expm1(__type(__x)); } + using std::fabs; + inline float fdim(float __x, float __y) { return __builtin_fdimf(__x, __y); } @@ -485,6 +523,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return fdim(__type(__x), __type(__y)); } + using std::floor; + inline float fma(float __x, float __y, float __z) { return __builtin_fmaf(__x, __y, __z); } @@ -533,6 +573,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return fmin(__type(__x), __type(__y)); } + using std::fmod; + using std::frexp; + inline float hypot(float __x, float __y) { return __builtin_hypotf(__x, __y); } @@ -565,6 +608,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return ilogb(__type(__x)); } + using std::ldexp; + inline float lgamma(float __x) { return __builtin_lgammaf(__x); } @@ -613,6 +658,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return llround(__type(__x)); } + using std::log; + using std::log10; + inline float log1p(float __x) { return __builtin_log1pf(__x); } @@ -629,6 +677,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return log1p(__type(__x)); } + // DR 568. inline float log2(float __x) { return __builtin_log2f(__x); } @@ -741,6 +790,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return nexttoward(__type(__x), __y); } + using std::pow; + + // DR 550. + template + inline typename __promote_2<_Tp, _Up>::__type + pow(_Tp __x, _Up __y) + { + typedef typename __promote_2<_Tp, _Up>::__type __type; + return pow(__type(__x), __type(__y)); + } + inline float remainder(float __x, float __y) { return __builtin_remainderf(__x, __y); } @@ -837,6 +897,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return scalbn(__type(__x), __ex); } + using std::sin; + using std::sinh; + using std::sqrt; + using std::tan; + using std::tanh; + inline float tgamma(float __x) { return __builtin_tgammaf(__x); } diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex index 1ba6157d0cc..4192b531c85 100644 --- a/libstdc++-v3/include/tr1/complex +++ b/libstdc++-v3/include/tr1/complex @@ -325,6 +325,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) }; + using std::arg; + template inline typename __promote<_Tp>::__type arg(_Tp __x) @@ -333,16 +335,22 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return std::arg(std::complex<__type>(__x)); } + using std::conj; + template inline std::complex::__type> conj(_Tp __x) { return __x; } + using std::imag; + template inline typename __promote<_Tp>::__type imag(_Tp) { return _Tp(); } + using std::norm; + template inline typename __promote<_Tp>::__type norm(_Tp __x) @@ -351,6 +359,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return __type(__x) * __type(__x); } + using std::polar; + template inline std::complex::__type> polar(const _Tp& __rho, const _Up& __theta) @@ -359,6 +369,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return std::polar(__type(__rho), __type(__theta)); } + using std::pow; + template inline std::complex::__type> pow(const std::complex<_Tp>& __x, const _Up& __y) @@ -384,6 +396,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) std::complex<__type>(__y)); } + using std::real; + template inline typename __promote<_Tp>::__type real(_Tp __x) diff --git a/libstdc++-v3/include/tr1/ctgmath b/libstdc++-v3/include/tr1/ctgmath new file mode 100644 index 00000000000..9f9132fb5b1 --- /dev/null +++ b/libstdc++-v3/include/tr1/ctgmath @@ -0,0 +1,39 @@ +// TR1 ctgmath -*- C++ -*- + +// Copyright (C) 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file + * This is a TR1 C++ Library header. + */ + +#ifndef _TR1_CTGMATH +#define _TR1_CTGMATH 1 + +#include + +#endif diff --git a/libstdc++-v3/include/tr1/math.h b/libstdc++-v3/include/tr1/math.h index a0dd24ba4ac..0a3e08bbc4e 100644 --- a/libstdc++-v3/include/tr1/math.h +++ b/libstdc++-v3/include/tr1/math.h @@ -36,4 +36,64 @@ #include +#if _GLIBCXX_USE_C99_MATH_TR1 + +using std::tr1::acos; +using std::tr1::acosh; +using std::tr1::asin; +using std::tr1::asinh; +using std::tr1::atan; +using std::tr1::atan2; +using std::tr1::atanh; +using std::tr1::cbrt; +using std::tr1::ceil; +using std::tr1::copysign; +using std::tr1::cos; +using std::tr1::cosh; +using std::tr1::erf; +using std::tr1::erfc; +using std::tr1::exp; +using std::tr1::exp2; +using std::tr1::expm1; +using std::tr1::fabs; +using std::tr1::fdim; +using std::tr1::floor; +using std::tr1::fma; +using std::tr1::fmax; +using std::tr1::fmin; +using std::tr1::fmod; +using std::tr1::frexp; +using std::tr1::hypot; +using std::tr1::ilogb; +using std::tr1::ldexp; +using std::tr1::lgamma; +using std::tr1::llrint; +using std::tr1::llround; +using std::tr1::log; +using std::tr1::log10; +using std::tr1::log1p; +using std::tr1::log2; +using std::tr1::logb; +using std::tr1::lrint; +using std::tr1::lround; +using std::tr1::nearbyint; +using std::tr1::nextafter; +using std::tr1::nexttoward; +using std::tr1::pow; +using std::tr1::remainder; +using std::tr1::remquo; +using std::tr1::rint; +using std::tr1::round; +using std::tr1::scalbln; +using std::tr1::scalbn; +using std::tr1::sin; +using std::tr1::sinh; +using std::tr1::sqrt; +using std::tr1::tan; +using std::tr1::tanh; +using std::tr1::tgamma; +using std::tr1::trunc; + +#endif + #endif diff --git a/libstdc++-v3/include/tr1/tgmath.h b/libstdc++-v3/include/tr1/tgmath.h new file mode 100644 index 00000000000..cfc0d586936 --- /dev/null +++ b/libstdc++-v3/include/tr1/tgmath.h @@ -0,0 +1,39 @@ +// TR1 tgmath.h -*- C++ -*- + +// Copyright (C) 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file + * This is a TR1 C++ Library header. + */ + +#ifndef _TR1_TGMATH_H +#define _TR1_TGMATH_H 1 + +#include + +#endif diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc index a0949fad088..3bb6d9d8bf9 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc @@ -43,145 +43,145 @@ void test01() long lret; long long llret; - ret = acosh(d0); - fret = acoshf(f0); - ldret = acoshl(ld0); + ret = std::tr1::acosh(d0); + fret = std::tr1::acoshf(f0); + ldret = std::tr1::acoshl(ld0); - ret = asinh(d0); - fret = asinhf(f0); - ldret = asinhl(ld0); + ret = std::tr1::asinh(d0); + fret = std::tr1::asinhf(f0); + ldret = std::tr1::asinhl(ld0); - ret = atanh(d0); - fret = atanhf(f0); - ldret = atanhl(ld0); + ret = std::tr1::atanh(d0); + fret = std::tr1::atanhf(f0); + ldret = std::tr1::atanhl(ld0); - ret = cbrt(d0); - fret = cbrtf(f0); - ldret = cbrtl(ld0); + ret = std::tr1::cbrt(d0); + fret = std::tr1::cbrtf(f0); + ldret = std::tr1::cbrtl(ld0); - ret = copysign(d0, d0); - fret = copysignf(f0, f0); - ldret = copysignl(ld0, ld0); + ret = std::tr1::copysign(d0, d0); + fret = std::tr1::copysignf(f0, f0); + ldret = std::tr1::copysignl(ld0, ld0); - ret = erf(d0); - fret = erff(f0); - ldret = erfl(ld0); + ret = std::tr1::erf(d0); + fret = std::tr1::erff(f0); + ldret = std::tr1::erfl(ld0); - ret = erfc(d0); - fret = erfcf(f0); - ldret = erfcl(ld0); + ret = std::tr1::erfc(d0); + fret = std::tr1::erfcf(f0); + ldret = std::tr1::erfcl(ld0); - ret = exp2(d0); - fret = exp2f(f0); - ldret = exp2l(ld0); + ret = std::tr1::exp2(d0); + fret = std::tr1::exp2f(f0); + ldret = std::tr1::exp2l(ld0); - ret = expm1(d0); - fret = expm1f(f0); - ldret = expm1l(ld0); + ret = std::tr1::expm1(d0); + fret = std::tr1::expm1f(f0); + ldret = std::tr1::expm1l(ld0); - ret = fdim(d0, d0); - fret = fdimf(f0, f0); - ldret = fdiml(ld0, ld0); + ret = std::tr1::fdim(d0, d0); + fret = std::tr1::fdimf(f0, f0); + ldret = std::tr1::fdiml(ld0, ld0); - ret = fma(d0, d0, d0); - fret = fmaf(f0, f0, f0); - ldret = fmal(ld0, ld0, ld0); + ret = std::tr1::fma(d0, d0, d0); + fret = std::tr1::fmaf(f0, f0, f0); + ldret = std::tr1::fmal(ld0, ld0, ld0); - ret = fmax(d0, d0); - fret = fmaxf(f0, f0); - ldret = fmaxl(ld0, ld0); + ret = std::tr1::fmax(d0, d0); + fret = std::tr1::fmaxf(f0, f0); + ldret = std::tr1::fmaxl(ld0, ld0); - ret = fmin(d0, d0); - fret = fminf(f0, f0); - ldret = fminl(ld0, ld0); + ret = std::tr1::fmin(d0, d0); + fret = std::tr1::fminf(f0, f0); + ldret = std::tr1::fminl(ld0, ld0); - ret = hypot(d0, d0); - fret = hypotf(f0, f0); - ldret = hypotl(ld0, ld0); + ret = std::tr1::hypot(d0, d0); + fret = std::tr1::hypotf(f0, f0); + ldret = std::tr1::hypotl(ld0, ld0); - iret = ilogb(d0); - iret = ilogbf(f0); - iret = ilogbl(ld0); + iret = std::tr1::ilogb(d0); + iret = std::tr1::ilogbf(f0); + iret = std::tr1::ilogbl(ld0); - ret = lgamma(d0); - fret = lgammaf(f0); - ldret = lgammal(ld0); + ret = std::tr1::lgamma(d0); + fret = std::tr1::lgammaf(f0); + ldret = std::tr1::lgammal(ld0); - llret = llrint(d0); - llret = llrintf(f0); - llret = llrintl(ld0); + llret = std::tr1::llrint(d0); + llret = std::tr1::llrintf(f0); + llret = std::tr1::llrintl(ld0); - llret = llround(d0); - llret = llroundf(f0); - llret = llroundl(ld0); + llret = std::tr1::llround(d0); + llret = std::tr1::llroundf(f0); + llret = std::tr1::llroundl(ld0); - ret = log1p(d0); - fret = log1pf(f0); - ldret = log1pl(ld0); + ret = std::tr1::log1p(d0); + fret = std::tr1::log1pf(f0); + ldret = std::tr1::log1pl(ld0); - ret = log2(d0); - fret = log2f(f0); - ldret = log2l(ld0); + ret = std::tr1::log2(d0); + fret = std::tr1::log2f(f0); + ldret = std::tr1::log2l(ld0); - ret = logb(d0); - fret = logbf(f0); - ldret = logbl(ld0); + ret = std::tr1::logb(d0); + fret = std::tr1::logbf(f0); + ldret = std::tr1::logbl(ld0); - lret = lrint(d0); - lret = lrintf(f0); - lret = lrintl(ld0); + lret = std::tr1::lrint(d0); + lret = std::tr1::lrintf(f0); + lret = std::tr1::lrintl(ld0); - lret = lround(d0); - lret = lroundf(f0); - lret = lroundl(ld0); + lret = std::tr1::lround(d0); + lret = std::tr1::lroundf(f0); + lret = std::tr1::lroundl(ld0); - ret = nan(str); - fret = nanf(str); - ldret = nanl(str); + ret = std::tr1::nan(str); + fret = std::tr1::nanf(str); + ldret = std::tr1::nanl(str); - ret = nearbyint(d0); - fret = nearbyintf(f0); - ldret = nearbyintl(ld0); + ret = std::tr1::nearbyint(d0); + fret = std::tr1::nearbyintf(f0); + ldret = std::tr1::nearbyintl(ld0); - ret = nextafter(d0, d0); - fret = nextafterf(f0, f0); - ldret = nextafterl(ld0, ld0); + ret = std::tr1::nextafter(d0, d0); + fret = std::tr1::nextafterf(f0, f0); + ldret = std::tr1::nextafterl(ld0, ld0); - ret = nexttoward(d0, ld0); - fret = nexttowardf(f0, ld0); - ldret = nexttowardl(ld0, ld0); + ret = std::tr1::nexttoward(d0, ld0); + fret = std::tr1::nexttowardf(f0, ld0); + ldret = std::tr1::nexttowardl(ld0, ld0); - ret = remainder(d0, d0); - fret = remainderf(f0, f0); - ldret = remainderl(ld0, ld0); + ret = std::tr1::remainder(d0, d0); + fret = std::tr1::remainderf(f0, f0); + ldret = std::tr1::remainderl(ld0, ld0); - ret = remquo(d0, d0, pquo); - fret = remquo(f0, f0, pquo); - ldret = remquo(ld0, ld0, pquo); + ret = std::tr1::remquo(d0, d0, pquo); + fret = std::tr1::remquo(f0, f0, pquo); + ldret = std::tr1::remquo(ld0, ld0, pquo); - ret = rint(d0); - fret = rintf(f0); - ldret = rintl(ld0); + ret = std::tr1::rint(d0); + fret = std::tr1::rintf(f0); + ldret = std::tr1::rintl(ld0); - ret = round(d0); - fret = roundf(f0); - ldret = roundl(ld0); + ret = std::tr1::round(d0); + fret = std::tr1::roundf(f0); + ldret = std::tr1::roundl(ld0); - ret = scalbln(d0, lex); - fret = scalblnf(f0, lex); - ldret = scalblnl(ld0, lex); + ret = std::tr1::scalbln(d0, lex); + fret = std::tr1::scalblnf(f0, lex); + ldret = std::tr1::scalblnl(ld0, lex); - ret = scalbn(d0, ex); - fret = scalbnf(f0, ex); - ldret = scalbnl(ld0, ex); + ret = std::tr1::scalbn(d0, ex); + fret = std::tr1::scalbnf(f0, ex); + ldret = std::tr1::scalbnl(ld0, ex); - ret = tgamma(d0); - fret = tgammaf(f0); - ldret = tgammal(ld0); + ret = std::tr1::tgamma(d0); + fret = std::tr1::tgammaf(f0); + ldret = std::tr1::tgammal(ld0); - ret = trunc(d0); - fret = truncf(f0); - ldret = truncl(ld0); + ret = std::tr1::trunc(d0); + fret = std::tr1::truncf(f0); + ldret = std::tr1::truncl(ld0); #endif } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc index e54a8e322de..e925340081e 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc @@ -29,7 +29,6 @@ void test01() { #if _GLIBCXX_USE_C99_MATH_TR1 - using namespace std::tr1; using namespace __gnu_test; double d0 = 0.0; @@ -40,202 +39,222 @@ void test01() long lex = 0l; int ex = 0; - check_ret_type(acosh(d0)); - check_ret_type(acosh(f0)); - check_ret_type(acosh(ld0)); - check_ret_type(acosh(i0)); + check_ret_type(std::tr1::atan2(d0, d0)); + check_ret_type(std::tr1::atan2(d0, f0)); + check_ret_type(std::tr1::atan2(f0, f0)); + check_ret_type(std::tr1::atan2(ld0, ld0)); + check_ret_type(std::tr1::atan2(ld0, d0)); + check_ret_type(std::tr1::atan2(i0, i0)); + check_ret_type(std::tr1::atan2(d0, i0)); - check_ret_type(asinh(d0)); - check_ret_type(asinh(f0)); - check_ret_type(asinh(ld0)); - check_ret_type(asinh(i0)); + check_ret_type(std::tr1::acosh(d0)); + check_ret_type(std::tr1::acosh(f0)); + check_ret_type(std::tr1::acosh(ld0)); + check_ret_type(std::tr1::acosh(i0)); - check_ret_type(atanh(d0)); - check_ret_type(atanh(f0)); - check_ret_type(atanh(ld0)); - check_ret_type(atanh(i0)); + check_ret_type(std::tr1::asinh(d0)); + check_ret_type(std::tr1::asinh(f0)); + check_ret_type(std::tr1::asinh(ld0)); + check_ret_type(std::tr1::asinh(i0)); - check_ret_type(cbrt(d0)); - check_ret_type(cbrt(f0)); - check_ret_type(cbrt(ld0)); - check_ret_type(cbrt(i0)); + check_ret_type(std::tr1::atanh(d0)); + check_ret_type(std::tr1::atanh(f0)); + check_ret_type(std::tr1::atanh(ld0)); + check_ret_type(std::tr1::atanh(i0)); - check_ret_type(copysign(d0, d0)); - check_ret_type(copysign(d0, f0)); - check_ret_type(copysign(f0, f0)); - check_ret_type(copysign(ld0, ld0)); - check_ret_type(copysign(ld0, d0)); - check_ret_type(copysign(i0, i0)); - check_ret_type(copysign(d0, i0)); + check_ret_type(std::tr1::cbrt(d0)); + check_ret_type(std::tr1::cbrt(f0)); + check_ret_type(std::tr1::cbrt(ld0)); + check_ret_type(std::tr1::cbrt(i0)); - check_ret_type(erf(d0)); - check_ret_type(erf(f0)); - check_ret_type(erf(ld0)); - check_ret_type(erf(i0)); + check_ret_type(std::tr1::copysign(d0, d0)); + check_ret_type(std::tr1::copysign(d0, f0)); + check_ret_type(std::tr1::copysign(f0, f0)); + check_ret_type(std::tr1::copysign(ld0, ld0)); + check_ret_type(std::tr1::copysign(ld0, d0)); + check_ret_type(std::tr1::copysign(i0, i0)); + check_ret_type(std::tr1::copysign(d0, i0)); - check_ret_type(erfc(d0)); - check_ret_type(erfc(f0)); - check_ret_type(erfc(ld0)); - check_ret_type(erfc(i0)); + check_ret_type(std::tr1::erf(d0)); + check_ret_type(std::tr1::erf(f0)); + check_ret_type(std::tr1::erf(ld0)); + check_ret_type(std::tr1::erf(i0)); - check_ret_type(exp2(d0)); - check_ret_type(exp2(f0)); - check_ret_type(exp2(ld0)); - check_ret_type(exp2(i0)); + check_ret_type(std::tr1::erfc(d0)); + check_ret_type(std::tr1::erfc(f0)); + check_ret_type(std::tr1::erfc(ld0)); + check_ret_type(std::tr1::erfc(i0)); - check_ret_type(expm1(d0)); - check_ret_type(expm1(f0)); - check_ret_type(expm1(ld0)); - check_ret_type(expm1(i0)); + check_ret_type(std::tr1::exp2(d0)); + check_ret_type(std::tr1::exp2(f0)); + check_ret_type(std::tr1::exp2(ld0)); + check_ret_type(std::tr1::exp2(i0)); - check_ret_type(fdim(d0, d0)); - check_ret_type(fdim(d0, f0)); - check_ret_type(fdim(f0, f0)); - check_ret_type(fdim(ld0, ld0)); - check_ret_type(fdim(ld0, d0)); - check_ret_type(fdim(i0, i0)); - check_ret_type(fdim(d0, i0)); + check_ret_type(std::tr1::expm1(d0)); + check_ret_type(std::tr1::expm1(f0)); + check_ret_type(std::tr1::expm1(ld0)); + check_ret_type(std::tr1::expm1(i0)); - check_ret_type(fma(d0, d0, d0)); - check_ret_type(fma(d0, f0, d0)); - check_ret_type(fma(f0, f0, f0)); - check_ret_type(fma(ld0, ld0, ld0)); - check_ret_type(fma(ld0, d0, f0)); - check_ret_type(fma(i0, i0, i0)); - check_ret_type(fma(d0, i0, f0)); + check_ret_type(std::tr1::fdim(d0, d0)); + check_ret_type(std::tr1::fdim(d0, f0)); + check_ret_type(std::tr1::fdim(f0, f0)); + check_ret_type(std::tr1::fdim(ld0, ld0)); + check_ret_type(std::tr1::fdim(ld0, d0)); + check_ret_type(std::tr1::fdim(i0, i0)); + check_ret_type(std::tr1::fdim(d0, i0)); - check_ret_type(fmax(d0, d0)); - check_ret_type(fmax(d0, f0)); - check_ret_type(fmax(f0, f0)); - check_ret_type(fmax(ld0, ld0)); - check_ret_type(fmax(ld0, d0)); - check_ret_type(fmax(i0, i0)); - check_ret_type(fmax(d0, i0)); + check_ret_type(std::tr1::fma(d0, d0, d0)); + check_ret_type(std::tr1::fma(d0, f0, d0)); + check_ret_type(std::tr1::fma(f0, f0, f0)); + check_ret_type(std::tr1::fma(ld0, ld0, ld0)); + check_ret_type(std::tr1::fma(ld0, d0, f0)); + check_ret_type(std::tr1::fma(i0, i0, i0)); + check_ret_type(std::tr1::fma(d0, i0, f0)); - check_ret_type(fmin(d0, d0)); - check_ret_type(fmin(d0, f0)); - check_ret_type(fmin(f0, f0)); - check_ret_type(fmin(ld0, ld0)); - check_ret_type(fmin(ld0, d0)); - check_ret_type(fmin(i0, i0)); - check_ret_type(fmin(d0, i0)); + check_ret_type(std::tr1::fmax(d0, d0)); + check_ret_type(std::tr1::fmax(d0, f0)); + check_ret_type(std::tr1::fmax(f0, f0)); + check_ret_type(std::tr1::fmax(ld0, ld0)); + check_ret_type(std::tr1::fmax(ld0, d0)); + check_ret_type(std::tr1::fmax(i0, i0)); + check_ret_type(std::tr1::fmax(d0, i0)); - check_ret_type(hypot(d0, d0)); - check_ret_type(hypot(d0, f0)); - check_ret_type(hypot(f0, f0)); - check_ret_type(hypot(ld0, ld0)); - check_ret_type(hypot(ld0, d0)); - check_ret_type(hypot(i0, i0)); - check_ret_type(hypot(d0, i0)); + check_ret_type(std::tr1::fmin(d0, d0)); + check_ret_type(std::tr1::fmin(d0, f0)); + check_ret_type(std::tr1::fmin(f0, f0)); + check_ret_type(std::tr1::fmin(ld0, ld0)); + check_ret_type(std::tr1::fmin(ld0, d0)); + check_ret_type(std::tr1::fmin(i0, i0)); + check_ret_type(std::tr1::fmin(d0, i0)); - check_ret_type(ilogb(d0)); - check_ret_type(ilogb(f0)); - check_ret_type(ilogb(ld0)); - check_ret_type(ilogb(i0)); + check_ret_type(std::tr1::hypot(d0, d0)); + check_ret_type(std::tr1::hypot(d0, f0)); + check_ret_type(std::tr1::hypot(f0, f0)); + check_ret_type(std::tr1::hypot(ld0, ld0)); + check_ret_type(std::tr1::hypot(ld0, d0)); + check_ret_type(std::tr1::hypot(i0, i0)); + check_ret_type(std::tr1::hypot(d0, i0)); - check_ret_type(lgamma(d0)); - check_ret_type(lgamma(f0)); - check_ret_type(lgamma(ld0)); - check_ret_type(lgamma(i0)); + check_ret_type(std::tr1::ilogb(d0)); + check_ret_type(std::tr1::ilogb(f0)); + check_ret_type(std::tr1::ilogb(ld0)); + check_ret_type(std::tr1::ilogb(i0)); - check_ret_type(llrint(d0)); - check_ret_type(llrint(f0)); - check_ret_type(llrint(ld0)); - check_ret_type(llrint(i0)); + check_ret_type(std::tr1::lgamma(d0)); + check_ret_type(std::tr1::lgamma(f0)); + check_ret_type(std::tr1::lgamma(ld0)); + check_ret_type(std::tr1::lgamma(i0)); - check_ret_type(llround(d0)); - check_ret_type(llround(f0)); - check_ret_type(llround(ld0)); - check_ret_type(llround(i0)); + check_ret_type(std::tr1::llrint(d0)); + check_ret_type(std::tr1::llrint(f0)); + check_ret_type(std::tr1::llrint(ld0)); + check_ret_type(std::tr1::llrint(i0)); - check_ret_type(log1p(d0)); - check_ret_type(log1p(f0)); - check_ret_type(log1p(ld0)); - check_ret_type(log1p(i0)); + check_ret_type(std::tr1::llround(d0)); + check_ret_type(std::tr1::llround(f0)); + check_ret_type(std::tr1::llround(ld0)); + check_ret_type(std::tr1::llround(i0)); - check_ret_type(log2(d0)); - check_ret_type(log2(f0)); - check_ret_type(log2(ld0)); - check_ret_type(log2(i0)); + check_ret_type(std::tr1::log1p(d0)); + check_ret_type(std::tr1::log1p(f0)); + check_ret_type(std::tr1::log1p(ld0)); + check_ret_type(std::tr1::log1p(i0)); - check_ret_type(logb(d0)); - check_ret_type(logb(f0)); - check_ret_type(logb(ld0)); - check_ret_type(logb(i0)); + // DR 568. + check_ret_type(std::tr1::log2(d0)); + check_ret_type(std::tr1::log2(f0)); + check_ret_type(std::tr1::log2(ld0)); + check_ret_type(std::tr1::log2(i0)); - check_ret_type(lrint(d0)); - check_ret_type(lrint(f0)); - check_ret_type(lrint(ld0)); - check_ret_type(lrint(i0)); + check_ret_type(std::tr1::logb(d0)); + check_ret_type(std::tr1::logb(f0)); + check_ret_type(std::tr1::logb(ld0)); + check_ret_type(std::tr1::logb(i0)); - check_ret_type(lround(d0)); - check_ret_type(lround(f0)); - check_ret_type(lround(ld0)); - check_ret_type(lround(i0)); + check_ret_type(std::tr1::lrint(d0)); + check_ret_type(std::tr1::lrint(f0)); + check_ret_type(std::tr1::lrint(ld0)); + check_ret_type(std::tr1::lrint(i0)); - check_ret_type(nearbyint(d0)); - check_ret_type(nearbyint(f0)); - check_ret_type(nearbyint(ld0)); - check_ret_type(nearbyint(i0)); + check_ret_type(std::tr1::lround(d0)); + check_ret_type(std::tr1::lround(f0)); + check_ret_type(std::tr1::lround(ld0)); + check_ret_type(std::tr1::lround(i0)); - check_ret_type(nextafter(d0, d0)); - check_ret_type(nextafter(d0, f0)); - check_ret_type(nextafter(f0, f0)); - check_ret_type(nextafter(ld0, ld0)); - check_ret_type(nextafter(ld0, d0)); - check_ret_type(nextafter(i0, i0)); - check_ret_type(nextafter(d0, i0)); + check_ret_type(std::tr1::nearbyint(d0)); + check_ret_type(std::tr1::nearbyint(f0)); + check_ret_type(std::tr1::nearbyint(ld0)); + check_ret_type(std::tr1::nearbyint(i0)); - check_ret_type(nexttoward(d0, ld0)); - check_ret_type(nexttoward(f0, ld0)); - check_ret_type(nexttoward(ld0, ld0)); - check_ret_type(nexttoward(i0, ld0)); + check_ret_type(std::tr1::nextafter(d0, d0)); + check_ret_type(std::tr1::nextafter(d0, f0)); + check_ret_type(std::tr1::nextafter(f0, f0)); + check_ret_type(std::tr1::nextafter(ld0, ld0)); + check_ret_type(std::tr1::nextafter(ld0, d0)); + check_ret_type(std::tr1::nextafter(i0, i0)); + check_ret_type(std::tr1::nextafter(d0, i0)); - check_ret_type(remainder(d0, d0)); - check_ret_type(remainder(d0, f0)); - check_ret_type(remainder(f0, f0)); - check_ret_type(remainder(ld0, ld0)); - check_ret_type(remainder(ld0, d0)); - check_ret_type(remainder(i0, i0)); - check_ret_type(remainder(d0, i0)); + check_ret_type(std::tr1::nexttoward(d0, ld0)); + check_ret_type(std::tr1::nexttoward(f0, ld0)); + check_ret_type(std::tr1::nexttoward(ld0, ld0)); + check_ret_type(std::tr1::nexttoward(i0, ld0)); - check_ret_type(remquo(d0, d0, pquo)); - check_ret_type(remquo(d0, f0, pquo)); - check_ret_type(remquo(f0, f0, pquo)); - check_ret_type(remquo(ld0, ld0, pquo)); - check_ret_type(remquo(ld0, d0, pquo)); - check_ret_type(remquo(i0, i0, pquo)); - check_ret_type(remquo(d0, i0, pquo)); + check_ret_type(std::tr1::pow(d0, d0)); + check_ret_type(std::tr1::pow(d0, f0)); + check_ret_type(std::tr1::pow(f0, f0)); + check_ret_type(std::tr1::pow(ld0, ld0)); + check_ret_type(std::tr1::pow(ld0, d0)); + check_ret_type(std::tr1::pow(i0, i0)); + check_ret_type(std::tr1::pow(d0, i0)); + // DR 550. + // check_ret_type(std::tr1::pow(f0, i0)); + check_ret_type(std::tr1::pow(f0, i0)); - check_ret_type(rint(d0)); - check_ret_type(rint(f0)); - check_ret_type(rint(ld0)); - check_ret_type(rint(i0)); + check_ret_type(std::tr1::remainder(d0, d0)); + check_ret_type(std::tr1::remainder(d0, f0)); + check_ret_type(std::tr1::remainder(f0, f0)); + check_ret_type(std::tr1::remainder(ld0, ld0)); + check_ret_type(std::tr1::remainder(ld0, d0)); + check_ret_type(std::tr1::remainder(i0, i0)); + check_ret_type(std::tr1::remainder(d0, i0)); - check_ret_type(round(d0)); - check_ret_type(round(f0)); - check_ret_type(round(ld0)); - check_ret_type(round(i0)); + check_ret_type(std::tr1::remquo(d0, d0, pquo)); + check_ret_type(std::tr1::remquo(d0, f0, pquo)); + check_ret_type(std::tr1::remquo(f0, f0, pquo)); + check_ret_type(std::tr1::remquo(ld0, ld0, pquo)); + check_ret_type(std::tr1::remquo(ld0, d0, pquo)); + check_ret_type(std::tr1::remquo(i0, i0, pquo)); + check_ret_type(std::tr1::remquo(d0, i0, pquo)); - check_ret_type(scalbln(d0, lex)); - check_ret_type(scalbln(f0, lex)); - check_ret_type(scalbln(ld0, lex)); - check_ret_type(scalbln(i0, lex)); + check_ret_type(std::tr1::rint(d0)); + check_ret_type(std::tr1::rint(f0)); + check_ret_type(std::tr1::rint(ld0)); + check_ret_type(std::tr1::rint(i0)); - check_ret_type(scalbn(d0, ex)); - check_ret_type(scalbn(f0, ex)); - check_ret_type(scalbn(ld0, ex)); - check_ret_type(scalbn(i0, ex)); + check_ret_type(std::tr1::round(d0)); + check_ret_type(std::tr1::round(f0)); + check_ret_type(std::tr1::round(ld0)); + check_ret_type(std::tr1::round(i0)); - check_ret_type(tgamma(d0)); - check_ret_type(tgamma(f0)); - check_ret_type(tgamma(ld0)); - check_ret_type(tgamma(i0)); + check_ret_type(std::tr1::scalbln(d0, lex)); + check_ret_type(std::tr1::scalbln(f0, lex)); + check_ret_type(std::tr1::scalbln(ld0, lex)); + check_ret_type(std::tr1::scalbln(i0, lex)); - check_ret_type(trunc(d0)); - check_ret_type(trunc(f0)); - check_ret_type(trunc(ld0)); - check_ret_type(trunc(i0)); + check_ret_type(std::tr1::scalbn(d0, ex)); + check_ret_type(std::tr1::scalbn(f0, ex)); + check_ret_type(std::tr1::scalbn(ld0, ex)); + check_ret_type(std::tr1::scalbn(i0, ex)); + + check_ret_type(std::tr1::tgamma(d0)); + check_ret_type(std::tr1::tgamma(f0)); + check_ret_type(std::tr1::tgamma(ld0)); + check_ret_type(std::tr1::tgamma(i0)); + + check_ret_type(std::tr1::trunc(d0)); + check_ret_type(std::tr1::trunc(f0)); + check_ret_type(std::tr1::trunc(ld0)); + check_ret_type(std::tr1::trunc(i0)); #endif } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc new file mode 100644 index 00000000000..dff4b9d2f4c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc @@ -0,0 +1,35 @@ +// { dg-do compile } + +// 2006-03-10 Paolo Carlini +// +// Copyright (C) 2006 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 8.16 Additions to header + +#include + +void test01() +{ +#if _GLIBCXX_USE_C99_MATH_TR1 + + typedef std::tr1::double_t my_double_t; + typedef std::tr1::float_t my_float_t; + +#endif +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc index 21f2d759b99..389f3642360 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc @@ -23,13 +23,11 @@ // 8.1 Additions to header #include -#include #include void test01() { - using namespace std::tr1; - using namespace __gnu_test; + using __gnu_test::check_ret_type; typedef std::complex cmplx_f_type; typedef std::complex cmplx_d_type; @@ -43,63 +41,63 @@ void test01() const cmplx_d_type c_d1(d1, d1); const cmplx_ld_type c_ld1(ld1, ld1); - check_ret_type(arg(f1)); - check_ret_type(arg(d1)); - check_ret_type(arg(ld1)); + check_ret_type(std::tr1::arg(f1)); + check_ret_type(std::tr1::arg(d1)); + check_ret_type(std::tr1::arg(ld1)); - check_ret_type(conj(f1)); - check_ret_type(conj(d1)); - check_ret_type(conj(ld1)); + check_ret_type(std::tr1::conj(f1)); + check_ret_type(std::tr1::conj(d1)); + check_ret_type(std::tr1::conj(ld1)); - check_ret_type(imag(f1)); - check_ret_type(imag(d1)); - check_ret_type(imag(ld1)); + check_ret_type(std::tr1::imag(f1)); + check_ret_type(std::tr1::imag(d1)); + check_ret_type(std::tr1::imag(ld1)); - check_ret_type(norm(f1)); - check_ret_type(norm(d1)); - check_ret_type(norm(ld1)); + check_ret_type(std::tr1::norm(f1)); + check_ret_type(std::tr1::norm(d1)); + check_ret_type(std::tr1::norm(ld1)); - check_ret_type(polar(f1, f1)); - check_ret_type(polar(d1, f1)); - check_ret_type(polar(f1, d1)); - check_ret_type(polar(d1, d1)); - check_ret_type(polar(ld1, d1)); - check_ret_type(polar(d1, ld1)); - check_ret_type(polar(ld1, f1)); - check_ret_type(polar(f1, ld1)); - check_ret_type(polar(ld1, ld1)); + check_ret_type(std::tr1::polar(f1, f1)); + check_ret_type(std::tr1::polar(d1, f1)); + check_ret_type(std::tr1::polar(f1, d1)); + check_ret_type(std::tr1::polar(d1, d1)); + check_ret_type(std::tr1::polar(ld1, d1)); + check_ret_type(std::tr1::polar(d1, ld1)); + check_ret_type(std::tr1::polar(ld1, f1)); + check_ret_type(std::tr1::polar(f1, ld1)); + check_ret_type(std::tr1::polar(ld1, ld1)); - check_ret_type(pow(c_f1, f1)); - check_ret_type(pow(c_d1, f1)); - check_ret_type(pow(c_f1, d1)); - check_ret_type(pow(c_d1, d1)); - check_ret_type(pow(c_ld1, d1)); - check_ret_type(pow(c_d1, ld1)); - check_ret_type(pow(c_ld1, f1)); - check_ret_type(pow(c_f1, ld1)); - check_ret_type(pow(c_ld1, ld1)); + check_ret_type(std::tr1::pow(c_f1, f1)); + check_ret_type(std::tr1::pow(c_d1, f1)); + check_ret_type(std::tr1::pow(c_f1, d1)); + check_ret_type(std::tr1::pow(c_d1, d1)); + check_ret_type(std::tr1::pow(c_ld1, d1)); + check_ret_type(std::tr1::pow(c_d1, ld1)); + check_ret_type(std::tr1::pow(c_ld1, f1)); + check_ret_type(std::tr1::pow(c_f1, ld1)); + check_ret_type(std::tr1::pow(c_ld1, ld1)); - check_ret_type(pow(f1, c_f1)); - check_ret_type(pow(d1, c_f1)); - check_ret_type(pow(f1, c_d1)); - check_ret_type(pow(d1, c_d1)); - check_ret_type(pow(ld1, c_d1)); - check_ret_type(pow(d1, c_ld1)); - check_ret_type(pow(ld1, c_f1)); - check_ret_type(pow(f1, c_ld1)); - check_ret_type(pow(ld1, c_ld1)); + check_ret_type(std::tr1::pow(f1, c_f1)); + check_ret_type(std::tr1::pow(d1, c_f1)); + check_ret_type(std::tr1::pow(f1, c_d1)); + check_ret_type(std::tr1::pow(d1, c_d1)); + check_ret_type(std::tr1::pow(ld1, c_d1)); + check_ret_type(std::tr1::pow(d1, c_ld1)); + check_ret_type(std::tr1::pow(ld1, c_f1)); + check_ret_type(std::tr1::pow(f1, c_ld1)); + check_ret_type(std::tr1::pow(ld1, c_ld1)); - check_ret_type(pow(c_f1, c_f1)); - check_ret_type(pow(c_d1, c_f1)); - check_ret_type(pow(c_f1, c_d1)); - check_ret_type(pow(c_d1, c_d1)); - check_ret_type(pow(c_ld1, c_d1)); - check_ret_type(pow(c_d1, c_ld1)); - check_ret_type(pow(c_ld1, c_f1)); - check_ret_type(pow(c_f1, c_ld1)); - check_ret_type(pow(c_ld1, c_ld1)); + check_ret_type(std::tr1::pow(c_f1, c_f1)); + check_ret_type(std::tr1::pow(c_d1, c_f1)); + check_ret_type(std::tr1::pow(c_f1, c_d1)); + check_ret_type(std::tr1::pow(c_d1, c_d1)); + check_ret_type(std::tr1::pow(c_ld1, c_d1)); + check_ret_type(std::tr1::pow(c_d1, c_ld1)); + check_ret_type(std::tr1::pow(c_ld1, c_f1)); + check_ret_type(std::tr1::pow(c_f1, c_ld1)); + check_ret_type(std::tr1::pow(c_ld1, c_ld1)); - check_ret_type(real(f1)); - check_ret_type(real(d1)); - check_ret_type(real(ld1)); + check_ret_type(std::tr1::real(f1)); + check_ret_type(std::tr1::real(d1)); + check_ret_type(std::tr1::real(ld1)); } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc index 07b2f924d95..b0183514537 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc @@ -27,8 +27,7 @@ void test01() { bool test __attribute__((unused)) = true; - using namespace std::tr1; - using namespace __gnu_test; + using __gnu_test::check_ret_type; typedef std::complex cmplx_f_type; typedef std::complex cmplx_d_type; @@ -39,57 +38,63 @@ void test01() const double f1 = 1.0f; const double d1 = 1.0; - check_ret_type(arg(i1)); - VERIFY( arg(i1) == arg(double(i1)) ); - VERIFY( arg(i1) == arg(cmplx_d_type(double(i1))) ); + check_ret_type(std::tr1::arg(i1)); + VERIFY( std::tr1::arg(i1) == std::tr1::arg(double(i1)) ); + VERIFY( std::tr1::arg(i1) == std::tr1::arg(cmplx_d_type(double(i1))) ); - check_ret_type(conj(i1)); - VERIFY( conj(i1) == conj(double(i1)) ); - VERIFY( conj(i1) == conj(cmplx_d_type(double(i1))) ); + check_ret_type(std::tr1::conj(i1)); + VERIFY( std::tr1::conj(i1) == std::tr1::conj(double(i1)) ); + VERIFY( std::tr1::conj(i1) == std::tr1::conj(cmplx_d_type(double(i1))) ); - check_ret_type(imag(i1)); - VERIFY( imag(i1) == imag(double(i1)) ); - VERIFY( imag(i1) == imag(cmplx_d_type(double(i1))) ); + check_ret_type(std::tr1::imag(i1)); + VERIFY( std::tr1::imag(i1) == std::tr1::imag(double(i1)) ); + VERIFY( std::tr1::imag(i1) == std::tr1::imag(cmplx_d_type(double(i1))) ); - check_ret_type(norm(i1)); - VERIFY( norm(i1) == norm(double(i1)) ); + check_ret_type(std::tr1::norm(i1)); + VERIFY( std::tr1::norm(i1) == std::tr1::norm(double(i1)) ); // std::norm&) is mathematically equivalent to just // this for a real, but the general algorithm goes through std::abs // and a multiplication. - VERIFY( norm(i1) == double(i1) * double(i1) ); + VERIFY( std::tr1::norm(i1) == double(i1) * double(i1) ); + + // NB: The existing std::polar wins and a cmplx_i_type is returned. + // check_ret_type(std::tr1::polar(i1, i1)); + // VERIFY( std::tr1::polar(i1, i1) + // == std::tr1::polar(double(i1), double(i1)) ); + typedef std::complex cmplx_i_type; + check_ret_type(std::tr1::polar(i1, i1)); - check_ret_type(polar(i1, i1)); - VERIFY( polar(i1, i1) == polar(double(i1), double(i1)) ); // NB: According to the letter of 8.1.9/3 the return type should be a // cmplx_d_type, but the existing std::pow(const complex<>&, int) wins. - check_ret_type(pow(cmplx_f_type(f1, f1), i1)); + // check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), i1)); + check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), i1)); - check_ret_type(pow(cmplx_f_type(f1, f1), u1)); - check_ret_type(pow(cmplx_f_type(f1, f1), l1)); - check_ret_type(pow(cmplx_d_type(d1, d1), i1)); + check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), u1)); + check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), l1)); + check_ret_type(std::tr1::pow(cmplx_d_type(d1, d1), i1)); // See last comment. - // VERIFY( pow(cmplx_d_type(d1, d1), i1) - // == pow(cmplx_d_type(d1, d1), double(i1)) ); - VERIFY( pow(cmplx_d_type(d1, d1), u1) - == pow(cmplx_d_type(d1, d1), double(u1)) ); - VERIFY( pow(cmplx_d_type(d1, d1), l1) - == pow(cmplx_d_type(d1, d1), double(l1)) ); + // VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1) + // == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) ); + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), u1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(u1)) ); + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), l1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(l1)) ); - check_ret_type(pow(i1, cmplx_f_type(f1, f1))); - check_ret_type(pow(u1, cmplx_f_type(f1, f1))); - check_ret_type(pow(l1, cmplx_f_type(f1, f1))); - check_ret_type(pow(i1, cmplx_d_type(d1, d1))); - VERIFY( pow(i1, cmplx_d_type(d1, d1)) - == pow(double(i1), cmplx_d_type(d1, d1)) ); - VERIFY( pow(u1, cmplx_d_type(d1, d1)) - == pow(double(u1), cmplx_d_type(d1, d1)) ); - VERIFY( pow(l1, cmplx_d_type(d1, d1)) - == pow(double(l1), cmplx_d_type(d1, d1)) ); + check_ret_type(std::tr1::pow(i1, cmplx_f_type(f1, f1))); + check_ret_type(std::tr1::pow(u1, cmplx_f_type(f1, f1))); + check_ret_type(std::tr1::pow(l1, cmplx_f_type(f1, f1))); + check_ret_type(std::tr1::pow(i1, cmplx_d_type(d1, d1))); + VERIFY( std::tr1::pow(i1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(i1), cmplx_d_type(d1, d1)) ); + VERIFY( std::tr1::pow(u1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(u1), cmplx_d_type(d1, d1)) ); + VERIFY( std::tr1::pow(l1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(l1), cmplx_d_type(d1, d1)) ); - check_ret_type(real(i1)); - VERIFY( real(i1) == real(double(i1)) ); - VERIFY( real(i1) == real(cmplx_d_type(double(i1))) ); + check_ret_type(std::tr1::real(i1)); + VERIFY( std::tr1::real(i1) == std::tr1::real(double(i1)) ); + VERIFY( std::tr1::real(i1) == std::tr1::real(cmplx_d_type(double(i1))) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/headers.cc b/libstdc++-v3/testsuite/tr1/headers.cc index ad77006a7c2..0650f53efda 100644 --- a/libstdc++-v3/testsuite/tr1/headers.cc +++ b/libstdc++-v3/testsuite/tr1/headers.cc @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include #include +#include #include #include #include