477897451e
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. |
||
---|---|---|
.. | ||
17_intro | ||
18_support | ||
19_diagnostics | ||
20_util | ||
21_strings | ||
22_locale | ||
23_containers | ||
24_iterators | ||
25_algorithms | ||
26_numerics | ||
27_io | ||
28_regex | ||
29_atomics | ||
30_threads | ||
abi | ||
backward | ||
config | ||
data | ||
decimal | ||
experimental | ||
ext | ||
lib | ||
libstdc++-abi | ||
libstdc++-dg | ||
libstdc++-prettyprinters | ||
libstdc++-xmethods | ||
performance | ||
special_functions | ||
std | ||
tr1 | ||
tr2 | ||
util | ||
Makefile.am | ||
Makefile.in |