From 14dd354cf6873325c077dc151e1bb952c4497d18 Mon Sep 17 00:00:00 2001
From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sun, 29 Jan 2006 19:02:31 +0000
Subject: [PATCH] 2006-01-29  Paolo Carlini  <pcarlini@suse.de>

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

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


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110378 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libstdc++-v3/ChangeLog                        | 13 +++
 libstdc++-v3/acinclude.m4                     | 41 ++++++++
 libstdc++-v3/config.h.in                      |  4 +
 libstdc++-v3/configure                        | 93 ++++++++++++++++++
 libstdc++-v3/docs/html/ext/tr1.html           |  6 +-
 libstdc++-v3/include/Makefile.am              |  1 +
 libstdc++-v3/include/Makefile.in              |  1 +
 libstdc++-v3/include/tr1/cstdint              | 94 +++++++++++++++++++
 .../tr1/8_c_compatibility/cfenv/types.cc      |  4 +-
 .../tr1/8_c_compatibility/cstdint/types.cc    | 61 ++++++++++++
 10 files changed, 313 insertions(+), 5 deletions(-)
 create mode 100644 libstdc++-v3/include/tr1/cstdint
 create mode 100644 libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types.cc

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 31e008f48922..498fd16c7da1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,16 @@
+2006-01-29  Paolo Carlini  <pcarlini@suse.de>
+
+	* include/tr1/cstdint: New.
+	* include/Makefile.am: Add.
+	* testsuite/tr1/8_c_compatibility/cstdint/types: New.
+	* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <stdint.h> checks.
+	* docs/html/ext/tr1.html: Update.
+	* include/Makefile.in: Regenerate.
+	* config.h.in: Likewise.
+	* configure: Likewise.
+
+	* testsuite/tr1/8_c_compatibility/cfenv/types.cc: Cosmetic tweak.
+
 2006-01-29  Paolo Carlini  <pcarlini@suse.de>
 
 	PR libstdc++/26006
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 881186dbe004..d76dcebbeb29 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1140,6 +1140,47 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
 	      <tr1/cfenv> in namespace std::tr1.])
   fi
 
+  # Check for the existence of <stdint.h> types.
+  AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
+  AC_CACHE_VAL(ac_c99_stdint_tr1, [
+  AC_TRY_COMPILE([#include <stdint.h>],
+	         [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;
+		 ],[ac_c99_stdint_tr1=yes], [ac_c99_stdint_tr1=no])
+  ])
+  AC_MSG_RESULT($ac_c99_stdint_tr1)
+  if test x"$ac_c99_stdint_tr1" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
+              [Define if C99 types in <stdint.h> should be imported in
+	      <tr1/cstdint> in namespace std::tr1.])
+  fi
+
   AC_LANG_RESTORE
 ])
 
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 2184c2d1bd12..15228d27be81 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -711,6 +711,10 @@
    in namespace std. */
 #undef _GLIBCXX_USE_C99_MATH
 
+/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in
+   namespace std::tr1. */
+#undef _GLIBCXX_USE_C99_STDINT_TR1
+
 /* Define if iconv and related functions exist and are usable. */
 #undef _GLIBCXX_USE_ICONV
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 9f601bc4f994..4c80aad98cb9 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -30517,6 +30517,99 @@ _ACEOF
 
   fi
 
