Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement LWG-3869 Deprecate std::errc constants related to UNIX STREAMS #3487

Merged
merged 4 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 78 additions & 78 deletions stl/inc/xerrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,84 +18,84 @@ _STL_DISABLE_CLANG_WARNINGS

_STD_BEGIN
_EXPORT_STD enum class errc { // names for generic error codes
address_family_not_supported = 102, // EAFNOSUPPORT
address_in_use = 100, // EADDRINUSE
address_not_available = 101, // EADDRNOTAVAIL
already_connected = 113, // EISCONN
argument_list_too_long = 7, // E2BIG
argument_out_of_domain = 33, // EDOM
bad_address = 14, // EFAULT
bad_file_descriptor = 9, // EBADF
bad_message = 104, // EBADMSG
broken_pipe = 32, // EPIPE
connection_aborted = 106, // ECONNABORTED
connection_already_in_progress = 103, // EALREADY
connection_refused = 107, // ECONNREFUSED
connection_reset = 108, // ECONNRESET
cross_device_link = 18, // EXDEV
destination_address_required = 109, // EDESTADDRREQ
device_or_resource_busy = 16, // EBUSY
directory_not_empty = 41, // ENOTEMPTY
executable_format_error = 8, // ENOEXEC
file_exists = 17, // EEXIST
file_too_large = 27, // EFBIG
filename_too_long = 38, // ENAMETOOLONG
function_not_supported = 40, // ENOSYS
host_unreachable = 110, // EHOSTUNREACH
identifier_removed = 111, // EIDRM
illegal_byte_sequence = 42, // EILSEQ
inappropriate_io_control_operation = 25, // ENOTTY
interrupted = 4, // EINTR
invalid_argument = 22, // EINVAL
invalid_seek = 29, // ESPIPE
io_error = 5, // EIO
is_a_directory = 21, // EISDIR
message_size = 115, // EMSGSIZE
network_down = 116, // ENETDOWN
network_reset = 117, // ENETRESET
network_unreachable = 118, // ENETUNREACH
no_buffer_space = 119, // ENOBUFS
no_child_process = 10, // ECHILD
no_link = 121, // ENOLINK
no_lock_available = 39, // ENOLCK
no_message_available = 120, // ENODATA
no_message = 122, // ENOMSG
no_protocol_option = 123, // ENOPROTOOPT
no_space_on_device = 28, // ENOSPC
no_stream_resources = 124, // ENOSR
no_such_device_or_address = 6, // ENXIO
no_such_device = 19, // ENODEV
no_such_file_or_directory = 2, // ENOENT
no_such_process = 3, // ESRCH
not_a_directory = 20, // ENOTDIR
not_a_socket = 128, // ENOTSOCK
not_a_stream = 125, // ENOSTR
not_connected = 126, // ENOTCONN
not_enough_memory = 12, // ENOMEM
not_supported = 129, // ENOTSUP
operation_canceled = 105, // ECANCELED
operation_in_progress = 112, // EINPROGRESS
operation_not_permitted = 1, // EPERM
operation_not_supported = 130, // EOPNOTSUPP
operation_would_block = 140, // EWOULDBLOCK
owner_dead = 133, // EOWNERDEAD
permission_denied = 13, // EACCES
protocol_error = 134, // EPROTO
protocol_not_supported = 135, // EPROTONOSUPPORT
read_only_file_system = 30, // EROFS
resource_deadlock_would_occur = 36, // EDEADLK
resource_unavailable_try_again = 11, // EAGAIN
result_out_of_range = 34, // ERANGE
state_not_recoverable = 127, // ENOTRECOVERABLE
stream_timeout = 137, // ETIME
text_file_busy = 139, // ETXTBSY
timed_out = 138, // ETIMEDOUT
too_many_files_open_in_system = 23, // ENFILE
too_many_files_open = 24, // EMFILE
too_many_links = 31, // EMLINK
too_many_symbolic_link_levels = 114, // ELOOP
value_too_large = 132, // EOVERFLOW
wrong_protocol_type = 136 // EPROTOTYPE
address_family_not_supported = 102, // EAFNOSUPPORT
address_in_use = 100, // EADDRINUSE
address_not_available = 101, // EADDRNOTAVAIL
already_connected = 113, // EISCONN
argument_list_too_long = 7, // E2BIG
argument_out_of_domain = 33, // EDOM
bad_address = 14, // EFAULT
bad_file_descriptor = 9, // EBADF
bad_message = 104, // EBADMSG
broken_pipe = 32, // EPIPE
connection_aborted = 106, // ECONNABORTED
connection_already_in_progress = 103, // EALREADY
connection_refused = 107, // ECONNREFUSED
connection_reset = 108, // ECONNRESET
cross_device_link = 18, // EXDEV
destination_address_required = 109, // EDESTADDRREQ
device_or_resource_busy = 16, // EBUSY
directory_not_empty = 41, // ENOTEMPTY
executable_format_error = 8, // ENOEXEC
file_exists = 17, // EEXIST
file_too_large = 27, // EFBIG
filename_too_long = 38, // ENAMETOOLONG
function_not_supported = 40, // ENOSYS
host_unreachable = 110, // EHOSTUNREACH
identifier_removed = 111, // EIDRM
illegal_byte_sequence = 42, // EILSEQ
inappropriate_io_control_operation = 25, // ENOTTY
interrupted = 4, // EINTR
invalid_argument = 22, // EINVAL
invalid_seek = 29, // ESPIPE
io_error = 5, // EIO
is_a_directory = 21, // EISDIR
message_size = 115, // EMSGSIZE
network_down = 116, // ENETDOWN
network_reset = 117, // ENETRESET
network_unreachable = 118, // ENETUNREACH
no_buffer_space = 119, // ENOBUFS
no_child_process = 10, // ECHILD
no_link = 121, // ENOLINK
no_lock_available = 39, // ENOLCK
no_message_available _CXX23_DEPRECATE_UNIX_STREAMS = 120, // ENODATA
no_message = 122, // ENOMSG
no_protocol_option = 123, // ENOPROTOOPT
no_space_on_device = 28, // ENOSPC
no_stream_resources _CXX23_DEPRECATE_UNIX_STREAMS = 124, // ENOSR
no_such_device_or_address = 6, // ENXIO
no_such_device = 19, // ENODEV
no_such_file_or_directory = 2, // ENOENT
no_such_process = 3, // ESRCH
not_a_directory = 20, // ENOTDIR
not_a_socket = 128, // ENOTSOCK
not_a_stream _CXX23_DEPRECATE_UNIX_STREAMS = 125, // ENOSTR
not_connected = 126, // ENOTCONN
not_enough_memory = 12, // ENOMEM
not_supported = 129, // ENOTSUP
operation_canceled = 105, // ECANCELED
operation_in_progress = 112, // EINPROGRESS
operation_not_permitted = 1, // EPERM
operation_not_supported = 130, // EOPNOTSUPP
operation_would_block = 140, // EWOULDBLOCK
owner_dead = 133, // EOWNERDEAD
permission_denied = 13, // EACCES
protocol_error = 134, // EPROTO
protocol_not_supported = 135, // EPROTONOSUPPORT
read_only_file_system = 30, // EROFS
resource_deadlock_would_occur = 36, // EDEADLK
resource_unavailable_try_again = 11, // EAGAIN
result_out_of_range = 34, // ERANGE
state_not_recoverable = 127, // ENOTRECOVERABLE
stream_timeout _CXX23_DEPRECATE_UNIX_STREAMS = 137, // ETIME
text_file_busy = 139, // ETXTBSY
timed_out = 138, // ETIMEDOUT
too_many_files_open_in_system = 23, // ENFILE
too_many_files_open = 24, // EMFILE
too_many_links = 31, // EMLINK
too_many_symbolic_link_levels = 114, // ELOOP
value_too_large = 132, // EOVERFLOW
wrong_protocol_type = 136 // EPROTOTYPE
};

