cinttypes: New.

2006-01-30  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/cinttypes: New.
	* include/Makefile.am: Add.
	* testsuite/tr1/8_c_compatibility/cinttypes/functions: New.	
	* testsuite/tr1/8_c_compatibility/cinttypes/types: Likewise.
	* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <inttypes.h> checks.
	* docs/html/ext/tr1.html: Update.
	* include/Makefile.in: Regenerate.
	* config.h.in: Likewise.
	* configure: Likewise.

	* testsuite/tr1/8_c_compatibility/cfenv/functions.cc: Cosmetic tweak.
	* testsuite/tr1/8_c_compatibility/cfenv/types.cc: Likewise.

	* testsuite/tr1/8_c_compatibility/cstdint/types.cc: Fix, check in
	std::tr1.

From-SVN: r110397
This commit is contained in:
Paolo Carlini 2006-01-30 14:17:49 +00:00 committed by Paolo Carlini
parent eb73a69a15
commit 52a64bd38e
13 changed files with 342 additions and 46 deletions

View file

@ -1,3 +1,21 @@
2006-01-30 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cinttypes: New.
* include/Makefile.am: Add.
* testsuite/tr1/8_c_compatibility/cinttypes/functions: New.
* testsuite/tr1/8_c_compatibility/cinttypes/types: Likewise.
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <inttypes.h> checks.
* docs/html/ext/tr1.html: Update.
* include/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* testsuite/tr1/8_c_compatibility/cfenv/functions.cc: Cosmetic tweak.
* testsuite/tr1/8_c_compatibility/cfenv/types.cc: Likewise.
* testsuite/tr1/8_c_compatibility/cstdint/types.cc: Fix, check in
std::tr1.
2006-01-29 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cstdint: New.

View file

@ -1181,6 +1181,29 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
<tr1/cstdint> in namespace std::tr1.])
fi
# Check for the existence of <inttypes.h> functions.
AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
AC_CACHE_VAL(ac_c99_inttypes_tr1, [
AC_TRY_COMPILE([#include <inttypes.h>],
[intmax_t i, numer, denom, base;
const char* s;
char** endptr;
intmax_t ret;
uintmax_t uret;
imaxdiv_t dret;
ret = imaxabs(i);
dret = imaxdiv(numer, denom);
ret = strtoimax(s, endptr, base);
uret = strtoumax(s, endptr, base);
],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
])
AC_MSG_RESULT($ac_c99_inttypes_tr1)
if test x"$ac_c99_inttypes_tr1" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
[Define if C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1.])
fi
AC_LANG_RESTORE
])

View file

@ -707,6 +707,10 @@
namespace std::tr1. */
#undef _GLIBCXX_USE_C99_FENV_TR1
/* Define if C99 functions in <inttypes.h> should be imported in
<tr1/cinttypes> in namespace std::tr1. */
#undef _GLIBCXX_USE_C99_INTTYPES_TR1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std. */
#undef _GLIBCXX_USE_C99_MATH

View file

