OSDN Git Service

2007-08-23 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Aug 2007 16:16:41 +0000 (16:16 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 23 Aug 2007 16:16:41 +0000 (16:16 +0000)
* include/std/system_error: New file.
* src/system_error.cc: New file.
* src/Makefile.am (sources): Add.
* src/Makefile.in: Regenerate.
* include/Makefile.am (std_headers): Add system_error.
* include/Makefile.in: Regenerate.
* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): New.
* configure.ac: Call it.
* config.h.in: Regenerate.
* include/bits/functional_hash.h: Add hash<error_code>.
  * include/std/ostream: Add inserters for error_code.

* docs/doxygen/user.cfg.in: Add system_error.

* config/abi/pre/gnu.ver(GLIBCXX_3.4.10): Add new symbols.

* testsuite/19_diagnostics/error_code: New.
* testsuite/19_diagnostics/error_code/cons: Same.
* testsuite/19_diagnostics/error_code/cons/1.cc: Same.
* testsuite/19_diagnostics/error_code/operators: Same.
* testsuite/19_diagnostics/error_code/operators/bool.cc: Same.
* testsuite/19_diagnostics/error_code/operators/bool_neg.cc: Same.
* testsuite/19_diagnostics/error_code/operators/equal.cc: Same.
* testsuite/19_diagnostics/error_code/operators/not_equal.cc: Same.
* testsuite/19_diagnostics/error_category: Same.
* testsuite/19_diagnostics/error_category/cons: Same.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Same.
* testsuite/19_diagnostics/error_category/cons/default.cc: Same.
* testsuite/19_diagnostics/error_category/operators: Same.
* testsuite/19_diagnostics/error_category/operators/equal.cc: Same.
* testsuite/19_diagnostics/error_category/operators/not_equal.cc: Same.
* testsuite/19_diagnostics/headers/system_error: Same.
* testsuite/19_diagnostics/headers/system_error/
types_std_c++0x.cc: Same.
* testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc: Same.
* testsuite/19_diagnostics/system_error: Same.
* testsuite/19_diagnostics/system_error/
cons_virtual_derivation.cc: Same.
* testsuite/19_diagnostics/system_error/cons-1.cc: Same.
* testsuite/19_diagnostics/system_error/what-1.cc: Same.
* testsuite/19_diagnostics/system_error/what-2.cc: Same.
* testsuite/19_diagnostics/system_error/what-big.cc: Same.
* testsuite/19_diagnostics/system_error/what-3.cc: Same.
* testsuite/19_diagnostics/system_error/what-4.cc: Same.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
error_code.cc: Same.
* testsuite/27_io/basic_ostream/inserters_other/char/
error_code.cc: Same.
* testsuite/tr1/6_containers/hash/operators: New.
* testsuite/tr1/6_containers/hash/operators/size_t.cc: Same.

* testsuite/23_containers/hash: Move...
* testsuite/20_util/hash: ... here.
* testsuite/20_util/hash/operators: New.
* testsuite/20_util/hash/operators/size_t.cc: New.

* testsuite/20_util/function_objects/bad_function_call: Move...
* testsuite/20_util/bad_function_call: ...here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127744 138bc75d-0d04-0410-961f-82ee72b054a4

39 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/configure
libstdc++-v3/configure.ac
libstdc++-v3/docs/doxygen/user.cfg.in
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/functional_hash.h
libstdc++-v3/include/std/ostream
libstdc++-v3/include/std/system_error [new file with mode: 0644]
libstdc++-v3/src/Makefile.am
libstdc++-v3/src/Makefile.in
libstdc++-v3/src/system_error.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc [moved from libstdc++-v3/testsuite/23_containers/hash/requirements/explicit_instantiation.cc with 69% similarity]
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc [moved from libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc with 100% similarity]
libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc [new file with mode: 0644]

index 144ac47..148f2ed 100644 (file)
@@ -1,3 +1,64 @@
+2007-08-23  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * include/std/system_error: New file.
+       * src/system_error.cc: New file.
+       * src/Makefile.am (sources): Add.
+       * src/Makefile.in: Regenerate.  
+       * include/Makefile.am (std_headers): Add system_error.
+       * include/Makefile.in: Regenerate.
+       * acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): New.
+       * configure.ac: Call it.
+       * config.h.in: Regenerate.
+       * include/bits/functional_hash.h: Add hash<error_code>.
+       * include/std/ostream: Add inserters for error_code.
+       
+       * docs/doxygen/user.cfg.in: Add system_error.
+
+       * config/abi/pre/gnu.ver(GLIBCXX_3.4.10): Add new symbols.
+
+       * testsuite/19_diagnostics/error_code: New.
+       * testsuite/19_diagnostics/error_code/cons: Same.
+       * testsuite/19_diagnostics/error_code/cons/1.cc: Same.
+       * testsuite/19_diagnostics/error_code/operators: Same.
+       * testsuite/19_diagnostics/error_code/operators/bool.cc: Same.
+       * testsuite/19_diagnostics/error_code/operators/bool_neg.cc: Same.
+       * testsuite/19_diagnostics/error_code/operators/equal.cc: Same.
+       * testsuite/19_diagnostics/error_code/operators/not_equal.cc: Same.
+       * testsuite/19_diagnostics/error_category: Same.
+       * testsuite/19_diagnostics/error_category/cons: Same.
+       * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Same.
+       * testsuite/19_diagnostics/error_category/cons/default.cc: Same.
+       * testsuite/19_diagnostics/error_category/operators: Same.
+       * testsuite/19_diagnostics/error_category/operators/equal.cc: Same.
+       * testsuite/19_diagnostics/error_category/operators/not_equal.cc: Same.
+       * testsuite/19_diagnostics/headers/system_error: Same.
+       * testsuite/19_diagnostics/headers/system_error/
+       types_std_c++0x.cc: Same.
+       * testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc: Same.
+       * testsuite/19_diagnostics/system_error: Same.
+       * testsuite/19_diagnostics/system_error/
+       cons_virtual_derivation.cc: Same.
+       * testsuite/19_diagnostics/system_error/cons-1.cc: Same.
+       * testsuite/19_diagnostics/system_error/what-1.cc: Same.
+       * testsuite/19_diagnostics/system_error/what-2.cc: Same.
+       * testsuite/19_diagnostics/system_error/what-big.cc: Same.
+       * testsuite/19_diagnostics/system_error/what-3.cc: Same.
+       * testsuite/19_diagnostics/system_error/what-4.cc: Same.
+       * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+       error_code.cc: Same.
+       * testsuite/27_io/basic_ostream/inserters_other/char/
+       error_code.cc: Same.
+       * testsuite/tr1/6_containers/hash/operators: New.
+       * testsuite/tr1/6_containers/hash/operators/size_t.cc: Same.
+       
+       * testsuite/23_containers/hash: Move...
+       * testsuite/20_util/hash: ... here.
+       * testsuite/20_util/hash/operators: New.
+       * testsuite/20_util/hash/operators/size_t.cc: New.
+
+       * testsuite/20_util/function_objects/bad_function_call: Move...
+       * testsuite/20_util/bad_function_call: ...here.
+       
 2007-08-21  Benjamin Kosnik  <bkoz@montsouris.artheist.org>
 
        * include/Makefile.am (install-data-local): Remove pch-install rules.
