On 17/12/20 14:05 +0000, Jonathan Wakely wrote:
On 16/12/20 13:38 +0000, Jonathan Wakely wrote:
This fixes a bug caused by a mismatch between the macros defined by
<errno.h> when GCC is built and the macros defined by <errno.h> when
users include <system_error>. If the user code is compiled with
_XOPEN_SOURCE defined to 500 or 600, Darwin suppresses the
ENOTRECOVERABLE and EOWNERDEAD macros, which are not defined by SUSv3
(aka POSIX.1-2001).
Since POSIX requires the errno macros to be macros (and not variables or
enumerators) we can just test for them directly using the preprocessor.
That means that <system_error> will match what is actuallydefined when
it's included, not what was defined when GCC was built. With that change
there is no need for the GLIBCXX_CHECK_SYSTEM_ERROR configure checks and
they can be removed.
libstdc++-v3/ChangeLog:
PR libstdc++/93151
* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Remove.
* configure.ac: Regenerate.
Oops, that changelog was wrong.
* config/os/generic/error_constants.h: Test POSIX errno macros
directly, instead of corresponding _GLIBCXX_HAVE_EXXX macros.
* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc:
Likewise.
* testsuite/19_diagnostics/headers/system_error/93151.cc: New
test.
I forgot to regenerate the autoconf files. Fixed in r11-6229.
Tested powerpc64le-linux. Committed to trunk.
libstdc++-v3/ChangeLog:
* config.h.in: Regenerate.
* configure: Regenerate.
Oops, and I also forgot to update the other headers that were using
those autoconf-generated macros!
Fixed by this patch. Tested on mingw-w64, pushed to trunk.
commit 217d5beaff9987a9845155fc796322b5f8bb876d
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Thu Dec 17 16:03:07 2020
libstdc++: Test errno macros directly for all targets [PR 93151]
This applies the same changes to the djgpp and mingw versions of
error_constants.h as r11-6137 did for the generic version.
All of these constants are defined as macros by <errno.h> on these
targets, so we can just test the macro directly instead of checking for
it at configure time.
libstdc++-v3/ChangeLog:
* config/os/djgpp/error_constants.h: Test POSIX errno macros
directly, instead of corresponding _GLIBCXX_HAVE_EXXX macros.
* config/os/mingw32-w64/error_constants.h: Likewise.
* config/os/mingw32/error_constants.h: Likewise.
diff --git a/libstdc++-v3/config/os/djgpp/error_constants.h b/libstdc++-v3/config/os/djgpp/error_constants.h
index e0a67bc8d6d..8f947e69e37 100644
--- a/libstdc++-v3/config/os/djgpp/error_constants.h
+++ b/libstdc++-v3/config/os/djgpp/error_constants.h
@@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bad_address = EFAULT,
bad_file_descriptor = EBADF,
-#ifdef _GLIBCXX_HAVE_EBADMSG
+#ifdef EBADMSG
bad_message = EBADMSG,
#endif
@@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
function_not_supported = ENOSYS,
// host_unreachable = EHOSTUNREACH,
-#ifdef _GLIBCXX_HAVE_EIDRM
+#ifdef EIDRM
identifier_removed = EIDRM,
#endif
@@ -86,13 +86,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// no_buffer_space = ENOBUFS,
no_child_process = ECHILD,
-#ifdef _GLIBCXX_HAVE_ENOLINK
+#ifdef ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
-#ifdef _GLIBCXX_HAVE_ENODATA
+#ifdef ENODATA
no_message_available = ENODATA,
#endif
@@ -100,7 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// no_protocol_option = ENOPROTOOPT,
no_space_on_device = ENOSPC,
-#ifdef _GLIBCXX_HAVE_ENOSR
+#ifdef ENOSR
no_stream_resources = ENOSR,
#endif
@@ -111,18 +111,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
not_a_directory = ENOTDIR,
// not_a_socket = ENOTSOCK,
-#ifdef _GLIBCXX_HAVE_ENOSTR
+#ifdef ENOSTR
not_a_stream = ENOSTR,
#endif
// not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
-#ifdef _GLIBCXX_HAVE_ENOTSUP
+#ifdef ENOTSUP
not_supported = ENOTSUP,
#endif
-#ifdef _GLIBCXX_HAVE_ECANCELED
+#ifdef ECANCELED
operation_canceled = ECANCELED,
#endif
@@ -131,13 +131,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// operation_not_supported = EOPNOTSUPP,
// operation_would_block = EWOULDBLOCK,
-#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+#ifdef EOWNERDEAD
owner_dead = EOWNERDEAD,
#endif
permission_denied = EACCES,
-#ifdef _GLIBCXX_HAVE_EPROTO
+#ifdef EPROTO
protocol_error = EPROTO,
#endif
@@ -147,15 +147,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
resource_unavailable_try_again = EAGAIN,
result_out_of_range = ERANGE,
-#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+#ifdef ENOTRECOVERABLE
state_not_recoverable = ENOTRECOVERABLE,
#endif
-#ifdef _GLIBCXX_HAVE_ETIME
+#ifdef ETIME
stream_timeout = ETIME,
#endif
-#ifdef _GLIBCXX_HAVE_ETXTBSY
+#ifdef ETXTBSY
text_file_busy = ETXTBSY,
#endif
@@ -165,7 +165,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
too_many_links = EMLINK,
too_many_symbolic_link_levels = ELOOP,
-#ifdef _GLIBCXX_HAVE_EOVERFLOW
+#ifdef EOVERFLOW
value_too_large = EOVERFLOW,
#endif
diff --git a/libstdc++-v3/config/os/mingw32-w64/error_constants.h b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
index 72422299def..3534c3e11b7 100644
--- a/libstdc++-v3/config/os/mingw32-w64/error_constants.h
+++ b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
@@ -49,7 +49,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
argument_out_of_domain = EDOM,
bad_address = EFAULT,
bad_file_descriptor = EBADF,
-#ifdef _GLIBCXX_HAVE_EBADMSG
+#ifdef EBADMSG
bad_message = EBADMSG,
#endif
broken_pipe = EPIPE,
@@ -67,7 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
filename_too_long = ENAMETOOLONG,
function_not_supported = ENOSYS,
host_unreachable = EHOSTUNREACH,
-#ifdef _GLIBCXX_HAVE_EIDRM
+#ifdef EIDRM
identifier_removed = EIDRM,
#endif
illegal_byte_sequence = EILSEQ,
@@ -82,24 +82,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
network_reset = ENETRESET,
network_unreachable = ENETUNREACH,
no_buffer_space = ENOBUFS,
-#ifdef _GLIBCXX_HAVE_ECHILD
+#ifdef ECHILD
no_child_process = ECHILD,
#endif
-#ifdef _GLIBCXX_HAVE_ENOLINK
+#ifdef ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
-#ifdef _GLIBCXX_HAVE_ENODATA
+#ifdef ENODATA
no_message_available = ENODATA,
#endif
-#ifdef _GLIBCXX_HAVE_ENOMSG
+#ifdef ENOMSG
no_message = ENOMSG,
#endif
no_protocol_option = ENOPROTOOPT,
-#ifdef _GLIBCXX_HAVE_ENOSPC
+#ifdef ENOSPC
no_space_on_device = ENOSPC,
#endif
-#ifdef _GLIBCXX_HAVE_ENOSR
+#ifdef ENOSR
no_stream_resources = ENOSR,
#endif
no_such_device_or_address = ENXIO,
@@ -108,24 +108,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
not_a_socket = ENOTSOCK,
-#ifdef _GLIBCXX_HAVE_ENOSTR
+#ifdef ENOSTR
not_a_stream = ENOSTR,
#endif
not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
-#ifdef _GLIBCXX_HAVE_ENOTSUP
+#ifdef ENOTSUP
not_supported = ENOTSUP,
#endif
operation_canceled = ECANCELED,
operation_in_progress = EINPROGRESS,
-#ifdef _GLIBCXX_HAVE_EPERM
+#ifdef EPERM
operation_not_permitted = EPERM,
#endif
operation_not_supported = EOPNOTSUPP,
-#ifdef _GLIBCXX_HAVE_EWOULDBLOCK
+#ifdef EWOULDBLOCK
operation_would_block = EWOULDBLOCK,
#endif
-#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+#ifdef EOWNERDEAD
owner_dead = EOWNERDEAD,
#endif
permission_denied = EACCES,
@@ -135,23 +135,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
resource_deadlock_would_occur = EDEADLK,
resource_unavailable_try_again = EAGAIN,
result_out_of_range = ERANGE,
-#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+#ifdef ENOTRECOVERABLE
state_not_recoverable = ENOTRECOVERABLE,
#endif
-#ifdef _GLIBCXX_HAVE_ETIME
+#ifdef ETIME
stream_timeout = ETIME,
#endif
-#ifdef _GLIBCXX_HAVE_ETXTBSY
+#ifdef ETXTBSY
text_file_busy = ETXTBSY,
#endif
-#ifdef _GLIBCXX_HAVE_ETIMEDOUT
+#ifdef ETIMEDOUT
timed_out = ETIMEDOUT,
#endif
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK,
too_many_symbolic_link_levels = ELOOP,
-#ifdef _GLIBCXX_HAVE_EOVERFLOW
+#ifdef EOVERFLOW
value_too_large = EOVERFLOW,
#endif
wrong_protocol_type = EPROTOTYPE
diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h
index 68ac72a78fb..2222c5227c4 100644
--- a/libstdc++-v3/config/os/mingw32/error_constants.h
+++ b/libstdc++-v3/config/os/mingw32/error_constants.h
@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// network_reset = ENETRESET,
// network_unreachable = ENETUNREACH,
// no_buffer_space = ENOBUFS,
-#ifdef _GLIBCXX_HAVE_ECHILD
+#ifdef ECHILD
no_child_process = ECHILD,
#endif
// no_link = ENOLINK,
@@ -86,7 +86,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// no_message_available = ENODATA,
// no_message = ENOMSG,
// no_protocol_option = ENOPROTOOPT,
-#ifdef _GLIBCXX_HAVE_ENOSPC
+#ifdef ENOSPC
no_space_on_device = ENOSPC,
#endif
// no_stream_resources = ENOSR,
@@ -99,16 +99,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// not_a_stream = ENOSTR,
// not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
-#ifdef _GLIBCXX_HAVE_ENOTSUP
+#ifdef ENOTSUP
not_supported = ENOTSUP,
#endif
// operation_canceled = ECANCELED,
// operation_in_progress = EINPROGRESS,
-#ifdef _GLIBCXX_HAVE_EPERM
+#ifdef EPERM
operation_not_permitted = EPERM,
#endif
// operation_not_supported = EOPNOTSUPP,
-#ifdef _GLIBCXX_HAVE_EWOULDBLOCK
+#ifdef EWOULDBLOCK
operation_would_block = EWOULDBLOCK,
#endif
// owner_dead = EOWNERDEAD,
@@ -122,14 +122,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// state_not_recoverable = ENOTRECOVERABLE,
// stream_timeout = ETIME,
// text_file_busy = ETXTBSY,
-#ifdef _GLIBCXX_HAVE_ETIMEDOUT
+#ifdef ETIMEDOUT
timed_out = ETIMEDOUT,
#endif
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK
// too_many_symbolic_link_levels = ELOOP,
-#ifdef _GLIBCXX_HAVE_EOVERFLOW
+#ifdef EOVERFLOW
,
value_too_large = EOVERFLOW
#endif