@ -30610,6 +30610,81 @@ _ACEOF
fi
# Check for the existence of <inttypes.h> functions.
echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <inttypes.h>" >&5
echo $ECHO_N "checking for ISO C99 support to TR1 in <inttypes.h>... $ECHO_C" >&6
if test "${ac_c99_inttypes_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 <inttypes.h>
int
main ()
{
intmax_t i, numer, denom, base;
const char* s;
char** endptr;
intmax_t ret;
uintmax_t uret;
imaxdiv_t dret;
ret = imaxabs(i);
dret = imaxdiv(numer, denom);
ret = strtoimax(s, endptr, base);
uret = strtoumax(s, endptr, base);
;
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_inttypes_tr1=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_c99_inttypes_tr1=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_c99_inttypes_tr1" >&5
echo "${ECHO_T}$ac_c99_inttypes_tr1" >&6
if test x"$ac_c99_inttypes_tr1" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_C99_INTTYPES_TR1 1
_ACEOF
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'

View file

@ -1907,25 +1907,25 @@ release.
<tr>
<td>8.11</td>
<td>Header <code>&lt;cinttypes&gt;</code></td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.11.1</td>
<td>Synopsis</td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>
<td>8.11.2</td>
<td>Definitions</td>
<td>done</td>
<td></td>
<td></td>
<td>missing</td>
<td></td>
</tr>
<tr>

View file

@ -486,6 +486,7 @@ tr1_headers = \
${tr1_srcdir}/boost_shared_ptr.h \
${tr1_srcdir}/cctype \
${tr1_srcdir}/cfenv \
${tr1_srcdir}/cinttypes \
${tr1_srcdir}/common.h \
${tr1_srcdir}/complex \
${tr1_srcdir}/cstdint \

View file

@ -703,6 +703,7 @@ tr1_headers = \
${tr1_srcdir}/boost_shared_ptr.h \
${tr1_srcdir}/cctype \
${tr1_srcdir}/cfenv \
${tr1_srcdir}/cinttypes \
${tr1_srcdir}/common.h \
${tr1_srcdir}/complex \
${tr1_srcdir}/cstdint \

View file

@ -0,0 +1,83 @@
// TR1 cinttypes -*- 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_CINTTYPES
#define _TR1_CINTTYPES 1
#include <bits/c++config.h>
#include <tr1/cstdint>
#if _GLIBCXX_HAVE_INTTYPES_H
// For 8.11.1/1 (see C99, Note 184)
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#endif
#if _GLIBCXX_USE_C99_INTTYPES_TR1
// namespace std::tr1
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(tr1)
// types
using ::imaxdiv_t;
// functions
using ::imaxabs;
inline intmax_t
abs(intmax_t __i)
{ return imaxabs(__i); }
using ::imaxdiv;
inline imaxdiv_t
div(intmax_t __numer, intmax_t __denom)
{ return imaxdiv(__numer, __denom); }
using ::strtoimax;
using ::strtoumax;
#ifdef _GLIBCXX_USE_WCHAR_T
using ::wcstoimax;
using ::wcstoumax;
#endif
_GLIBCXX_END_NAMESPACE
}
#endif
#endif

View file

@ -32,21 +32,21 @@ void test01()
std::tr1::fexcept_t* pflag = 0;
std::tr1::fenv_t* penv = 0;
int r;
int ret;
r = std::tr1::feclearexcept(except);
r = std::tr1::fegetexceptflag(pflag, except);
r = std::tr1::feraiseexcept(except);
r = std::tr1::fesetexceptflag(pflag, except);
r = std::tr1::fetestexcept(except);
ret = std::tr1::feclearexcept(except);
ret = std::tr1::fegetexceptflag(pflag, except);
ret = std::tr1::feraiseexcept(except);
ret = std::tr1::fesetexceptflag(pflag, except);
ret = std::tr1::fetestexcept(except);
r = std::tr1::fegetround();
r = std::tr1::fesetround(mode);
ret = std::tr1::fegetround();
ret = std::tr1::fesetround(mode);
r = std::tr1::fegetenv(penv);
r = std::tr1::feholdexcept(penv);
r = std::tr1::fesetenv(penv);
r = std::tr1::feupdateenv(penv);
ret = std::tr1::fegetenv(penv);
ret = std::tr1::feholdexcept(penv);
ret = std::tr1::fesetenv(penv);
ret = std::tr1::feupdateenv(penv);
#endif
}

View file

@ -28,9 +28,8 @@ void test01()
{
#if _GLIBCXX_USE_C99_FENV_TR1
// Check for required typedefs
typedef std::tr1::fenv_t my_fenv_t;
typedef std::tr1::fexcept_t my_fexcept_t;
typedef std::tr1::fenv_t my_fenv_t;
typedef std::tr1::fexcept_t my_fexcept_t;
#endif
}

View file

