https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127342

--- Comment #2 from Madison Steiner <awsmadi at amazon dot com> ---
Created attachment 65571
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65571&action=edit
libstdc++: map Winsock error codes in system_category()

Patch attached.

It adds 33 guarded case labels to the Windows arm of
system_error_category::default_error_condition, mapping the WSAE* codes that
have an unambiguous errc counterpart. 31 are the set Microsoft's STL maps in
_Win_errtab; WSAELOOP and WSAENOTEMPTY are also included because Cygwin's
wsock_errmap[] maps them and the counterparts are exact. Every case is guarded
on its errno macro, since config/os/mingw32/error_constants.h does not declare
23 of these values.

WSAECANCELLED is deliberately left unmapped. Windows reports it and
WSA_E_CANCELLED with identical text naming WSALookupServiceEnd, so it is a
name-resolution cancellation rather than errc::operation_canceled, and neither
Cygwin nor Microsoft maps either spelling. The reason is recorded in a source
comment so it does not read as an oversight.

Testing, stated precisely:

- The modified testsuite file was cross-compiled for x86_64-w64-mingw32 with
  gcc 15.3.0 and run on Windows 11 (build 26100) against both a patched and an
  unpatched libstdc++. It aborts at the first new assertion without the patch
  and passes with it, so the new coverage is a real regression test.
- The patched tree builds natively on x86_64-linux, which exercises the
  non-Windows arm of the same switch.
- I have NOT run a dejagnu regtest. The change is entirely inside
  #if defined(_WIN32) && !defined(__CYGWIN__), so a native testsuite run
  exercises none of the new cases; I would rather say so than imply coverage
  that does not exist. Happy to run whatever a maintainer would like to see.

Not yet posted to gcc-patches@; I am not subscribed. As a first-time
contributor I would need someone to commit it if it is accepted.

Reply via email to