+  # Check for the existence of <stdint.h> types.
+  echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <stdint.h>" >&5
+echo $ECHO_N "checking for ISO C99 support to TR1 in <stdint.h>... $ECHO_C" >&6
+  if test "${ac_c99_stdint_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 <stdint.h>
+int
+main ()
+{
+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;
+
+  ;
+  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_stdint_tr1=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_c99_stdint_tr1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_c99_stdint_tr1" >&5
+echo "${ECHO_T}$ac_c99_stdint_tr1" >&6
+  if test x"$ac_c99_stdint_tr1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_C99_STDINT_TR1 1
+_ACEOF
+
+  fi
+
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/libstdc++-v3/docs/html/ext/tr1.html b/libstdc++-v3/docs/html/ext/tr1.html
index 0eeb8928bd57..51a4843c162d 100644
--- a/libstdc++-v3/docs/html/ext/tr1.html
+++ b/libstdc++-v3/docs/html/ext/tr1.html
@@ -2043,25 +2043,25 @@ release.
     <tr>
       <td>8.22</td>
       <td>The header <code>&lt;cstdint&gt;</code></td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
       <td>8.22.1</td>
       <td>Synopsis</td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
       <td>8.22.2</td>
       <td>Definitions</td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 2766df628aeb..bbed68913ba0 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -488,6 +488,7 @@ tr1_headers = \
 	${tr1_srcdir}/cfenv \
 	${tr1_srcdir}/common.h \
 	${tr1_srcdir}/complex \
+	${tr1_srcdir}/cstdint \
 	${tr1_srcdir}/functional \
 	${tr1_srcdir}/functional_iterate.h \
 	${tr1_srcdir}/hashtable \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index b76fec729daa..703df7cfe97e 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -705,6 +705,7 @@ tr1_headers = \
 	${tr1_srcdir}/cfenv \
 	${tr1_srcdir}/common.h \
 	${tr1_srcdir}/complex \
+	${tr1_srcdir}/cstdint \
 	${tr1_srcdir}/functional \
 	${tr1_srcdir}/functional_iterate.h \
 	${tr1_srcdir}/hashtable \
diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint
new file mode 100644
index 000000000000..37a1550a5a2e
--- /dev/null
+++ b/libstdc++-v3/include/tr1/cstdint
@@ -0,0 +1,94 @@
+// TR1 cstdint -*- 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_CSTDINT
+#define _TR1_CSTDINT 1
+
+#include <bits/c++config.h>
+
+#if _GLIBCXX_HAVE_STDINT_H
+// For 8.22.1/1 (see C99, Notes 219, 220, 222) 
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+#include <stdint.h>
+#endif
+
+#if _GLIBCXX_USE_C99_STDINT_TR1
+
+// namespace std::tr1
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE(tr1)
+
+  using ::int8_t;
+  using ::int16_t;
+  using ::int32_t;
+  using ::int64_t;
+
+  using ::int_fast8_t;
+  using ::int_fast16_t;
+  using ::int_fast32_t;
+  using ::int_fast64_t;
+
+  using ::int_least8_t;
+  using ::int_least16_t;
+  using ::int_least32_t;
+  using ::int_least64_t;
+
+  using ::intmax_t;
+  using ::intptr_t;
+  
+  using ::uint8_t;
+  using ::uint16_t;
+  using ::uint32_t;
+  using ::uint64_t;
+
+  using ::uint_fast8_t;
+  using ::uint_fast16_t;
+  using ::uint_fast32_t;
+  using ::uint_fast64_t;
+
+  using ::uint_least8_t;
+  using ::uint_least16_t;
+  using ::uint_least32_t;
+  using ::uint_least64_t;
+
+  using ::uintmax_t;
+  using ::uintptr_t;
+
+_GLIBCXX_END_NAMESPACE
+}
+
+#endif
+
+#endif
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc
index 66186cdea28e..db90b33f13e0 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc
@@ -29,8 +29,8 @@ void test01()
 #if _GLIBCXX_USE_C99_FENV_TR1
 
   // Check for required typedefs
-  typedef std::tr1::fenv_t    fenv_t_type;
-  typedef std::tr1::fexcept_t fexcept_t_type;
+  typedef std::tr1::fenv_t    my_fenv_t;
+  typedef std::tr1::fexcept_t my_fexcept_t;
   
 #endif
 }
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types.cc
new file mode 100644
index 000000000000..55ce195dbb56
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdint/types.cc
@@ -0,0 +1,61 @@
+// { dg-do compile }
+
+// 2006-01-29  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.22 Header <cstdint>
+
+#include <tr1/cstdint>
+
+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;
+  
+#endif
+}
-- 
GitLab