_STD_END
Expand Down
21 changes: 19 additions & 2 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@
// P1223R5 ranges::find_last, ranges::find_last_if, ranges::find_last_if_not
// P1272R4 byteswap()
// P1328R1 constexpr type_info::operator==()
// P1413R3 Deprecate aligned_storage And aligned_union
// P1425R4 Iterator Pair Constructors For stack And queue
// P1659R3 ranges::starts_with, ranges::ends_with
// P1679R3 contains() For basic_string/basic_string_view
Expand Down Expand Up @@ -353,6 +352,10 @@
// P2549R1 unexpected<E>::error()
// P2602R2 Poison Pills Are Too Toxic

// _HAS_CXX23 and _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS control:
// P1413R3 Deprecate aligned_storage And aligned_union
// Other C++23 deprecation warnings

// Parallel Algorithms Notes
// C++ allows an implementation to implement parallel algorithms as calls to the serial algorithms.
// This implementation parallelizes several common algorithm calls, but not all.
Expand Down Expand Up @@ -1403,7 +1406,21 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect

// STL4040 is used to warn that "The contents of <any> require static RTTI."

// next warning number: STL4041
#if _HAS_CXX23 && !defined(_SILENCE_CXX23_UNIX_STREAMS_DEPRECATION_WARNING) \
&& !defined(_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS)
#define _CXX23_DEPRECATE_UNIX_STREAMS \
[[deprecated( \
"warning STL4041: " \
"std::errc enumerators std::errc::no_message_available, std::errc::no_stream_resources, " \
"std::errc::not_a_stream, and std::errc::stream_timeout and their corresponding errno macros ENODATA, ENOSR, " \
"ENOSTR, and ETIME are deprecated in C++23 by LWG-3869. These errno macros are deprecated in POSIX 2008 and " \
"removed in POSIX 202x. You can define _SILENCE_CXX23_UNIX_STREAMS_DEPRECATION_WARNING or " \
"_SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to suppress this warning.")]]
#else // ^^^ warning enabled / warning disabled vvv
#define _CXX23_DEPRECATE_UNIX_STREAMS
#endif // ^^^ warning disabled ^^^

// next warning number: STL4042

// next error number: STL1006

Expand Down
2 changes: 2 additions & 0 deletions stl/src/syserror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

// system_error message mapping

#define _SILENCE_CXX23_UNIX_STREAMS_DEPRECATION_WARNING

#include <algorithm>
#include <functional>
#include <system_error>
Expand Down
2 changes: 2 additions & 0 deletions tests/tr1/tests/system_error/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// test <system_error>
#define TEST_NAME "<system_error>"

#define _SILENCE_CXX23_UNIX_STREAMS_DEPRECATION_WARNING

#include "tdefs.h"
#include <stdexcept>
#include <system_error>
Expand Down