diff options
author | Paolo Carlini <pcarlini@suse.de> | 2006-02-07 13:14:03 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2006-02-07 13:14:03 +0000 |
commit | 4f0de5dd33ec2f8eb0aa43da72d9cc493478f077 (patch) | |
tree | cc86837e8687d6a0aa23db28adf57f641ea15a85 /libstdc++-v3/include | |
parent | 88e23c503ac776ac63d93451557ac2da3939851b (diff) | |
download | gcc-4f0de5dd33ec2f8eb0aa43da72d9cc493478f077.tar.gz |
cmath: New.
2006-02-07 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cmath: New.
* include/tr1/cstdlib: Likewise.
* include/tr1/ctime: Likewise.
* include/tr1/math.h: Likewise.
* include/tr1/stdlib.h: Likewise.
* include/Makefile.am: Add.
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <math.h> checks.
* testsuite/tr1/8_c_compatibility/cmath/functions.cc: New.
* testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Likewise.
* testsuite/tr1/8_c_compatibility/cstdlib/types.cc: Likewise.
* testsuite/tr1/headers.cc: Update.
* include/tr1/cinttypes: Do not provide abs and div, conflicting
with the above overloads for _Longlong types.
* include/tr1/inttypes.h: Adjust.
* testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Adjust.
* docs/html/ext/tr1.html: Update.
* testsuite/tr1/8_c_compatibility/cwchar/functions.cc: Tweak.
* include/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
From-SVN: r110696
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/Makefile.am | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.in | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/cinttypes | 17 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/cmath | 298 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/cstdlib | 79 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/ctime | 39 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/inttypes.h | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/math.h | 39 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/stdlib.h | 56 |
9 files changed, 530 insertions, 15 deletions
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index b16993d1175..4f124abb03a 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -489,11 +489,14 @@ tr1_headers = \ ${tr1_srcdir}/cfloat \ ${tr1_srcdir}/cinttypes \ ${tr1_srcdir}/climits \ + ${tr1_srcdir}/cmath \ ${tr1_srcdir}/common.h \ ${tr1_srcdir}/complex \ ${tr1_srcdir}/cstdarg \ ${tr1_srcdir}/cstdint \ ${tr1_srcdir}/cstdio \ + ${tr1_srcdir}/cstdlib \ + ${tr1_srcdir}/ctime \ ${tr1_srcdir}/ctype.h \ ${tr1_srcdir}/cwchar \ ${tr1_srcdir}/cwctype \ @@ -504,6 +507,7 @@ tr1_headers = \ ${tr1_srcdir}/hashtable \ ${tr1_srcdir}/inttypes.h \ ${tr1_srcdir}/limits.h \ + ${tr1_srcdir}/math.h \ ${tr1_srcdir}/memory \ ${tr1_srcdir}/mu_iterate.h \ ${tr1_srcdir}/ref_fwd.h \ @@ -512,6 +516,7 @@ tr1_headers = \ ${tr1_srcdir}/stdarg.h \ ${tr1_srcdir}/stdint.h \ ${tr1_srcdir}/stdio.h \ + ${tr1_srcdir}/stdlib.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 bd6c31331f9..d32cc112e3d 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -706,11 +706,14 @@ tr1_headers = \ ${tr1_srcdir}/cfloat \ ${tr1_srcdir}/cinttypes \ ${tr1_srcdir}/climits \ + ${tr1_srcdir}/cmath \ ${tr1_srcdir}/common.h \ ${tr1_srcdir}/complex \ ${tr1_srcdir}/cstdarg \ ${tr1_srcdir}/cstdint \ ${tr1_srcdir}/cstdio \ + ${tr1_srcdir}/cstdlib \ + ${tr1_srcdir}/ctime \ ${tr1_srcdir}/ctype.h \ ${tr1_srcdir}/cwchar \ ${tr1_srcdir}/cwctype \ @@ -721,6 +724,7 @@ tr1_headers = \ ${tr1_srcdir}/hashtable \ ${tr1_srcdir}/inttypes.h \ ${tr1_srcdir}/limits.h \ + ${tr1_srcdir}/math.h \ ${tr1_srcdir}/memory \ ${tr1_srcdir}/mu_iterate.h \ ${tr1_srcdir}/ref_fwd.h \ @@ -729,6 +733,7 @@ tr1_headers = \ ${tr1_srcdir}/stdarg.h \ ${tr1_srcdir}/stdint.h \ ${tr1_srcdir}/stdio.h \ + ${tr1_srcdir}/stdlib.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/type_traits \ diff --git a/libstdc++-v3/include/tr1/cinttypes b/libstdc++-v3/include/tr1/cinttypes index 2e0e9d83a4b..25e5c075e4a 100644 --- a/libstdc++-v3/include/tr1/cinttypes +++ b/libstdc++-v3/include/tr1/cinttypes @@ -56,16 +56,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) // functions using ::imaxabs; - - inline intmax_t - abs(intmax_t __i) - { return imaxabs(__i); } + + // May collide with _Longlong abs(_Longlong), and is not described + // anywhere outside the synopsis. Likely, a defect. + // + // intmax_t abs(intmax_t) using ::imaxdiv; - - inline imaxdiv_t - div(intmax_t __numer, intmax_t __denom) - { return imaxdiv(__numer, __denom); } + + // Likewise, with lldiv_t div(_Longlong, _Longlong). + // + // imaxdiv_t div(intmax_t, intmax_t) using ::strtoimax; using ::strtoumax; diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath new file mode 100644 index 00000000000..ec11b26adc5 --- /dev/null +++ b/libstdc++-v3/include/tr1/cmath @@ -0,0 +1,298 @@ +// TR1 cmath -*- 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_CMATH +#define _TR1_CMATH 1 + +#include <bits/c++config.h> +#include <cmath> + +#if _GLIBCXX_USE_C99_MATH_TR1 + +#undef acosh +#undef acoshf +#undef acoshl +#undef asinh +#undef asinhf +#undef asinhl +#undef atanh +#undef atanhf +#undef atanhl +#undef cbrt +#undef cbrtf +#undef cbrtl +#undef copysign +#undef copysignf +#undef copysignl +#undef erf +#undef erff +#undef erfl +#undef erfc +#undef erfcf +#undef erfcl +#undef exp2 +#undef exp2f +#undef exp2l +#undef expm1 +#undef expm1f +#undef expm1l +#undef fdim +#undef fdimf +#undef fdiml +#undef fma +#undef fmaf +#undef fmal +#undef fmax +#undef fmaxf +#undef fmaxl +#undef fmin +#undef fminf +#undef fminl +#undef hypot +#undef hypotf +#undef hypotl +#undef ilogb +#undef ilogbf +#undef ilogbl +#undef lgamma +#undef lgammaf +#undef lgammal +#undef llrint +#undef llrintf +#undef llrintl +#undef llround +#undef llroundf +#undef llroundl +#undef log1p +#undef log1pf +#undef log1pl +#undef log2 +#undef log2f +#undef log2l +#undef logb +#undef logbf +#undef logbl +#undef lrint +#undef lrintf +#undef lrintl +#undef lround +#undef lroundf +#undef lroundl +#undef nan +#undef nanf +#undef nanl +#undef nearbyint +#undef nearbyintf +#undef nearbyintl +#undef nextafter +#undef nextafterf +#undef nextafterl +#undef nexttoward +#undef nexttowardf +#undef nexttowardl +#undef remainder +#undef remainderf +#undef remainderl +#undef remquo +#undef remquo +#undef remquo +#undef rint +#undef rintf +#undef rintl +#undef round +#undef roundf +#undef roundl +#undef scalbln +#undef scalblnf +#undef scalblnl +#undef scalbn +#undef scalbnf +#undef scalbnl +#undef tgamma +#undef tgammaf +#undef tgammal +#undef trunc +#undef truncf +#undef truncl + +// namespace std::tr1 +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE(tr1) + + using ::acosh; + using ::acoshf; + using ::acoshl; + + using ::asinh; + using ::asinhf; + using ::asinhl; + + using ::atanh; + using ::atanhf; + using ::atanhl; + + using ::cbrt; + using ::cbrtf; + using ::cbrtl; + + using ::copysign; + using ::copysignf; + using ::copysignl; + + using ::erf; + using ::erff; + using ::erfl; + + using ::erfc; + using ::erfcf; + using ::erfcl; + + using ::exp2; + using ::exp2f; + using ::exp2l; + + using ::expm1; + using ::expm1f; + using ::expm1l; + + using ::fdim; + using ::fdimf; + using ::fdiml; + + using ::fma; + using ::fmaf; + using ::fmal; + + using ::fmax; + using ::fmaxf; + using ::fmaxl; + + using ::fmin; + using ::fminf; + using ::fminl; + + using ::hypot; + using ::hypotf; + using ::hypotl; + + using ::ilogb; + using ::ilogbf; + using ::ilogbl; + + using ::lgamma; + using ::lgammaf; + using ::lgammal; + + using ::llrint; + using ::llrintf; + using ::llrintl; + + using ::llround; + using ::llroundf; + using ::llroundl; + + using ::log1p; + using ::log1pf; + using ::log1pl; + + using ::log2; + using ::log2f; + using ::log2l; + + using ::logb; + using ::logbf; + using ::logbl; + + using ::lrint; + using ::lrintf; + using ::lrintl; + + using ::lround; + using ::lroundf; + using ::lroundl; + + using ::nan; + using ::nanf; + using ::nanl; + + using ::nearbyint; + using ::nearbyintf; + using ::nearbyintl; + + using ::nextafter; + using ::nextafterf; + using ::nextafterl; + + using ::nexttoward; + using ::nexttowardf; + using ::nexttowardl; + + using ::remainder; + using ::remainderf; + using ::remainderl; + + using ::remquo; + using ::remquo; + using ::remquo; + + using ::rint; + using ::rintf; + using ::rintl; + + using ::round; + using ::roundf; + using ::roundl; + + using ::scalbln; + using ::scalblnf; + using ::scalblnl; + + using ::scalbn; + using ::scalbnf; + using ::scalbnl; + + using ::tgamma; + using ::tgammaf; + using ::tgammal; + + using ::trunc; + using ::truncf; + using ::truncl; + +_GLIBCXX_END_NAMESPACE +} + +#endif + +#endif diff --git a/libstdc++-v3/include/tr1/cstdlib b/libstdc++-v3/include/tr1/cstdlib new file mode 100644 index 00000000000..49ccb959cbd --- /dev/null +++ b/libstdc++-v3/include/tr1/cstdlib @@ -0,0 +1,79 @@ +// TR1 cstdlib -*- 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_CSTDLIB +#define _TR1_CSTDLIB 1 + +#include <bits/c++config.h> + +#if _GLIBCXX_HOSTED + +#include <cstdlib> + +// namespace std::tr1 +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE(tr1) + +#if _GLIBCXX_USE_C99 + +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + // types + using std::lldiv_t; + + // functions + using std::llabs; + using std::lldiv; +#endif + + using std::atoll; + using std::strtoll; + using std::strtoull; + + using std::strtof; + using std::strtold; + + // overloads + using std::abs; +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using std::div; +#endif + +#endif + +_GLIBCXX_END_NAMESPACE +} + +#endif + +#endif diff --git a/libstdc++-v3/include/tr1/ctime b/libstdc++-v3/include/tr1/ctime new file mode 100644 index 00000000000..420bfdb301a --- /dev/null +++ b/libstdc++-v3/include/tr1/ctime @@ -0,0 +1,39 @@ +// TR1 ctime -*- 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_CTIME +#define _TR1_CTIME 1 + +#include <ctime> + +#endif diff --git a/libstdc++-v3/include/tr1/inttypes.h b/libstdc++-v3/include/tr1/inttypes.h index a750daf4eb1..31901cc92e9 100644 --- a/libstdc++-v3/include/tr1/inttypes.h +++ b/libstdc++-v3/include/tr1/inttypes.h @@ -36,11 +36,4 @@ #include <tr1/cinttypes> -#if _GLIBCXX_USE_C99_INTTYPES_TR1 - -using std::tr1::abs; -using std::tr1::div; - -#endif - #endif diff --git a/libstdc++-v3/include/tr1/math.h b/libstdc++-v3/include/tr1/math.h new file mode 100644 index 00000000000..a0dd24ba4ac --- /dev/null +++ b/libstdc++-v3/include/tr1/math.h @@ -0,0 +1,39 @@ +// TR1 math.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_MATH_H +#define _TR1_MATH_H 1 + +#include <tr1/cmath> + +#endif diff --git a/libstdc++-v3/include/tr1/stdlib.h b/libstdc++-v3/include/tr1/stdlib.h new file mode 100644 index 00000000000..f58e4f00019 --- /dev/null +++ b/libstdc++-v3/include/tr1/stdlib.h @@ -0,0 +1,56 @@ +// TR1 stdlib.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_STDLIB_H +#define _TR1_STDLIB_H 1 + +#include <tr1/cstdlib> + +#if _GLIBCXX_HOSTED + +#if _GLIBCXX_USE_C99 + +using std::tr1::atoll; +using std::tr1::strtoll; +using std::tr1::strtoull; + +using std::tr1::abs; +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC +using std::tr1::div; +#endif + +#endif + +#endif + +#endif |