Skip to content

Implement LWG-3598 system_category().default_error_condition(0) - #2560

Merged
Stephan T. Lavavej (StephanTLavavej) merged 6 commits into
microsoft:mainfrom
fsb4000:fix2552
Feb 18, 2022
Merged

Stephan T. Lavavej (StephanTLavavej) merged 6 commits into
microsoft:mainfrom
fsb4000:fix2552

Conversation

@fsb4000

@fsb4000 Igor Zhukov (fsb4000) commented Feb 11, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #2552

Should I add a reminder for moving the fix to syserror.cpp when we will be able to modify the file?

cond.message() == "Операция успешно завершена." on my PC.

it's definitely something else on your PC so I decided to test with != the fallback.

@fsb4000
Igor Zhukov (fsb4000) requested a review from a team as a code owner February 11, 2022 13:38
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added the LWG Library Working Group issue label Feb 11, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Should I add a reminder for moving the fix to syserror.cpp when we will be able to modify the file?

I think that a TRANSITION comment, a followup issue, or both, would be appropriate.

@fsb4000

Igor Zhukov (fsb4000) commented Feb 11, 2022 •

Copy link
Copy Markdown
Contributor Author

I looked at

STL/stl/src/syserror.cpp

Lines 113 to 194 in bbd5dba

constexpr _Sys_errtab_t _Sys_errtab[] = {
// table of Posix code/name pairs
{errc::address_family_not_supported, "address family not supported"},
{errc::address_in_use, "address in use"},
{errc::address_not_available, "address not available"},
{errc::already_connected, "already connected"},
{errc::argument_list_too_long, "argument list too long"},
{errc::argument_out_of_domain, "argument out of domain"},
{errc::bad_address, "bad address"},
{errc::bad_file_descriptor, "bad file descriptor"},
{errc::bad_message, "bad message"},
{errc::broken_pipe, "broken pipe"},
{errc::connection_aborted, "connection aborted"},
{errc::connection_already_in_progress, "connection already in progress"},
{errc::connection_refused, "connection refused"},
{errc::connection_reset, "connection reset"},
{errc::cross_device_link, "cross device link"},
{errc::destination_address_required, "destination address required"},
{errc::device_or_resource_busy, "device or resource busy"},
{errc::directory_not_empty, "directory not empty"},
{errc::executable_format_error, "executable format error"},
{errc::file_exists, "file exists"},
{errc::file_too_large, "file too large"},
{errc::filename_too_long, "filename too long"},
{errc::function_not_supported, "function not supported"},
{errc::host_unreachable, "host unreachable"},
{errc::identifier_removed, "identifier removed"},
{errc::illegal_byte_sequence, "illegal byte sequence"},
{errc::inappropriate_io_control_operation, "inappropriate io control operation"},
{errc::interrupted, "interrupted"},
{errc::invalid_argument, "invalid argument"},
{errc::invalid_seek, "invalid seek"},
{errc::io_error, "io error"},
{errc::is_a_directory, "is a directory"},
{errc::message_size, "message size"},
{errc::network_down, "network down"},
{errc::network_reset, "network reset"},
{errc::network_unreachable, "network unreachable"},
{errc::no_buffer_space, "no buffer space"},
{errc::no_child_process, "no child process"},
{errc::no_link, "no link"},
{errc::no_lock_available, "no lock available"},
{errc::no_message_available, "no message available"},
{errc::no_message, "no message"},
{errc::no_protocol_option, "no protocol option"},
{errc::no_space_on_device, "no space on device"},
{errc::no_stream_resources, "no stream resources"},
{errc::no_such_device_or_address, "no such device or address"},
{errc::no_such_device, "no such device"},
{errc::no_such_file_or_directory, "no such file or directory"},
{errc::no_such_process, "no such process"},
{errc::not_a_directory, "not a directory"},
{errc::not_a_socket, "not a socket"},
{errc::not_a_stream, "not a stream"},
{errc::not_connected, "not connected"},
{errc::not_enough_memory, "not enough memory"},
{errc::not_supported, "not supported"},
{errc::operation_canceled, "operation canceled"},
{errc::operation_in_progress, "operation in progress"},
{errc::operation_not_permitted, "operation not permitted"},
{errc::operation_not_supported, "operation not supported"},
{errc::operation_would_block, "operation would block"},
{errc::owner_dead, "owner dead"},
{errc::permission_denied, "permission denied"},
{errc::protocol_error, "protocol error"},
{errc::protocol_not_supported, "protocol not supported"},
{errc::read_only_file_system, "read only file system"},
{errc::resource_deadlock_would_occur, "resource deadlock would occur"},
{errc::resource_unavailable_try_again, "resource unavailable try again"},
{errc::result_out_of_range, "result out of range"},
{errc::state_not_recoverable, "state not recoverable"},
{errc::stream_timeout, "stream timeout"},
{errc::text_file_busy, "text file busy"},
{errc::timed_out, "timed out"},
{errc::too_many_files_open_in_system, "too many files open in system"},
{errc::too_many_files_open, "too many files open"},
{errc::too_many_links, "too many links"},
{errc::too_many_symbolic_link_levels, "too many symbolic link levels"},
{errc::value_too_large, "value too large"},
{errc::wrong_protocol_type, "wrong protocol type"},
};
} // unnamed namespace

and it seems generic error messages don't depend on locale. (while system error messages do)

Comment thread stl/inc/system_error
Comment thread tests/std/tests/Dev11_0493504_error_category_lifetime/test.cpp
@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. (I'll handle verifying that this works with the recent LLVM update.)

Stephan T. Lavavej (StephanTLavavej) added a commit to StephanTLavavej/STL that referenced this pull request Feb 17, 2022
@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 202e42a into microsoft:main Feb 18, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Success! Thanks for implementing this LWG issue 😻 🎉 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LWG Library Working Group issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LWG-3598 system_category().default_error_condition(0) is underspecified

3 participants