index 4b3aaa5..012d363 100644 (file)
@@ -1258,6 +1258,42 @@ AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
 ])
 
 dnl
+dnl Check whether macros, etc are present for <system_error>
+dnl
+AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
+
+  AC_MSG_CHECKING([for EOWNERDEAD])
+  AC_CACHE_VAL(ac_system_error1, [
+  AC_TRY_COMPILE([#include <errno.h>], [ int i = EOWNERDEAD; ],
+             [ac_system_error1=yes], [ac_system_error1=no])
+  ])
+  AC_MSG_RESULT($ac_system_error1)
+  if test x"$ac_system_error1" = x"yes"; then
+    AC_DEFINE(HAVE_EOWNERDEAD, 1, [Define if EOWNERDEAD exists.])
+  fi
+
+  AC_MSG_CHECKING([for ENOTRECOVERABLE])
+  AC_CACHE_VAL(ac_system_error2, [
+  AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOTRECOVERABLE; ],
+             [ac_system_error2=yes], [ac_system_error2=no])
+  ])
+  AC_MSG_RESULT($ac_system_error2)
+  if test x"$ac_system_error2" = x"yes"; then
+    AC_DEFINE(HAVE_ENOTRECOVERABLE, 1, [Define if ENOTRECOVERABLE exists.])
+  fi
+
+  AC_MSG_CHECKING([for sys_nerr])
+  AC_CACHE_VAL(ac_system_error3, [
+  AC_TRY_COMPILE([#include <errno.h> ], [ int i = sys_nerr; ],
+             [ac_system_error3=yes], [ac_system_error3=no])
+  ])
+  AC_MSG_RESULT($ac_system_error3)
+  if test x"$ac_system_error3" = x"yes"; then
+    AC_DEFINE(HAVE_SYS_NERR, 1, [Define if sys_nerr exists.])
+  fi
+])
+
+dnl
 dnl Check for what type of C headers to use.
 dnl
 dnl --enable-cheaders= [does stuff].
index 30a03cc..0efa091 100644 (file)
 /* Define to 1 if you have the <endian.h> header file. */
 #undef HAVE_ENDIAN_H
 
+/* Define if ENOTRECOVERABLE exists. */
+#undef HAVE_ENOTRECOVERABLE
+
+/* Define if EOWNERDEAD exists. */
+#undef HAVE_EOWNERDEAD
+
 /* Define to 1 if you have the `expf' function. */
 #undef HAVE_EXPF
 
 /* Define to 1 if you have the <sys/machine.h> header file. */
 #undef HAVE_SYS_MACHINE_H
 
