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
This commit is contained in:
Paolo Carlini 2006-02-07 13:14:03 +00:00 committed by Paolo Carlini
parent 88e23c503a
commit 4f0de5dd33
20 changed files with 1159 additions and 33 deletions

View File

@ -1,3 +1,30 @@
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.
2006-02-07 Mark Mitchell <mark@codesourcery.com>
* testsuite/testsuite_tr1.h (test_property): New function.

View File

@ -1181,6 +1181,124 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
<tr1/cstdint> in namespace std::tr1.])
fi
# Check for the existence of <math.h> functions.
AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>])
AC_CACHE_VAL(ac_c99_math_tr1, [
AC_TRY_COMPILE([#include <math.h>],
[acosh(0.0);
acoshf(0.0f);
acoshl(0.0l);
asinh(0.0);
asinhf(0.0f);
asinhl(0.0l);
atanh(0.0);
atanhf(0.0f);
atanhl(0.0l);
cbrt(0.0);
cbrtf(0.0f);
cbrtl(0.0l);
copysign(0.0, 0.0);
copysignf(0.0f, 0.0f);
copysignl(0.0l, 0.0l);
erf(0.0);
erff(0.0f);
erfl(0.0l);
erfc(0.0);
erfcf(0.0f);
erfcl(0.0l);
exp2(0.0);
exp2f(0.0f);
exp2l(0.0l);
expm1(0.0);
expm1f(0.0f);
expm1l(0.0l);
fdim(0.0, 0.0);
fdimf(0.0f, 0.0f);
fdiml(0.0l, 0.0l);
fma(0.0, 0.0, 0.0);
fmaf(0.0f, 0.0f, 0.0f);
fmal(0.0l, 0.0l, 0.0l);
fmax(0.0, 0.0);
fmaxf(0.0f, 0.0f);
fmaxl(0.0l, 0.0l);
fmin(0.0, 0.0);
fminf(0.0f, 0.0f);
fminl(0.0l, 0.0l);
hypot(0.0, 0.0);
hypotf(0.0f, 0.0f);
hypotl(0.0l, 0.0l);
ilogb(0.0);
ilogbf(0.0f);
ilogbl(0.0l);
lgamma(0.0);
lgammaf(0.0f);
lgammal(0.0l);
llrint(0.0);
llrintf(0.0f);
llrintl(0.0l);
llround(0.0);
llroundf(0.0f);
llroundl(0.0l);
log1p(0.0);
log1pf(0.0f);
log1pl(0.0l);
log2(0.0);
log2f(0.0f);
log2l(0.0l);
logb(0.0);
logbf(0.0f);
logbl(0.0l);
lrint(0.0);
lrintf(0.0f);
lrintl(0.0l);
lround(0.0);
lroundf(0.0f);
lroundl(0.0l);
nan(0);
nanf(0);
nanl(0);
nearbyint(0.0);
nearbyintf(0.0f);
nearbyintl(0.0l);
nextafter(0.0, 0.0);
nextafterf(0.0f, 0.0f);
nextafterl(0.0l, 0.0l);
nexttoward(0.0, 0.0);
nexttowardf(0.0f, 0.0f);
nexttowardl(0.0l, 0.0l);
remainder(0.0, 0.0);
remainderf(0.0f, 0.0f);
remainderl(0.0l, 0.0l);
remquo(0.0, 0.0, 0);
remquo(0.0f, 0.0f, 0);
remquo(0.0l, 0.0l, 0);
rint(0.0);
rintf(0.0f);
rintl(0.0l);
round(0.0);
roundf(0.0f);
roundl(0.0l);
scalbln(0.0, 0l);
scalblnf(0.0f, 0l);
scalblnl(0.0l, 0l);
scalbn(0.0, 0);
scalbnf(0.0f, 0);
scalbnl(0.0l, 0);
tgamma(0.0);
tgammaf(0.0f);
tgammal(0.0l);
trunc(0.0);
truncf(0.0f);
truncl(0.0l);
],[ac_c99_math_tr1=yes], [ac_c99_math_tr1=no])
])
AC_MSG_RESULT($ac_c99_math_tr1)
if test x"$ac_c99_math_tr1" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1,
[Define if C99 functions or macros in <math.h> should be imported
in <tr1/cmath> in namespace std::tr1.])
fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make
# sense if the previous check fails, per C99, 7.8/1).
ac_c99_inttypes_tr1=no;

View File