@ -0,0 +1,58 @@
// { dg-do compile }
// 2006-01-30 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.11 Header <cinttypes>
#include <tr1/cinttypes>
void test01()
{
#if _GLIBCXX_USE_C99_INTTYPES_TR1
std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
const char* s = 0;
char** endptr = 0;
#ifdef _GLIBCXX_USE_WCHAR_T
const wchar_t* ws = 0;
wchar_t** wendptr = 0;
#endif
std::tr1::intmax_t ret;
std::tr1::uintmax_t uret;
std::tr1::imaxdiv_t dret;
ret = std::tr1::imaxabs(i);
ret = std::tr1::abs(i);
dret = std::tr1::imaxdiv(numer, denom);
dret = std::tr1::div(numer, denom);
ret = std::tr1::strtoimax(s, endptr, base);
uret = std::tr1::strtoumax(s, endptr, base);
#ifdef _GLIBCXX_USE_WCHAR_T
ret = std::tr1::wcstoimax(ws, wendptr, base);
uret = std::tr1::wcstoumax(ws, wendptr, base);
#endif
#endif
}

View file

@ -0,0 +1,34 @@
// { dg-do compile }
// 2006-01-30 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.11 Header <cinttypes>
#include <tr1/cinttypes>
void test01()
{
#if _GLIBCXX_USE_C99_INTTYPES_TR1
typedef std::tr1::imaxdiv_t my_imaxdiv_t;
#endif
}

View file

@ -28,34 +28,34 @@ void test01()
{
#if _GLIBCXX_USE_C99_STDINT_TR1
typedef int8_t my_int8_t;
typedef int16_t my_int16_t;
typedef int32_t my_int32_t;
typedef int64_t my_int64_t;
typedef int_fast8_t my_int_fast8_t;
typedef int_fast16_t my_int_fast16_t;
typedef int_fast32_t my_int_fast32_t;
typedef int_fast64_t my_int_fast64_t;
typedef int_least8_t my_int_least8_t;
typedef int_least16_t my_int_least16_t;
typedef int_least32_t my_int_least32_t;
typedef int_least64_t my_int_least64_t;
typedef intmax_t my_intmax_t;
typedef intptr_t my_intptr_t;
typedef uint8_t my_uint8_t;
typedef uint16_t my_uint16_t;
typedef uint32_t my_uint32_t;
typedef uint64_t my_uint64_t;
typedef uint_fast8_t my_uint_fast8_t;
typedef uint_fast16_t my_uint_fast16_t;
typedef uint_fast32_t my_uint_fast32_t;
typedef uint_fast64_t my_uint_fast64_t;
typedef uint_least8_t my_uint_least8_t;
typedef uint_least16_t my_uint_least16_t;
typedef uint_least32_t my_uint_least32_t;
typedef uint_least64_t my_uint_least64_t;
typedef uintmax_t my_uintmax_t;
typedef uintptr_t my_uintptr_t;
typedef std::tr1::int8_t my_int8_t;
typedef std::tr1::int16_t my_int16_t;
typedef std::tr1::int32_t my_int32_t;
typedef std::tr1::int64_t my_int64_t;
typedef std::tr1::int_fast8_t my_int_fast8_t;
typedef std::tr1::int_fast16_t my_int_fast16_t;
typedef std::tr1::int_fast32_t my_int_fast32_t;
typedef std::tr1::int_fast64_t my_int_fast64_t;
typedef std::tr1::int_least8_t my_int_least8_t;
typedef std::tr1::int_least16_t my_int_least16_t;
typedef std::tr1::int_least32_t my_int_least32_t;
typedef std::tr1::int_least64_t my_int_least64_t;
typedef std::tr1::intmax_t my_intmax_t;
typedef std::tr1::intptr_t my_intptr_t;
typedef std::tr1::uint8_t my_uint8_t;
typedef std::tr1::uint16_t my_uint16_t;
typedef std::tr1::uint32_t my_uint32_t;
typedef std::tr1::uint64_t my_uint64_t;
typedef std::tr1::uint_fast8_t my_uint_fast8_t;
typedef std::tr1::uint_fast16_t my_uint_fast16_t;
typedef std::tr1::uint_fast32_t my_uint_fast32_t;
typedef std::tr1::uint_fast64_t my_uint_fast64_t;
typedef std::tr1::uint_least8_t my_uint_least8_t;
typedef std::tr1::uint_least16_t my_uint_least16_t;
typedef std::tr1::uint_least32_t my_uint_least32_t;
typedef std::tr1::uint_least64_t my_uint_least64_t;
typedef std::tr1::uintmax_t my_uintmax_t;
typedef std::tr1::uintptr_t my_uintptr_t;
#endif
}