+/* Define if sys_nerr exists. */
+#undef HAVE_SYS_NERR
+
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 
index a7f378d..059d20a 100644 (file)
@@ -447,7 +447,14 @@ GLIBCXX_3.4 {
     _ZTVNSt6locale5facetE;
     _ZTVS[a-z];
     _ZTVSt[0-9][A-Za-z]*;
-    _ZTVSt[0-9][0-9][A-Za-z]*;
+#   _ZTVSt[0-9][0-9][A-Za-z]*;
+    _ZTVSt[0-9][0-9][A-Z]*;
+    _ZTVSt[0-9][0-9][a-d]*;
+    _ZTVSt[0-9][0-9][f-r]*;
+    _ZTVSt[0-9][0-9][t-z]*;
+    _ZTVSt[0-9][0-9]e[^r]*;
+    _ZTVSt[0-9][0-9]s[^y]*;
+
     _ZTVSt11__timepunctI[cw]E;
     _ZTVSt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
     _ZTVSt21__ctype_abstract_baseI[cw]E;
@@ -459,14 +466,23 @@ GLIBCXX_3.4 {
 
     # typeinfo structure
     _ZTIS[a-z];
-    _ZTINSt8ios_base7failureE;
-    _ZTINSt6locale5facetE;
     _ZTISt[0-9][A-Za-z]*;
-    _ZTISt[0-9][0-9][A-Za-z]*;
+#   _ZTISt[0-9][0-9][A-Za-z]*;
+    _ZTISt[0-9][0-9][A-Z]*;
+    _ZTISt[0-9][0-9][a-d]*;
+    _ZTISt[0-9][0-9][f-r]*;
+    _ZTISt[0-9][0-9][t-z]*;
+    _ZTISt[0-9][0-9]e[^r]*;
+    _ZTISt[0-9][0-9]s[^y]*;
     _ZTISt11__timepunctI[cw]E;
     _ZTISt10__num_base;
     _ZTISt21__ctype_abstract_baseI[cw]E;
     _ZTISt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
+#    _ZTISt16__numpunct_cacheI[cw]E;
+#    _ZTISt17__timepunct_cacheI[cw]E;
+#    _ZTISt18__moneypunct_cacheI[cw]Lb?EE;
+    _ZTINSt8ios_base7failureE;
+    _ZTINSt6locale5facetE;
     _ZTIN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
     _ZTIN9__gnu_cxx13stdio_filebufI[cw]St11char_traitsI[cw]EEE;
 
@@ -475,7 +491,14 @@ GLIBCXX_3.4 {
     _ZTSNSt6locale5facetE;
     _ZTSS[a-z];
     _ZTSSt[0-9][A-Za-z]*;
-    _ZTSSt[0-9][0-9][A-Za-z]*;
+#    _ZTSSt[0-9][0-9][A-Za-z]*;
+    _ZTSSt[0-9][0-9][A-Z]*;
+    _ZTSSt[0-9][0-9][a-d]*;
+    _ZTSSt[0-9][0-9][f-r]*;
+    _ZTSSt[0-9][0-9][t-z]*;
+    _ZTSSt[0-9][0-9]e[^r]*;
+    _ZTSSt[0-9][0-9]s[^y]*;
+
     _ZTSSt11__timepunctI[cw]E;
     _ZTSSt10__num_base;
     _ZTSSt21__ctype_abstract_baseI[cw]E;
@@ -719,6 +742,18 @@ GLIBCXX_3.4.10 {
 
     _ZNK11__gnu_debug16_Error_formatter17_M_get_max_lengthEv;
 
+    # system_error
+    _ZSt15system_category;
+
+    _ZTISt14error_category;
+    _ZTSSt14error_category;
+    _ZTVSt14error_category;
+
+    _ZTSSt12system_error;
+    _ZTISt12system_error;
+    _ZTVSt12system_error;
+    _ZNSt12system_errorD*Ev;
+
 } GLIBCXX_3.4.9;
 
 # Symbols in the support library (libsupc++) have their own tag.
index 8e78be8..a41f4f8 100755 (executable)
@@ -13792,7 +13792,7 @@ _ACEOF
 
 
 
-# Check for compiler support that doesn't require linking.
+# Enable compiler support that doesn't require linking.
 
   echo "$as_me:$LINENO: checking for exception model to use" >&5
 echo $ECHO_N "checking for exception model to use... $ECHO_C" >&6
@@ -13956,7 +13956,7 @@ echo "${ECHO_T}$enable_libstdcxx_pch" >&6
 
 
 
-# Enable all the variable C++ runtime options.
+# Enable all the variable C++ runtime options that doesn't require linking.
 
   echo "$as_me:$LINENO: checking for underlying I/O to use" >&5
 echo $ECHO_N "checking for underlying I/O to use... $ECHO_C" >&6
@@ -16530,6 +16530,202 @@ _ACEOF
   fi
 
 
+# Checks for operating systems support that don't require linking.
+
+
+  echo "$as_me:$LINENO: checking for EOWNERDEAD" >&5
+echo $ECHO_N "checking for EOWNERDEAD... $ECHO_C" >&6
+  if test "${ac_system_error1+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 <errno.h>
+int
+main ()
+{
+ int i = EOWNERDEAD;
+  ;
+  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_c_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_system_error1=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error1" >&5
+echo "${ECHO_T}$ac_system_error1" >&6
+  if test x"$ac_system_error1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EOWNERDEAD 1
+_ACEOF
+
+  fi
+
+  echo "$as_me:$LINENO: checking for ENOTRECOVERABLE" >&5
+echo $ECHO_N "checking for ENOTRECOVERABLE... $ECHO_C" >&6
+  if test "${ac_system_error2+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 <errno.h>
+int
+main ()
+{
+ int i = ENOTRECOVERABLE;
+  ;
+  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_c_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_system_error2=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error2=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error2" >&5
+echo "${ECHO_T}$ac_system_error2" >&6
+  if test x"$ac_system_error2" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOTRECOVERABLE 1
+_ACEOF
+
+  fi
+
+  echo "$as_me:$LINENO: checking for sys_nerr" >&5
+echo $ECHO_N "checking for sys_nerr... $ECHO_C" >&6
+  if test "${ac_system_error3+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 <errno.h>
+int
+main ()
+{
+ int i = sys_nerr;
+  ;
+  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_c_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_system_error3=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error3=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error3" >&5
+echo "${ECHO_T}$ac_system_error3" >&6
+  if test x"$ac_system_error3" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_NERR 1
+_ACEOF
+
+  fi
+
+
 # No surprises, no surprises...
 
   echo "$as_me:$LINENO: checking for thread model used by GCC" >&5
@@ -16571,7 +16767,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
   # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
     cat > conftest.$ac_ext << EOF
-#line 16574 "configure"
+#line 16770 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
index 5d1d947..4ad8d0e 100644 (file)
@@ -92,11 +92,11 @@ AC_SUBST(enable_static)
 ## than just ignoring the results.  Faster /and/ more correct, win win.
 GLIBCXX_ENABLE_HOSTED
 
-# Check for compiler support that doesn't require linking.
+# Enable compiler support that doesn't require linking.
 GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
 GLIBCXX_ENABLE_PCH($is_hosted)
 
-# Enable all the variable C++ runtime options.  
+# Enable all the variable C++ runtime options that doesn't require linking.
 GLIBCXX_ENABLE_CSTDIO
 GLIBCXX_ENABLE_CLOCALE
 GLIBCXX_ENABLE_ALLOCATOR
@@ -110,6 +110,9 @@ GLIBCXX_ENABLE_DEBUG([no])
 GLIBCXX_ENABLE_CXX_FLAGS
 GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
 
+# Checks for operating systems support that don't require linking.
+GLIBCXX_CHECK_SYSTEM_ERROR
+
 # No surprises, no surprises...
 GLIBCXX_ENABLE_THREADS
 GLIBCXX_ENABLE_ATOMIC_BUILTINS
index 73fe677..1484c78 100644 (file)
@@ -532,6 +532,7 @@ INPUT                  = @srcdir@/docs/doxygen/doxygroups.cc \
                          include/stdexcept \
                          include/streambuf \
                          include/string \
+                         include/system_error \
                          include/tuple \
                          include/type_traits \
                          include/unordered_map \
index b7a2a96..c51128b 100644 (file)
@@ -58,6 +58,7 @@ std_headers = \
        ${std_srcdir}/stdexcept \
        ${std_srcdir}/streambuf \
        ${std_srcdir}/string \
+       ${std_srcdir}/system_error \
        ${std_srcdir}/tuple \
        ${std_srcdir}/type_traits \
        ${std_srcdir}/unordered_map \
index 876563f..f6e69b0 100644 (file)
@@ -303,6 +303,7 @@ std_headers = \
        ${std_srcdir}/stdexcept \
        ${std_srcdir}/streambuf \
        ${std_srcdir}/string \
+       ${std_srcdir}/system_error \
        ${std_srcdir}/tuple \
        ${std_srcdir}/type_traits \
        ${std_srcdir}/unordered_map \
index 022c5ca..d5658fe 100644 (file)
 #  undef _GLIBCXX_INCLUDE_AS_CXX0X
 #endif
 
+#include <system_error>
+
+namespace std
+{
+  template<>
+    struct hash<error_code> : public unary_function<error_code, size_t>
+    {      
+      size_t
+      operator()(error_code __e) const
+      { 
+       const char* __p = reinterpret_cast<const char*>(&__e);
+       return _Fnv_hash<>::hash(__p, sizeof(__e));
+      }
+    };
+}
+
 #endif // _FUNCTIONAL_HASH_H
 
index 2287756..67dcc55 100644 (file)
 #include <ios>
 #include <bits/ostream_insert.h>
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <system_error>
+#endif
+
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // [27.6.2.1] Template class basic_ostream
@@ -531,6 +535,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     { return (__out << reinterpret_cast<const char*>(__s)); }
   //@}
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _CharT, typename _Traits>
+    inline basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __out, const error_code& __e)
+{ return (__out << __e.category().name().c_str() << ':' << __e.value()); }
+#endif
+
   // [27.6.2.7] standard basic_ostream manipulators
   /**
    *  @brief  Write a newline and flush the stream.
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
new file mode 100644 (file)
index 0000000..3f13622
--- /dev/null
@@ -0,0 +1,244 @@
+// <system_error> -*- C++ -*-
+
+// Copyright (C) 2007 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 include/system_error
+ *  This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_SYSTEM_ERROR
+#define _GLIBCXX_SYSTEM_ERROR 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <bits/c++config.h>
+#include <cerrno>
+#include <iosfwd>
+#include <stdexcept>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  class system_error;
+  class error_code;
+  class error_category;
+
+  extern const error_category& system_category;
+
+  enum posix_errno
+    {
+      address_family_not_supported =           EAFNOSUPPORT,
+      address_in_use =                                 EADDRINUSE,
+      address_not_available =                  EADDRNOTAVAIL,
+      already_connected =                      EISCONN,
+      argument_list_too_long =                         E2BIG,
+      argument_out_of_domain =                         EDOM,
+      bad_address =                            EFAULT,
+      bad_file_descriptor =                    EBADF,
+      bad_message =                            EBADMSG,
+      broken_pipe =                            EPIPE,
+      connection_aborted =                     ECONNABORTED,
+      connection_already_in_progress =                 EALREADY,
+      connection_refused =                     ECONNREFUSED,
+      connection_reset =                       ECONNRESET,
+      cross_device_link =                      EXDEV,
+      destination_address_required =           EDESTADDRREQ,
+      device_or_resource_busy =                EBUSY,
+      directory_not_empty =                    ENOTEMPTY,
+      executable_format_error =                ENOEXEC,
+      file_exists =                            EEXIST,
+      file_too_large =                                 EFBIG,
+      filename_too_long =                      ENAMETOOLONG,
+      function_not_supported =                         ENOSYS,
+      host_unreachable =                       EHOSTUNREACH,
+      identifier_removed =                     EIDRM,
+      illegal_byte_sequence =                  EILSEQ,
+      inappropriate_io_control_operation =     ENOTTY,
+      interrupted =                            EINTR,
+      invalid_argument =                       EINVAL,
+      invalid_seek =                           ESPIPE,
+      io_error =                               EIO,
+      is_a_directory =                                 EISDIR,
+      message_size =                           EMSGSIZE,
+      network_down =                           ENETDOWN,
+      network_reset =                          ENETRESET,
+      network_unreachable =                    ENETUNREACH,
+      no_buffer_space =                        ENOBUFS,
+      no_child_process =                       ECHILD,
+      no_link =                                ENOLINK,
+      no_lock_available =                      ENOLCK,
+      no_message_available =                   ENODATA, 
+      no_message =                             ENOMSG, 
+      no_protocol_option =                     ENOPROTOOPT,
+      no_space_on_device =                     ENOSPC,
+      no_stream_resources =                    ENOSR,
+      no_such_device_or_address =              ENXIO,
+      no_such_device =                                 ENODEV,
+      no_such_file_or_directory =              ENOENT,
+      no_such_process =                        ESRCH,
+      not_a_directory =                        ENOTDIR,
+      not_a_socket =                           ENOTSOCK,
+      not_a_stream =                           ENOSTR,
+      not_connected =                          ENOTCONN,
+      not_enough_memory =                      ENOMEM,
+      not_supported =                          ENOTSUP,
+      operation_canceled =                     ECANCELED,
+      operation_in_progress =                  EINPROGRESS,
+      operation_not_permitted =                EPERM,
+      operation_not_supported =                EOPNOTSUPP,
+      operation_would_block =                  EWOULDBLOCK,
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead =                             EOWNERDEAD,
+#endif
+      permission_denied =                      EACCES,
+      protocol_error =                                 EPROTO,
+      protocol_not_supported =                         EPROTONOSUPPORT,
+      read_only_file_system =                  EROFS,
+      resource_deadlock_would_occur =          EDEADLK,
+      resource_unavailable_try_again =                 EAGAIN,
+      result_out_of_range =                    ERANGE,
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable =                  ENOTRECOVERABLE,
+#endif
+      stream_timeout =                                 ETIME,
+      text_file_busy =                                 ETXTBSY,
+      timed_out =                              ETIMEDOUT,
+      too_many_files_open_in_system =          ENFILE,
+      too_many_files_open =                    EMFILE,
+      too_many_links =                                 EMLINK,
+      too_many_synbolic_link_levels =          ELOOP,
+      value_too_large =                        EOVERFLOW,
+      wrong_protocol_type =                    EPROTOTYPE,
+      no_posix_equivalent = 1L << 16
+    };
+
+  struct error_category
+  {
+    error_category() { }
+
+    bool 
+    operator==(const error_category& __other) const
+    { return this == &__other; }
+
+    bool 
+    operator!=(const error_category& __other) const
+    { return this != &__other; }
+
+    virtual posix_errno 
+    posix(int __v) const = 0;
+
+    virtual const string& 
+    name() const = 0;
+
+  private:
+    error_category(const error_category&);
+
+    error_category& 
+    operator=(const error_category&);
+  };
+
+  struct error_code
+  {
+    error_code() throw()
+    : _M_value(0), _M_cat(&system_category) { }
+
+    error_code(int __v, const error_category& __cat) throw()
+    : _M_value(__v), _M_cat(&__cat) { }
+
+    error_code(posix_errno __v)
+    : _M_value(__v), _M_cat(&system_category) { }
+
+    void 
+    assign(int __v, const error_category& __cat) throw()
+    {
+      _M_value = __v;
+      _M_cat = &__cat; 
+    }
+
+    void 
+    clear() throw()
+    { 
+      _M_value = 0;
+      _M_cat = &system_category;
+   } 
+
+    int
+    value() const throw() { return _M_value; }
+      
+    const error_category&  
+    category() const { return *_M_cat; }
+
+    posix_errno            
+    posix() const throw() { return this->category().posix(_M_value); }
+
+    // Safe bool idiom.
+    // explicit operator bool() const throw()
+    // { return _M_value != 0; }
+    typedef void (*__bool_type)();
+
+    static void __not_bool_type() { }
+
+    operator __bool_type() const throw()
+    { return _M_value != 0 ? &__not_bool_type : false; }
+
+    bool operator==(const error_code& __other) const
+    { return value() == __other.value() && category() == __other.category(); }
+
+    bool operator!=(const error_code& __other) const
+    { return !(this == &__other); }
+
+  private:
+    int                        _M_value;
+    const error_category*      _M_cat;
+  };
+
+  class system_error : public std::runtime_error
+  {
+  private:
+    error_code         _M_code;
+
+  public:
+    system_error(const string& __what, error_code __ec = error_code())
+    : runtime_error(__what), _M_code(__ec) { }
+
+    system_error(const string& __what, int __v, const error_category& __ecat)
+    : runtime_error(__what), _M_code(error_code(__v, __ecat)) { }
+
+    virtual ~system_error() throw();
+
+    const error_code& 
+    code() const throw() { return _M_code; }
+  };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif 
+
index 818735a..cd2aad6 100644 (file)
@@ -152,6 +152,7 @@ sources = \
        localename.cc \
        stdexcept.cc \
        strstream.cc \
+       system_error.cc \
        tree.cc \
        allocator-inst.cc \
        concept-inst.cc \
@@ -204,6 +205,12 @@ concept-inst.lo: concept-inst.cc
 concept-inst.o: concept-inst.cc
        $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
 
+# Use special rules for the C++0x sources so that the proper flags are passed.
+system_error.lo: system_error.cc
+       $(LTCXXCOMPILE) -std=gnu++0x -c $<
+system_error.o: system_error.cc
+       $(CXXCOMPILE) -std=gnu++0x -c $<
+
 if GLIBCXX_LDBL_COMPAT
 # Use special rules for compatibility-ldbl.cc compilation, as we need to
 # pass -mlong-double-64.
index 49ea3b3..184b903 100644 (file)
@@ -72,12 +72,12 @@ am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \
        ctype.cc debug.cc debug_list.cc functexcept.cc globals_io.cc \
        ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \
        list.cc locale.cc locale_init.cc locale_facets.cc \
-       localename.cc stdexcept.cc strstream.cc tree.cc \
-       allocator-inst.cc concept-inst.cc fstream-inst.cc ext-inst.cc \
-       ios-inst.cc iostream-inst.cc istream-inst.cc istream.cc \
-       locale-inst.cc misc-inst.cc ostream-inst.cc sstream-inst.cc \
-       streambuf-inst.cc streambuf.cc string-inst.cc valarray-inst.cc \
-       wlocale-inst.cc wstring-inst.cc atomicity.cc \
+       localename.cc stdexcept.cc strstream.cc system_error.cc \
+       tree.cc allocator-inst.cc concept-inst.cc fstream-inst.cc \
+       ext-inst.cc ios-inst.cc iostream-inst.cc istream-inst.cc \
+       istream.cc locale-inst.cc misc-inst.cc ostream-inst.cc \
+       sstream-inst.cc streambuf-inst.cc streambuf.cc string-inst.cc \
+       valarray-inst.cc wlocale-inst.cc wstring-inst.cc atomicity.cc \
        codecvt_members.cc collate_members.cc ctype_members.cc \
        messages_members.cc monetary_members.cc numeric_members.cc \
        time_members.cc basic_file.cc c++locale.cc \
@@ -92,13 +92,13 @@ am__objects_4 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
        debug_list.lo functexcept.lo globals_io.lo ios.lo \
        ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \
        locale.lo locale_init.lo locale_facets.lo localename.lo \
-       stdexcept.lo strstream.lo tree.lo allocator-inst.lo \
-       concept-inst.lo fstream-inst.lo ext-inst.lo ios-inst.lo \
-       iostream-inst.lo istream-inst.lo istream.lo locale-inst.lo \
-       misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-inst.lo \
-       streambuf.lo string-inst.lo valarray-inst.lo wlocale-inst.lo \
-       wstring-inst.lo $(am__objects_1) $(am__objects_2) \
-       $(am__objects_3)
+       stdexcept.lo strstream.lo system_error.lo tree.lo \
+       allocator-inst.lo concept-inst.lo fstream-inst.lo ext-inst.lo \
+       ios-inst.lo iostream-inst.lo istream-inst.lo istream.lo \
+       locale-inst.lo misc-inst.lo ostream-inst.lo sstream-inst.lo \
+       streambuf-inst.lo streambuf.lo string-inst.lo valarray-inst.lo \
+       wlocale-inst.lo wstring-inst.lo $(am__objects_1) \
+       $(am__objects_2) $(am__objects_3)
 am_libstdc___la_OBJECTS = $(am__objects_4)
 libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -378,6 +378,7 @@ sources = \
        localename.cc \
        stdexcept.cc \
        strstream.cc \
+       system_error.cc \
        tree.cc \
        allocator-inst.cc \
        concept-inst.cc \
@@ -786,6 +787,12 @@ concept-inst.lo: concept-inst.cc
 concept-inst.o: concept-inst.cc
        $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
 
+# Use special rules for the C++0x sources so that the proper flags are passed.
+system_error.lo: system_error.cc
+       $(LTCXXCOMPILE) -std=gnu++0x -c $<
+system_error.o: system_error.cc
+       $(CXXCOMPILE) -std=gnu++0x -c $<
+
 # Use special rules for compatibility-ldbl.cc compilation, as we need to
 # pass -mlong-double-64.
 @GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc
diff --git a/libstdc++-v3/src/system_error.cc b/libstdc++-v3/src/system_error.cc
new file mode 100644 (file)
index 0000000..1916254
--- /dev/null
@@ -0,0 +1,71 @@
+// <system_error> implementation file
+
+// Copyright (C) 2007
+// 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.
+
+#include <cstring>
+#include <system_error>
+#include <bits/functexcept.h>
+#include <limits>
+
+namespace
+{
+  struct gnu_error_category : public std::error_category
+  {
+    virtual const std::string& 
+    name() const 
+    { 
+      static const std::string category("GNU");
+      return category;
+    }
+
+    virtual std::posix_errno 
+    posix(int __v) const
+    {
+#ifdef _GLIBCXX_HAVE_SYS_NERR
+      const int last_errorno = sys_nerr;
+#else
+      const int last_errorno = std::numeric_limits<int>::max();
+#endif
+      if (__v > 0 && __v <= last_errorno)
+       return std::posix_errno(__v);
+      else
+       return std::no_posix_equivalent;
+    }
+  };
+
+  const gnu_error_category gnu_category;
+}
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  const error_category& system_category = gnu_category;
+
+  system_error::~system_error() throw() { }
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
new file mode 100644 (file)
index 0000000..4a3d3de
--- /dev/null
@@ -0,0 +1,56 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+}
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  __gnu_test::test_category c1;
+  __gnu_test::test_category c2(c1); 
+
+  return 0;
+}
+
+// { dg-error "is private" "" { target *-*-* } 162 }
+// { dg-error "within this context" "" { target *-*-* } 29 }
+// { dg-error "first required here" "" { target *-*-* } 48 }
+// { dg-excess-errors "copy constructor" }
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc
new file mode 100644 (file)
index 0000000..ae4f5b3
--- /dev/null
@@ -0,0 +1,61 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+
+  struct test_derived_category : public test_category
+  { 
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_derived_category");
+      return s;
+    }
+  };
+}
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  // 1
+  __gnu_test::test_category c1;
+  __gnu_test::test_derived_category c2;
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc
new file mode 100644 (file)
index 0000000..4d5b4cd
--- /dev/null
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+
+  struct test_derived_category : public test_category
+  { 
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_derived_category");
+      return s;
+    }
+  };
+}
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  __gnu_test::test_category c1;
+  __gnu_test::test_derived_category c2;
+  VERIFY( c1 == c1 );
+  VERIFY( !(c1 == c2) );
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc
new file mode 100644 (file)
index 0000000..7d5f8d3
--- /dev/null
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+
+  struct test_derived_category : public test_category
+  { 
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_derived_category");
+      return s;
+    }
+  };
+}
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  __gnu_test::test_category c1;
+  __gnu_test::test_derived_category c2;
+  VERIFY( !(c1 != c1) );
+  VERIFY( c1 != c2 );
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc
new file mode 100644 (file)
index 0000000..8732e28
--- /dev/null
@@ -0,0 +1,63 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+}
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  // 1
+  std::error_code e1;
+  VERIFY( e1.value() == 0 );
+  VERIFY( e1.category() == std::system_category );
+
+  // 2
+  const __gnu_test::test_category cat;
+  std::error_code e2(e1.value(), cat);
+  VERIFY( e2.value() == e1.value() );
+  VERIFY( e2.category() == cat );
+
+  // 3
+  std::error_code e3(std::operation_not_supported);
+  VERIFY( e3.value() == int(std::operation_not_supported) );
+  VERIFY( e3.category() == std::system_category );
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc
new file mode 100644 (file)
index 0000000..f4cd48c
--- /dev/null
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+// unspecified bool operator positive tests
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  bool b;
+
+  // 1
+  std::error_code e1;
+  if (e1)
+    {
+      VERIFY( false );
+    }
+
+  // 2
+  std::error_code e2(std::operation_not_supported);
+  if (e2)
+    {
+      VERIFY( true );
+    }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc
new file mode 100644 (file)
index 0000000..3bf89ba
--- /dev/null
@@ -0,0 +1,34 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  std::error_code e;
+  int i = e; 
+
+  return 0;
+}
+
+// { dg-error "invalid conversion" "" { target *-*-* } 29 }
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc
new file mode 100644 (file)
index 0000000..e94c52a
--- /dev/null
@@ -0,0 +1,58 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+}
+
+// unspecified bool operator positive tests
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::error_code e1;
+  std::error_code e2(std::operation_not_supported);
+
+  VERIFY( e1 == e1 );
+  VERIFY( !(e1 == e2) );
+
+  const __gnu_test::test_category cat;
+  std::error_code e3(e2.value(), cat);
+  VERIFY( !(e2 == e3) );
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc
new file mode 100644 (file)
index 0000000..de487ee
--- /dev/null
@@ -0,0 +1,58 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+  struct test_category : public std::error_category
+  { 
+    virtual std::posix_errno 
+    posix(int __v) const
+    { return std::posix_errno(__v); }
+
+    virtual const std::string& 
+    name() const 
+    { 
+      static std::string s("__gnu_test::test_category");
+      return s;
+    }
+  };
+}
+
+// unspecified bool operator positive tests
+int main()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::error_code e1;
+  std::error_code e2(std::operation_not_supported);
+
+  VERIFY( !(e1 != e1) );
+  VERIFY( e1 != e2 );
+
+  const __gnu_test::test_category cat;
+  std::error_code e3(e2.value(), cat);
+  VERIFY( e2 != e3 );
+
+  return 0;
+}
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile }
 
 // Copyright (C) 2007 Free Software Foundation, Inc.
@@ -8,17 +7,20 @@
 // 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.
 
-#include <functional>
+// 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.
+
+#include <system_error>  // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 36 } 
+
+
 
-template class std::hash<bool>;
diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc
new file mode 100644 (file)
index 0000000..44d253c
--- /dev/null
@@ -0,0 +1,119 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+
+namespace gnu
+{
+  using std::system_error;
+  using std::error_code;
+  using std::error_category;
+  using std::system_category;
+
+  using std::posix_errno;
+  using std::address_family_not_supported;
+  using std::address_in_use;
+  using std::address_not_available;
+  using std::already_connected;
+  using std::argument_list_too_long;
+  using std::argument_out_of_domain;
+  using std:: bad_address;
+  using std::bad_file_descriptor;
+  using std::bad_message;
+  using std::broken_pipe;
+  using std::connection_aborted;
+  using std::connection_already_in_progress; 
+  using std::connection_refused; 
+  using std::connection_reset; 
+  using std::cross_device_link; 
+  using std::destination_address_required;
+  using std::device_or_resource_busy;
+  using std::directory_not_empty; 
+  using std::executable_format_error;
+  using std::file_exists;
+  using std::file_too_large;   
+  using std::filename_too_long;
+  using std::function_not_supported; 
+  using std::host_unreachable; 
+  using std::identifier_removed;
+  using std::illegal_byte_sequence; 
+  using std::inappropriate_io_control_operation; 
+  using std::interrupted; 
+  using std::invalid_argument;
+  using std::invalid_seek; 
+  using std::io_error; 
+  using std::is_a_directory; 
+  using std::message_size; 
+  using std::network_down; 
+  using std::network_reset;
+  using std::network_unreachable; 
+  using std::no_buffer_space; 
+  using std::no_child_process;
+  using std::no_link; 
+  using std::no_lock_available; 
+  using std::no_message_available; 
+  using std::no_message; 
+  using std::no_posix_equivalent; 
+  using std::no_protocol_option; 
+  using std::no_space_on_device;
+  using std::no_stream_resources; 
+  using std::no_such_device_or_address; 
+  using std::no_such_device;   
+  using std::no_such_file_or_directory; 
+  using std::no_such_process;  
+  using std::not_a_directory; 
+  using std::not_a_socket; 
+  using std::not_a_stream; 
+  using std::not_connected; 
+  using std::not_enough_memory;
+  using std::not_supported;
+  using std::operation_canceled;
+  using std::operation_in_progress;
+  using std::operation_not_permitted;
+  using std::operation_not_supported;
+  using std::operation_would_block;
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+  using std::owner_dead; 
+#endif
+
+  using std::permission_denied;
+  using std::protocol_error; 
+  using std::protocol_not_supported;
+  using std::read_only_file_system; 
+  using std::resource_deadlock_would_occur;
+  using std::resource_unavailable_try_again; 
+  using std::result_out_of_range;
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+  using std::state_not_recoverable; 
+#endif
+
+  using std::stream_timeout; 
+  using std::text_file_busy; 
+  using std::timed_out; 
+  using std::too_many_files_open_in_system; 
+  using std::too_many_files_open; 
+  using std::too_many_links;   
+  using std::too_many_synbolic_link_levels; 
+  using std::value_too_large; 
+  using std::wrong_protocol_type;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
new file mode 100644 (file)
index 0000000..5348e5b
--- /dev/null
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-06-05 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <cstring>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+  bool test __attribute__((unused)) = true;
+  const std::string s("too late: boulangerie out of pain au raisin");
+  const std::error_code e(std::operation_not_supported);
+
+  // 1
+  {
+    std::system_error err1(s, e);
+    VERIFY( err1.code() == e ); 
+    VERIFY( std::strcmp(err1.runtime_error::what(), s.c_str()) == 0 );
+  }
+
+  // 2
+  {
+    std::system_error err2(s, 95, std::system_category);
+    VERIFY( err2.code() == std::error_code(95, std::system_category) ); 
+    VERIFY( std::strcmp(err2.runtime_error::what(), s.c_str()) == 0 );
+  }
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..09ba2fd
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+// 2007-05-29 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2007 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.
+
+#include <system_error>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::system_error test_type;
+  __gnu_test::diamond_derivation<test_type, false>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc
new file mode 100644 (file)
index 0000000..c178e54
--- /dev/null
@@ -0,0 +1,59 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// 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.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <system_error>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/1972
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  std::string s("lack of sunlight, no water error");
+
+  // 1
+  std::system_error obj1 = std::system_error(s);
+
+  // 2
+  std::system_error obj2(s);
+
+  VERIFY( std::strcmp(obj1.what(), s.data()) == 0 );
+  VERIFY( std::strcmp(obj2.what(), s.data()) == 0 );
+}
+
+void test02()
+{
+  bool test __attribute__((unused)) = true;
+  std::string s("lack of sunlight error");
+  std::system_error x(s);
+  
+  VERIFY( std::strcmp(x.what(), s.data()) == 0 );
+}
+
+int main(void)
+{
+  test01();
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc
new file mode 100644 (file)
index 0000000..eb8e14c
--- /dev/null
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// 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.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <system_error>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/2089
+class fuzzy_logic : public std::system_error
+{
+public:
+  fuzzy_logic() : std::system_error("whoa") { }
+};
+
+void test03()
+{
+  bool test __attribute__((unused)) = true;
+  try
+    { throw fuzzy_logic(); }
+  catch(const fuzzy_logic& obj)
+    { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); }
+  catch(...)
+    { VERIFY( false ); }
+}
+
+int main(void)
+{
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc
new file mode 100644 (file)
index 0000000..23d99a8
--- /dev/null
@@ -0,0 +1,69 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// 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.
+
+#include <string>
+#include <system_error>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// test copy ctors, assignment operators, and persistence of member string data
+// libstdc++/1972
+// via Greg Bumgardner <bumgard@roguewave.com>
+void allocate_on_stack(void) 
+{
+  const size_t num = 512;
+  __extension__ char array[num];
+  for (size_t i = 0; i < num; i++) 
+    array[i]=0;
+}
+
+void test04()
+{
+  bool test __attribute__((unused)) = true;
+  const std::string s("CA ISO emergency once again:immediate power down");
+  const char* strlit1 = "wish I lived in Palo Alto";
+  const char* strlit2 = "...or Santa Barbara";
+  std::system_error obj1(s);
+  
+  // block 01
+  {
+    const std::string s2(strlit1);
+    std::system_error obj2(s2);
+    obj1 = obj2;
+  }
+  allocate_on_stack();
+  VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); 
+
+  // block 02
+  {
+    const std::string s3(strlit2);
+    std::system_error obj3 = std::system_error(s3);
+    obj1 = obj3;
+  }
+  allocate_on_stack();     
+  VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); 
+}
+
+int main(void)
+{
+  test04();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc
new file mode 100644 (file)
index 0000000..e6df84f
--- /dev/null
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// 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.
+
+// 19.1 Exception classes
+
+#include <cstring>
+#include <string>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+// Make sure each invocation of what() doesn't grow the message.
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  std::string s("after nine thirty, this request cannot be met");
+
+  std::system_error obj = std::system_error(s, std::invalid_argument);
+  std::string s1(obj.what());
+  std::string s2(obj.what());
+  VERIFY( s1 == s2 );
+}
+
+int main(void)
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc
new file mode 100644 (file)
index 0000000..765bcbf
--- /dev/null
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 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.
+
+#include <cstring>
+#include <string>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+// Can construct and return 10k character error string.
+void test01()
+{
+  typedef std::system_error test_type;
+
+  bool test __attribute__((unused)) = true;
+  const std::string xxx(10000, 'x');
+  test_type t(xxx);
+  VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 );
+}
+
+int main(void)
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc b/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc
new file mode 100644 (file)
index 0000000..89e82cd
--- /dev/null
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-20  <benjamin@redhat.com>
+//
+// Copyright (C) 2007 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.
+
+#include <functional>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+template<typename T>
+  void
+  do_test()
+  {
+    bool test __attribute__((unused)) = true;
+
+    typedef T                          value_type;
+    typedef std::hash<value_type>      hash_type;
+    using std::size_t;
+
+    value_type v; // default initialized is fine, same value all that matters.
+    hash_type h1;
+    size_t r1 = size_t(h1(v));
+    
+    hash_type h2;
+    size_t r2 = size_t(h2(v));
+
+    VERIFY( r1 == r2 );
+  }
+  
+void test01()
+{
+  do_test<std::error_code>();
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc
new file mode 100644 (file)
index 0000000..7b82eee
--- /dev/null
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007 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.
+
+#include <functional>
+#include <string>
+#include <system_error>
+
+// Verify that we can instantiate hash for every required type.
+template class std::hash<bool>;
+template class std::hash<char>;
+template class std::hash<signed char>;
+template class std::hash<unsigned char>;
+template class std::hash<short>;
+template class std::hash<int>;
+template class std::hash<long>;
+template class std::hash<unsigned short>;
+template class std::hash<unsigned int>;
+template class std::hash<unsigned long>;
+template class std::hash<float>;
+template class std::hash<double>;
+template class std::hash<long double>;
+template class std::hash<void*>;
+template class std::hash<std::string>;
+template class std::hash<std::error_code>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+template class std::hash<wchar_t>;
+template class std::hash<std::wstring>;
+#endif
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc
new file mode 100644 (file)
index 0000000..3cac928
--- /dev/null
@@ -0,0 +1,74 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation
+//
+// 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.
+
+#include <ostream>
+#include <sstream>
+#include <system_error>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+//   Effects: os << ec.category().name() << ':' << ec.value();
+void test()
+{
+  using namespace std;
+  bool test __attribute__((unused)) = true;
+
+  char buf[64];
+  error_code e1;
+  error_code e2(bad_address);
+  string s, s1, s2;
+
+  {
+    ostringstream ostr;
+    ostr << e1 << endl;
+    s1 = ostr.str();
+
+    if (ostr.rdstate() & ios_base::eofbit) 
+      test = false;
+  }
+  VERIFY( test );
+  VERIFY( find(s1.begin(), s1.end(), ':') != s1.end() );
+
+  sprintf(buf, "%i", e1.value());
+  s = buf;
+  VERIFY( s1.find(s) != string::npos);
+
+  {
+    ostringstream ostr;
+    ostr << e2 << endl;
+    s2 = ostr.str();
+
+    if (ostr.rdstate() & ios_base::eofbit) 
+      test = false;
+  }
+  VERIFY( test );
+  VERIFY( find(s2.begin(), s2.end(), ':') != s2.end() );
+
+  sprintf(buf, "%i", e2.value());
+  s = buf;
+  VERIFY( s2.find(s) != string::npos);
+}
+
+int 
+main()
+{
+  test(); 
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
new file mode 100644 (file)
index 0000000..a83c9cb
--- /dev/null
@@ -0,0 +1,75 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation
+//
+// 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.
+
+#include <ostream>
+#include <sstream>
+#include <system_error>
+#include <algorithm>
+#include <wchar.h>
+#include <testsuite_hooks.h>
+
+//   Effects: os << ec.category().name() << ':' << ec.value();
+void test()
+{
+  using namespace std;
+  bool test __attribute__((unused)) = true;
+
+  wchar_t buf[64];
+  error_code e1;
+  error_code e2(bad_address);
+  wstring s, s1, s2;
+
+  {
+    wostringstream ostr;
+    ostr << e1 << endl;
+    s1 = ostr.str();
+
+    if (ostr.rdstate() & ios_base::eofbit) 
+      test = false;
+  }
+  VERIFY( test );
+  VERIFY( find(s1.begin(), s1.end(), L':') != s1.end() );
+
+  swprintf(buf, 64, L"%i", e1.value());
+  s = buf;
+  VERIFY( s1.find(s) != string::npos);
+
+  {
+    wostringstream ostr;
+    ostr << e2 << endl;
+    s2 = ostr.str();
+
+    if (ostr.rdstate() & ios_base::eofbit) 
+      test = false;
+  }
+  VERIFY( test );
+  VERIFY( find(s2.begin(), s2.end(), L':') != s2.end() );
+
+  swprintf(buf, 64, L"%i", e2.value());
+  s = buf;
+  VERIFY( s2.find(s) != string::npos);
+}
+
+int 
+main()
+{
+  test(); 
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc
new file mode 100644 (file)
index 0000000..067a9f5
--- /dev/null
@@ -0,0 +1,75 @@
+// 2007-08-20  <benjamin@redhat.com>
+//
+// Copyright (C) 2007 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.
+
+// 6.3.3 Class template hash
+
+#include <tr1/functional>
+#include <string>
+#include <testsuite_hooks.h>
+
+template<typename T>
+  void
+  do_test()
+  {
+    bool test __attribute__((unused)) = true;
+
+    typedef T                          value_type;
+    typedef std::tr1::hash<value_type>         hash_type;
+    using std::size_t;
+
+    value_type v; // default initialized is fine, same value all that matters.
+    hash_type h1;
+    size_t r1 = size_t(h1(v));
+    
+    hash_type h2;
+    size_t r2 = size_t(h2(v));
+
+    VERIFY( r1 == r2 );
+  }
+  
+void test01()
+{
+  do_test<bool>();
+  do_test<char>();
+  do_test<signed char>();
+  do_test<unsigned char>();
+  do_test<short>();
+  do_test<int>();
+  do_test<long>();
+  do_test<unsigned short>();
+  do_test<unsigned int>();
+  do_test<unsigned long>();
+  do_test<int*>();
+  do_test<std::string>();
+  do_test<float>();
+  do_test<double>();
+  do_test<long double>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+  do_test<wchar_t>();
+  do_test<std::wstring>();
+#endif
+}
+
+int main()
+{
+  test01();
+  return 0;
+}