gcc/libstdc++-v3/testsuite
Jonathan Wakely 477897451e libstdc++: Make std::system_category() recognize Windows error codes
The std::system_category error category should be used for
system-specific error codes, which means on Windows it should be used
for Windows error codes.  Currently that category assumes that the error
numbers it deals with are errno numbers, which means that
ERROR_ACCESS_DENIED (which has value 0x5) gets treated as whichever
errno number happens to have that value (EIO on mingw32-w64).

This adds a mapping from known Windows error codes to generic errno
ones. This means we correctly treat ERROR_ACCESS_DENIED as corresponding
to EACCES.

Also make std::system_category().message(int) return the right message
for Windows errors, by using FormatMessage instead of strerror. The
output of FormatMessage includes ".\r\n" at the end, so we strip that
off to allow the message to be used in contexts where that would be
problematic.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* src/c++11/system_error.cc (system_error_category) [_WIN32]:
	Map Windows error codes to generic POSIX error numbers. Use
	FormatMessage instead of strerror.
	* testsuite/19_diagnostics/error_category/system_category.cc:
	Adjust for new behaviour on Windows.
2021-09-23 16:07:39 +01:00
..
17_intro libstdc++: Fix 17_intro/names.cc failures on Solaris 2021-08-31 14:17:53 +01:00
18_support libstdc++: Add [[nodiscard]] to <compare> 2021-08-05 15:16:58 +01:00
19_diagnostics libstdc++: Make std::system_category() recognize Windows error codes 2021-09-23 16:07:39 +01:00
20_util libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270] 2021-09-17 20:43:34 +01:00
21_strings libstdc++: Add [[nodiscard]] to iterators and related utilities 2021-08-04 12:54:28 +01:00
22_locale
23_containers libstdc++: Add valid range checks to std::span constructors [PR98421] 2021-08-31 19:13:55 +01:00
24_iterators libstdc++: Add [[nodiscard]] to iterators and related utilities 2021-08-04 12:54:28 +01:00
25_algorithms libstdc++: Fix dg-prune-output assertion message 2021-08-08 19:12:22 +02:00
26_numerics libstdc++: Rename tests with incorrect extension 2021-09-17 12:40:41 +01:00
27_io libstdc++: Rename tests with incorrect extension 2021-09-17 12:40:41 +01:00
28_regex libstdc++: Add [[nodiscard]] to iterators and related utilities 2021-08-04 12:54:28 +01:00
29_atomics libstdc++: Fix UB in atomic_ref/wait_notify.cc [PR101761] 2021-09-16 14:48:17 -07:00
30_threads c++: limit instantiation with ill-formed class [PR96286] 2021-08-30 17:25:21 -04:00
abi
backward
config
data
decimal
experimental libstdc++: Use "test.invalid." for invalid hostname 2021-09-10 15:10:21 +01:00
ext libstdc++: Increase timeout factor for slow pb_ds tests 2021-09-16 23:06:38 +01:00
lib libstdc++: Avoid illegal argument to verbose in dg-test callback, continued 2021-08-17 21:05:27 +02:00
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters libstdc++: Fix vector<bool> printer tests to work in debug mode 2021-08-18 14:26:38 +01:00
libstdc++-xmethods
performance
special_functions
std libstdc++: Add default template argument to basic_istream_view 2021-08-23 16:17:10 +01:00
tr1
tr2
util libstdc++: Fix last std::tuple constructor missing 'constexpr' [PR102270] 2021-09-17 20:43:34 +01:00
Makefile.am
Makefile.in