diff mbox

Fix for libstdc++-v3's error_constants.h for MinGW-W64

Message ID 20161221131112.GS895@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Dec. 21, 2016, 1:11 p.m. UTC
On 16/12/16 20:23 +0000, Jonathan Wakely wrote:
>On 16/12/16 16:28 +0300, niXman wrote:

>>Jonathan Wakely 2016-12-16 16:04:

>>

>>>I don't think this is suitable for the branches, but could be applied

>>>to trunk (as the patch was posted during stage 1, but I missed it).

>>Ok.

>>

>>>Does this require a particular version of MinGW-w64?

>>Yes, at the moment MinGW-W64 trunk is required. (MinGW-W64-v6)

>>

>>>Does it work for older versions?

>>No.

>

>OK, how about this instead then?

>

>This unconditionally enables all the error codes supported by

>mingw-w64 v5, and uses configure checks to detect the ones that are

>only available on trunk. This means it will still work for v5, but if

>you use trunk you get them all.


I'm committing this. It should work for mingw-w64 v3.0.0 and later,
but some constants are only defined for mingw-w64 trunk.

Tested x86_64-linux, committed to trunk.
diff mbox

Patch

commit 5615ca1afbe84adb8335c7b6e44b4619ceac129d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Dec 21 12:44:14 2016 +0000

    PR 71444 define more error constants for mingw-w64
    
    	PR libstdc++/71444
    	* config/os/mingw32-w64/error_constants.h
    	(address_family_not_supported, address_in_use, address_not_available)
    	(already_connected, connection_aborted, connection_already_in_progress)
    	connection_refused, connection_reset, cross_device_link)
    	(destination_address_required, host_unreachable, message_size)
    	(network_down, network_reset, network_unreachable, no_buffer_space)
    	(no_protocol_option, not_a_socket, not_connected, operation_canceled)
    	(operation_in_progress, operation_not_supported, protocol_error)
    	(protocol_not_supported, too_many_links, too_many_symbolic_link_levels)
    	(value_too_large, wrong_protocol_type): Define.
    	(bad_message, identifier_removed, no_link, no_message_available)
    	(no_message, no_stream_resources, not_a_stream, owner_dead)
    	(state_not_recoverable, stream_timeout, text_file_busy): Define
    	conditionally.
    	* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc:
    	Guard test for no_message with _GLIBCXX_HAVE_ENOMSG.

diff --git a/libstdc++-v3/config/os/mingw32-w64/error_constants.h b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
index 5cbf63c..f100373 100644
--- a/libstdc++-v3/config/os/mingw32-w64/error_constants.h
+++ b/libstdc++-v3/config/os/mingw32-w64/error_constants.h
@@ -41,22 +41,24 @@  _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,
+#ifdef _GLIBCXX_HAVE_EBADMSG
+      bad_message = 				EBADMSG,
+#endif
       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,8 +66,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       file_too_large = 				EFBIG,
       filename_too_long = 			ENAMETOOLONG,
       function_not_supported = 			ENOSYS,
-//    host_unreachable = 			EHOSTUNREACH,
-//    identifier_removed = 			EIDRM,
+      host_unreachable = 			EHOSTUNREACH,
+#ifdef _GLIBCXX_HAVE_EIDRM
+      identifier_removed = 			EIDRM,
+#endif
       illegal_byte_sequence = 			EILSEQ,
       inappropriate_io_control_operation = 	ENOTTY,
       interrupted = 				EINTR,
@@ -73,67 +77,84 @@  _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
-//    no_link = 				ENOLINK,
+#ifdef _GLIBCXX_HAVE_ENOLINK
+      no_link = 				ENOLINK,
+#endif
       no_lock_available = 			ENOLCK,
-//    no_message_available = 			ENODATA,
-//    no_message = 				ENOMSG,
-//    no_protocol_option = 			ENOPROTOOPT,
+#ifdef _GLIBCXX_HAVE_ENODATA
+      no_message_available = 			ENODATA,
+#endif
+#ifdef _GLIBCXX_HAVE_ENOMSG
+      no_message = 				ENOMSG,
+#endif
+      no_protocol_option = 			ENOPROTOOPT,
 #ifdef _GLIBCXX_HAVE_ENOSPC
       no_space_on_device = 			ENOSPC,
 #endif
-//    no_stream_resources = 			ENOSR,
+#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,
-//    not_a_stream = 				ENOSTR,
-//    not_connected = 				ENOTCONN,
+      not_a_socket = 				ENOTSOCK,
+#ifdef _GLIBCXX_HAVE_ENOSTR
+      not_a_stream = 				ENOSTR,
+#endif
+      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,
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead = 				EOWNERDEAD,
+#endif
       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,
       result_out_of_range = 			ERANGE,
-//    state_not_recoverable = 			ENOTRECOVERABLE,
-//    stream_timeout = 				ETIME,
-//    text_file_busy = 				ETXTBSY,
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+#ifdef _GLIBCXX_HAVE_ETIME
+      stream_timeout = 				ETIME,
+#endif
+#ifdef _GLIBCXX_HAVE_ETXTBSY
+      text_file_busy = 				ETXTBSY,
+#endif
 #ifdef _GLIBCXX_HAVE_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,
+      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
diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
index 636178e..20b5cce 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
@@ -82,7 +82,9 @@  void test01()
   TEST_ERRC(no_message_available);
 #endif
 
+#ifdef _GLIBCXX_HAVE_ENOMSG
   TEST_ERRC(no_message);
+#endif
   TEST_ERRC(no_protocol_option);
   TEST_ERRC(no_space_on_device);