From e4e5e7f5f8699e02d3beb1db6ac341b07820af64 Mon Sep 17 00:00:00 2001
From: Benjamin Kosnik <bkoz@redhat.com>
Date: Wed, 29 Aug 2007 19:53:50 +0000
Subject: [PATCH] acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Add ENODATA,
 ENOSR, ENOSTR, ETIME for freebsd.

2007-08-29  Benjamin Kosnik  <bkoz@redhat.com>

	* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Add ENODATA, ENOSR,
	ENOSTR, ETIME for freebsd.
	* configure: Regenerate.
	* include/std/system_error: Guard.
	* testsuite/19_diagnostics/headers/system_error/
	types_std_c++0x.cc: Same.
	* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust
	line numbers.

From-SVN: r127912
---
 libstdc++-v3/ChangeLog                        |  11 +
 libstdc++-v3/acinclude.m4                     |  40 +++
 libstdc++-v3/config.h.in                      |  12 +
 libstdc++-v3/configure                        | 258 +++++++++++++++++-
 libstdc++-v3/include/std/system_error         |  17 ++
 .../error_category/cons/copy_neg.cc           |   2 +-
 .../headers/system_error/types_std_c++0x.cc   |  15 +
 7 files changed, 353 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b41548f2f4df..99048bb45847 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+2007-08-29  Benjamin Kosnik  <bkoz@redhat.com>
+
+	* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Add ENODATA, ENOSR,
+	ENOSTR, ETIME for freebsd.	
+	* configure: Regenerate.
+	* include/std/system_error: Guard.	
+	* testsuite/19_diagnostics/headers/system_error/
+	types_std_c++0x.cc: Same.
+	* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust
+	line numbers.
+
 2007-08-28  Paolo Carlini  <pcarlini@suse.de>
 
 	PR libstdc++/33128
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 390d450a71f1..5fa76eda147c 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1302,6 +1302,46 @@ AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
     AC_DEFINE(HAVE_EPROTO, 1, [Define if EPROTO exists.])
   fi
 