@ -715,6 +715,10 @@
in namespace std. */
#undef _GLIBCXX_USE_C99_MATH
/* Define if C99 functions or macros in <math.h> should be imported in
<tr1/cmath> in namespace std::tr1. */
#undef _GLIBCXX_USE_C99_MATH_TR1
/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
namespace std::tr1. */
#undef _GLIBCXX_USE_C99_STDINT_TR1

170
libstdc++-v3/configure vendored
View File

@ -30610,6 +30610,176 @@ _ACEOF
fi
# Check for the existence of <math.h> functions.
echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <math.h>" >&5
echo $ECHO_N "checking for ISO C99 support to TR1 in <math.h>... $ECHO_C" >&6
if test "${ac_c99_math_tr1+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <math.h>
int
main ()
{
acosh(0.0);
acoshf(0.0f);
acoshl(0.0l);
asinh(0.0);
asinhf(0.0f);
asinhl(0.0l);
atanh(0.0);
atanhf(0.0f);
atanhl(0.0l);
cbrt(0.0);
cbrtf(0.0f);
cbrtl(0.0l);
copysign(0.0, 0.0);
copysignf(0.0f, 0.0f);
copysignl(0.0l, 0.0l);
erf(0.0);
erff(0.0f);
erfl(0.0l);
erfc(0.0);
erfcf(0.0f);
erfcl(0.0l);
exp2(0.0);
exp2f(0.0f);
exp2l(0.0l);
expm1(0.0);
expm1f(0.0f);
expm1l(0.0l);
fdim(0.0, 0.0);
fdimf(0.0f, 0.0f);
fdiml(0.0l, 0.0l);
fma(0.0, 0.0, 0.0);
fmaf(0.0f, 0.0f, 0.0f);
fmal(0.0l, 0.0l, 0.0l);
fmax(0.0, 0.0);
fmaxf(0.0f, 0.0f);
fmaxl(0.0l, 0.0l);
fmin(0.0, 0.0);
fminf(0.0f, 0.0f);
fminl(0.0l, 0.0l);
hypot(0.0, 0.0);
hypotf(0.0f, 0.0f);
hypotl(0.0l, 0.0l);
ilogb(0.0);
ilogbf(0.0f);
ilogbl(0.0l);
lgamma(0.0);
lgammaf(0.0f);
lgammal(0.0l);
llrint(0.0);
llrintf(0.0f);
llrintl(0.0l);
llround(0.0);
llroundf(0.0f);
llroundl(0.0l);
log1p(0.0);
log1pf(0.0f);
log1pl(0.0l);
log2(0.0);
log2f(0.0f);
log2l(0.0l);
logb(0.0);
logbf(0.0f);
logbl(0.0l);
lrint(0.0);
lrintf(0.0f);
lrintl(0.0l);
lround(0.0);
lroundf(0.0f);
lroundl(0.0l);
nan(0);
nanf(0);
nanl(0);
nearbyint(0.0);
nearbyintf(0.0f);
nearbyintl(0.0l);
nextafter(0.0, 0.0);
nextafterf(0.0f, 0.0f);
nextafterl(0.0l, 0.0l);
nexttoward(0.0, 0.0);
nexttowardf(0.0f, 0.0f);
nexttowardl(0.0l, 0.0l);
remainder(0.0, 0.0);
remainderf(0.0f, 0.0f);
remainderl(0.0l, 0.0l);
remquo(0.0, 0.0, 0);
remquo(0.0f, 0.0f, 0);
remquo(0.0l, 0.0l, 0);
rint(0.0);
rintf(0.0f);
rintl(0.0l);
round(0.0);
roundf(0.0f);
roundl(0.0l);
scalbln(0.0, 0l);
scalblnf(0.0f, 0l);
scalblnl(0.0l, 0l);
scalbn(0.0, 0);
scalbnf(0.0f, 0);
scalbnl(0.0l, 0);
tgamma(0.0);
tgammaf(0.0f);
tgammal(0.0l);
trunc(0.0);
truncf(0.0f);
truncl(0.0l);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_c99_math_tr1=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_c99_math_tr1=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_c99_math_tr1" >&5
echo "${ECHO_T}$ac_c99_math_tr1" >&6
if test x"$ac_c99_math_tr1" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_C99_MATH_TR1 1
_ACEOF
fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make
# sense if the previous check fails, per C99, 7.8/1).
ac_c99_inttypes_tr1=no;

View File

@ -1918,7 +1918,7 @@ release.
<td>done</td>
<td></td>
<td></td>
<td></td>
<td>abs, div: issue with _Longlong</td>
</tr>
<tr>
<td>8.11.2</td>
@ -2115,49 +2115,49 @@ release.
<tr>
<td>8.25</td>
<td>Additions to header <code>&lt;cstdlib&gt;</code></td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.25.1</td>
<td>Synopsis</td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.25.2</td>
<td>Definitions</td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.25.3</td>
<td>Function <code>abs</code></td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.25.4</td>
<td>Function <code>div</code></td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.26</td>
<td>Additions to header <code>&lt;stdlib.h&gt;</code></td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
@ -2179,10 +2179,10 @@ release.
<tr>
<td>8.29</td>
<td>Additions to header <code>&lt;ctime&gt;</code></td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
<td>C library responsability</td>
</tr>
<tr>
<td>8.30</td>
@ -2307,7 +2307,7 @@ permitted in any medium, provided this notice is preserved.
<table width="100%" border="0">
<tr>
<td>
<!-- IGNORE DIFF -->Last modified 2006-02-05
<!-- IGNORE DIFF -->Last modified 2006-02-07
</td>
<td align="right" valign="bottom">
<a href="http://validator.w3.org/check/referer">

View File

@ -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 \

View File

@ -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 \

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -36,11 +36,4 @@
#include <tr1/cinttypes>
#if _GLIBCXX_USE_C99_INTTYPES_TR1
using std::tr1::abs;
using std::tr1::div;
#endif
#endif

View File

@ -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

View File

@ -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

View File

@ -41,10 +41,10 @@ void test01()
std::tr1::imaxdiv_t dret;
ret = std::tr1::imaxabs(i);
ret = std::tr1::abs(i);
// ret = std::tr1::abs(i);
dret = std::tr1::imaxdiv(numer, denom);
dret = std::tr1::div(numer, denom);
// dret = std::tr1::div(numer, denom);
ret = std::tr1::strtoimax(s, endptr, base);
uret = std::tr1::strtoumax(s, endptr, base);

View File

@ -0,0 +1,187 @@
// { dg-do compile }
// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
//
// 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 <cmath>
#include <tr1/cmath>
void test01()
{
#if _GLIBCXX_USE_C99_MATH_TR1
double d0 = 0.0;
float f0 = 0.0f;
long double ld0 = 0.0l;
const char* str = "NAN";
int* pquo = 0;
long lex = 0l;
int ex = 0;
double ret;
float fret;
long double ldret;
int iret;
long lret;
long long llret;
ret = acosh(d0);
fret = acoshf(f0);
ldret = acoshl(ld0);
ret = asinh(d0);
fret = asinhf(f0);
ldret = asinhl(ld0);
ret = atanh(d0);
fret = atanhf(f0);
ldret = atanhl(ld0);
ret = cbrt(d0);
fret = cbrtf(f0);
ldret = cbrtl(ld0);
ret = copysign(d0, d0);
fret = copysignf(f0, f0);
ldret = copysignl(ld0, ld0);
ret = erf(d0);
fret = erff(f0);
ldret = erfl(ld0);
ret = erfc(d0);
fret = erfcf(f0);
ldret = erfcl(ld0);
ret = exp2(d0);
fret = exp2f(f0);
ldret = exp2l(ld0);
ret = expm1(d0);
fret = expm1f(f0);
ldret = expm1l(ld0);
ret = fdim(d0, d0);
fret = fdimf(f0, f0);
ldret = fdiml(ld0, ld0);
ret = fma(d0, d0, d0);
fret = fmaf(f0, f0, f0);
ldret = fmal(ld0, ld0, ld0);
ret = fmax(d0, d0);
fret = fmaxf(f0, f0);
ldret = fmaxl(ld0, ld0);
ret = fmin(d0, d0);
fret = fminf(f0, f0);
ldret = fminl(ld0, ld0);
ret = hypot(d0, d0);
fret = hypotf(f0, f0);
ldret = hypotl(ld0, ld0);
iret = ilogb(d0);
iret = ilogbf(f0);
iret = ilogbl(ld0);
ret = lgamma(d0);
fret = lgammaf(f0);
ldret = lgammal(ld0);
llret = llrint(d0);
llret = llrintf(f0);
llret = llrintl(ld0);
llret = llround(d0);
llret = llroundf(f0);
llret = llroundl(ld0);
ret = log1p(d0);
fret = log1pf(f0);
ldret = log1pl(ld0);
ret = log2(d0);
fret = log2f(f0);
ldret = log2l(ld0);
ret = logb(d0);
fret = logbf(f0);
ldret = logbl(ld0);
lret = lrint(d0);
lret = lrintf(f0);
lret = lrintl(ld0);
lret = lround(d0);
lret = lroundf(f0);
lret = lroundl(ld0);
ret = nan(str);
fret = nanf(str);
ldret = nanl(str);
ret = nearbyint(d0);
fret = nearbyintf(f0);
ldret = nearbyintl(ld0);
ret = nextafter(d0, d0);
fret = nextafterf(f0, f0);
ldret = nextafterl(ld0, ld0);
ret = nexttoward(d0, d0);
fret = nexttowardf(f0, f0);
ldret = nexttowardl(ld0, ld0);
ret = remainder(d0, d0);
fret = remainderf(f0, f0);
ldret = remainderl(ld0, ld0);
ret = remquo(d0, d0, pquo);
fret = remquo(f0, f0, pquo);
ldret = remquo(ld0, ld0, pquo);
ret = rint(d0);
fret = rintf(f0);
ldret = rintl(ld0);
ret = round(d0);
fret = roundf(f0);
ldret = roundl(ld0);
ret = scalbln(d0, lex);
fret = scalblnf(f0, lex);
ldret = scalblnl(ld0, lex);
ret = scalbn(d0, ex);
fret = scalbnf(f0, ex);
ldret = scalbnl(ld0, ex);
ret = tgamma(d0);
fret = tgammaf(f0);
ldret = tgammal(ld0);
ret = trunc(d0);
fret = truncf(f0);
ldret = truncl(ld0);
#endif
}

View File

@ -0,0 +1,66 @@
// { dg-do compile }
// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
//
// 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.25 Additions to header <cstdlib>
#include <tr1/cstdlib>
#if _GLIBCXX_HOSTED
void test01()
{
#if _GLIBCXX_USE_C99
long long i = 0;
const char* s = 0;
char** endptr = 0;
int base = 0;
long long ret;
unsigned long long uret;
float fret;
long double ldret;
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
long long numer = 0, denom = 0;
std::tr1::lldiv_t dret;
ret = std::tr1::llabs(i);
dret = std::tr1::lldiv(numer, denom);
#endif
ret = std::tr1::atoll(s);
ret = std::tr1::strtoll(s, endptr, base);
uret = std::tr1::strtoull(s, endptr, base);
fret = std::tr1::strtof(s, endptr);
ldret = std::tr1::strtold(s, endptr);
ret = std::tr1::abs(i);
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
dret = std::tr1::div(numer, denom);
#endif
#endif
}
#endif

View File

@ -0,0 +1,38 @@
// { dg-do compile }
// 2006-02-07 Paolo Carlini <pcarlini@suse.de>
//
// 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.25 Additions to header <cstdlib>
#include <tr1/cstdlib>
#if _GLIBCXX_HOSTED
void test01()
{
#if _GLIBCXX_USE_C99
typedef std::tr1::lldiv_t my_lldiv_t;
#endif
}
#endif

View File

@ -67,15 +67,11 @@ void test01(int dummy, ...)
long double ldret;
ldret = std::tr1::wcstold(nptr2, endptr2);
#ifdef _GLIBCXX_USE_LONG_LONG
const wchar_t* nptr3 = 0;
wchar_t** endptr3 = 0;
int base = 0;
long long llret;
unsigned long long ullret;
llret = std::tr1::wcstoll(nptr3, endptr3, base);
ullret = std::tr1::wcstoull(nptr3, endptr3, base);
#endif
llret = std::tr1::wcstoll(nptr2, endptr2, base);
ullret = std::tr1::wcstoull(nptr2, endptr2, base);
#endif
}

View File

@ -26,10 +26,13 @@
#include <tr1/cfloat>
#include <tr1/cinttypes>
#include <tr1/climits>
#include <tr1/cmath>
#include <tr1/complex>
#include <tr1/cstdarg>
#include <tr1/cstdint>
#include <tr1/cstdio>
#include <tr1/cstdlib>
#include <tr1/ctime>
#include <tr1/ctype.h>
#include <tr1/cwchar>
#include <tr1/cwctype>
@ -39,10 +42,12 @@
#include <tr1/hashtable>
#include <tr1/inttypes.h>
#include <tr1/limits.h>
#include <tr1/math.h>
#include <tr1/memory>
#include <tr1/stdarg.h>
#include <tr1/stdint.h>
#include <tr1/stdio.h>
#include <tr1/stdlib.h>
#include <tr1/tuple>
#include <tr1/type_traits>
#include <tr1/unordered_set>