public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Pointless configure checks for <errno.h> macros
@ 2015-11-12  9:17 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2015-11-12  9:17 UTC (permalink / raw)
  To: libstdc++, gcc-patches; +Cc: Kai Tietz, Paolo Carlini

[-- Attachment #1: Type: text/plain, Size: 1412 bytes --]

PR68307 points out that config/os/mingw32-w64/error_constants.h fails
to define a number of errc constants which correspond to EXXX macros
that are supported on mingw-w64.

Does anyone know why we test explicitly for these macros but not
others?

m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA,
          ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED,
          EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY,
          ECHILD, ENOSPC, EPERM,
          ETIMEDOUT, EWOULDBLOCK],

Why do we even test for these in configure, instead of just checking
whether they exist directly using #ifdef in error_constants.h ?

(This was discussed in
https://gcc.gnu.org/ml/libstdc++/2011-08/msg00125.html where Paolo
questioned the value of these checks, but indicated a preference for
consistency).

A bit of (incomplete) archaeology suggests that at one time we defined
all of these in <system_error>, but later split them out into
OS-specific error_constants.h files. If we have a file specific to
mingw-w64 can we just uncomment the constants known to be supported by
that target?

This patch uncomments all the constants with a corresponding macro in
mingw-w64-headers/crt/errno.h in the mingw-w64 sources.

2015-11-12  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/68307
	* config/os/mingw32-w64/error_constants.h: Uncomment all error codes
	supported by mingw-w64.

Is there any problem doing this?


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 4882 bytes --]

diff --git a/libstdc++-v3/config/os/mingw32-w64/error_constants.h b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
index 0168b5f..e0211bf 100644
--- a/libstdc++-v3/config/os/mingw32-w64/error_constants.h
+++ b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
@@ -41,22 +41,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 // replaced by Winsock WSA-prefixed equivalents.
   enum class errc
     {
-//    address_family_not_supported = 		EAFNOSUPPORT,
-//    address_in_use = 				EADDRINUSE,
-//    address_not_available = 			EADDRNOTAVAIL,
-//    already_connected = 			EISCONN,
+      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,
+      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,
@@ -64,7 +64,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       file_too_large = 				EFBIG,
       filename_too_long = 			ENAMETOOLONG,
       function_not_supported = 			ENOSYS,
-//    host_unreachable = 			EHOSTUNREACH,
+      host_unreachable = 			EHOSTUNREACH,
 //    identifier_removed = 			EIDRM,
       illegal_byte_sequence = 			EILSEQ,
       inappropriate_io_control_operation = 	ENOTTY,
@@ -73,11 +73,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       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,
+      message_size = 				EMSGSIZE,
+      network_down = 				ENETDOWN,
+      network_reset = 				ENETRESET,
+      network_unreachable = 			ENETUNREACH,
+      no_buffer_space = 			ENOBUFS,
 #ifdef _GLIBCXX_HAVE_ECHILD
       no_child_process = 			ECHILD,
 #endif
@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       no_lock_available = 			ENOLCK,
 //    no_message_available = 			ENODATA,
 //    no_message = 				ENOMSG,
-//    no_protocol_option = 			ENOPROTOOPT,
+      no_protocol_option = 			ENOPROTOOPT,
 #ifdef _GLIBCXX_HAVE_ENOSPC
       no_space_on_device = 			ENOSPC,
 #endif
@@ -95,26 +95,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       no_such_file_or_directory = 		ENOENT,
       no_such_process = 			ESRCH,
       not_a_directory = 			ENOTDIR,
-//    not_a_socket = 				ENOTSOCK,
+      not_a_socket = 				ENOTSOCK,
 //    not_a_stream = 				ENOSTR,
-//    not_connected = 				ENOTCONN,
+      not_connected = 				ENOTCONN,
       not_enough_memory = 			ENOMEM,
 #ifdef _GLIBCXX_HAVE_ENOTSUP
       not_supported = 				ENOTSUP,
 #endif
-//    operation_canceled = 			ECANCELED,
-//    operation_in_progress = 			EINPROGRESS,
+      operation_canceled = 			ECANCELED,
+      operation_in_progress = 			EINPROGRESS,
 #ifdef _GLIBCXX_HAVE_EPERM
       operation_not_permitted = 		EPERM,
 #endif
-//    operation_not_supported = 		EOPNOTSUPP,
+      operation_not_supported = 		EOPNOTSUPP,
 #ifdef _GLIBCXX_HAVE_EWOULDBLOCK
       operation_would_block = 			EWOULDBLOCK,
 #endif
-//    owner_dead = 				EOWNERDEAD,
+      owner_dead = 				EOWNERDEAD,
       permission_denied = 			EACCES,
-//    protocol_error = 				EPROTO,
-//    protocol_not_supported = 			EPROTONOSUPPORT,
+      protocol_error = 				EPROTO,
+      protocol_not_supported = 			EPROTONOSUPPORT,
       read_only_file_system = 			EROFS,
       resource_deadlock_would_occur = 		EDEADLK,
       resource_unavailable_try_again = 		EAGAIN,
@@ -127,13 +127,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
       too_many_files_open_in_system = 		ENFILE,
       too_many_files_open = 			EMFILE,
-      too_many_links = 				EMLINK
-//    too_many_symbolic_link_levels = 		ELOOP,
+      too_many_links = 				EMLINK,
+      too_many_symbolic_link_levels = 		ELOOP,
 #ifdef _GLIBCXX_HAVE_EOVERFLOW
-	,
-      value_too_large = 			EOVERFLOW
+      value_too_large = 			EOVERFLOW,
 #endif
-//    wrong_protocol_type = 			EPROTOTYPE
+      wrong_protocol_type = 			EPROTOTYPE
    };
 
 _GLIBCXX_END_NAMESPACE_VERSION

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-12  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12  9:17 Pointless configure checks for <errno.h> macros Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).