+  AC_MSG_CHECKING([for ENODATA])
+  AC_CACHE_VAL(ac_system_error_5, [
+  AC_TRY_COMPILE([#include <errno.h>], [ int i = ENODATA; ],
+             [ac_system_error_5=yes], [ac_system_error_5=no])
+  ])
+  AC_MSG_RESULT($ac_system_error_5)
+  if test x"$ac_system_error_5" = x"yes"; then
+    AC_DEFINE(HAVE_ENODATA, 1, [Define if ENODATA exists.])
+  fi
+
+  AC_MSG_CHECKING([for ENOSR])
+  AC_CACHE_VAL(ac_system_error_6, [
+  AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOSR; ],
+             [ac_system_error_6=yes], [ac_system_error_6=no])
+  ])
+  AC_MSG_RESULT($ac_system_error_6)
+  if test x"$ac_system_error_6" = x"yes"; then
+    AC_DEFINE(HAVE_ENOSR, 1, [Define if ENOSR exists.])
+  fi
+
+  AC_MSG_CHECKING([for ENOSTR])
+  AC_CACHE_VAL(ac_system_error_7, [
+  AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOSTR; ],
+             [ac_system_error_7=yes], [ac_system_error_7=no])
+  ])
+  AC_MSG_RESULT($ac_system_error_7)
+  if test x"$ac_system_error_7" = x"yes"; then
+    AC_DEFINE(HAVE_ENOSTR, 1, [Define if ENOSTR exists.])
+  fi
+
+  AC_MSG_CHECKING([for ETIME])
+  AC_CACHE_VAL(ac_system_error_8, [
+  AC_TRY_COMPILE([#include <errno.h>], [ int i = ETIME; ],
+             [ac_system_error_8=yes], [ac_system_error_8=no])
+  ])
+  AC_MSG_RESULT($ac_system_error_8)
+  if test x"$ac_system_error_8" = x"yes"; then
+    AC_DEFINE(HAVE_ETIME, 1, [Define if ETIME exists.])
+  fi
+
   AC_MSG_CHECKING([for sys_nerr])
   AC_CACHE_VAL(ac_system_error9, [
   AC_TRY_COMPILE([#include <errno.h> ], [ int i = sys_nerr; ],
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 1779215e551e..be830a0c1ce8 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -63,9 +63,18 @@
 /* Define to 1 if you have the <endian.h> header file. */
 #undef HAVE_ENDIAN_H
 
+/* Define if ENODATA exists. */
+#undef HAVE_ENODATA
+
 /* Define if ENOLINK exists. */
 #undef HAVE_ENOLINK
 
+/* Define if ENOSR exists. */
+#undef HAVE_ENOSR
+
+/* Define if ENOSTR exists. */
+#undef HAVE_ENOSTR
+
 /* Define if ENOTRECOVERABLE exists. */
 #undef HAVE_ENOTRECOVERABLE
 
@@ -75,6 +84,9 @@
 /* Define if EPROTO exists. */
 #undef HAVE_EPROTO
 
+/* Define if ETIME exists. */
+#undef HAVE_ETIME
+
 /* Define to 1 if you have the `expf' function. */
 #undef HAVE_EXPF
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 01d905af7556..4df7e23acf41 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -16789,6 +16789,262 @@ _ACEOF
 
   fi
 
+  echo "$as_me:$LINENO: checking for ENODATA" >&5
+echo $ECHO_N "checking for ENODATA... $ECHO_C" >&6
+  if test "${ac_system_error_5+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 = ENODATA;
+  ;
+  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_error_5=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_5=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error_5" >&5
+echo "${ECHO_T}$ac_system_error_5" >&6
+  if test x"$ac_system_error_5" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENODATA 1
+_ACEOF
+
+  fi
+
+  echo "$as_me:$LINENO: checking for ENOSR" >&5
+echo $ECHO_N "checking for ENOSR... $ECHO_C" >&6
+  if test "${ac_system_error_6+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 = ENOSR;
+  ;
+  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_error_6=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_6=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error_6" >&5
+echo "${ECHO_T}$ac_system_error_6" >&6
+  if test x"$ac_system_error_6" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOSR 1
+_ACEOF
+
+  fi
+
+  echo "$as_me:$LINENO: checking for ENOSTR" >&5
+echo $ECHO_N "checking for ENOSTR... $ECHO_C" >&6
+  if test "${ac_system_error_7+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 = ENOSTR;
+  ;
+  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_error_7=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_7=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error_7" >&5
+echo "${ECHO_T}$ac_system_error_7" >&6
+  if test x"$ac_system_error_7" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOSTR 1
+_ACEOF
+
+  fi
+
+  echo "$as_me:$LINENO: checking for ETIME" >&5
+echo $ECHO_N "checking for ETIME... $ECHO_C" >&6
+  if test "${ac_system_error_8+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 = ETIME;
+  ;
+  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_error_8=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_8=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+  echo "$as_me:$LINENO: result: $ac_system_error_8" >&5
+echo "${ECHO_T}$ac_system_error_8" >&6
+  if test x"$ac_system_error_8" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ETIME 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_error9+set}" = set; then
@@ -16895,7 +17151,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 16898 "configure"
+#line 17154 "configure"
 int main()
 {
   // NB: _Atomic_word not necessarily int.
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 0b520580b142..e5b65ed5fc8e 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -93,22 +93,35 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       network_unreachable = 			ENETUNREACH,
       no_buffer_space = 			ENOBUFS,
       no_child_process = 			ECHILD,
+
 #ifdef _GLIBCXX_HAVE_ENOLINK
       no_link = 				ENOLINK,
 #endif
       no_lock_available = 			ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
       no_message_available = 			ENODATA, 
+#endif
+
       no_message = 				ENOMSG, 
       no_protocol_option = 			ENOPROTOOPT,
       no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
       no_stream_resources = 			ENOSR,
+#endif
+
       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,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
       not_a_stream = 				ENOSTR,
+#endif
+
       not_connected = 				ENOTCONN,
       not_enough_memory = 			ENOMEM,
       not_supported = 				ENOTSUP,
@@ -132,7 +145,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 #ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
       state_not_recoverable = 			ENOTRECOVERABLE,
 #endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
       stream_timeout = 				ETIME,
+#endif
+
       text_file_busy = 				ETXTBSY,
       timed_out = 				ETIMEDOUT,
       too_many_files_open_in_system = 		ENFILE,
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
index 7c0aa0a54c43..766009c429ed 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
@@ -50,7 +50,7 @@ int main()
   return 0;
 }
 
-// { dg-error "is private" "" { target *-*-* } 166 }
+// { dg-error "is private" "" { target *-*-* } 183 }
 // { 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/headers/system_error/types_std_c++0x.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc
index 73d4d66f2e9b..742ef29a77ca 100644
--- 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
@@ -73,19 +73,31 @@ namespace gnu
 #endif
 
   using std::no_lock_available; 
+
+#ifdef _GLIBCXX_HAVE_ENODATA
   using std::no_message_available; 
+#endif
+
   using std::no_message; 
   using std::no_posix_equivalent; 
   using std::no_protocol_option; 
   using std::no_space_on_device;
+
+#ifdef _GLIBCXX_HAVE_ENOSR
   using std::no_stream_resources; 
+#endif
+
   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; 
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
   using std::not_a_stream; 
+#endif
+
   using std::not_connected; 
   using std::not_enough_memory;
   using std::not_supported;
@@ -115,7 +127,10 @@ namespace gnu
   using std::state_not_recoverable; 
 #endif
 
+#ifdef _GLIBCXX_HAVE_ETIME
   using std::stream_timeout; 
+#endif
+
   using std::text_file_busy; 
   using std::timed_out; 
   using std::too_many_files_open_in_system; 
-- 
GitLab