[Bug libstdc++/107008] New: Combine config/os/*/error_constants.h into one file
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 22 10:33:51 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107008
Bug ID: 107008
Summary: Combine config/os/*/error_constants.h into one file
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
There's no reason to have multiple files and select one for the target:
config/os/djgpp/error_constants.h
config/os/generic/error_constants.h
config/os/mingw32-w64/error_constants.h
config/os/mingw32/error_constants.h
We can just ensure the generic one has a #ifdef for every errno macro that
isn't present on all targets, and use that everywhere.
Once we only have one error_constants.h file for all targets, we can also make
it work for freestanding like so:
#if _GLIBCXX_HOSTED
#include <cerrno>
namespace std {
enum class errc
{
address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE,
// ...
};
}
#else
namespace std {
// For freestanding we have no <errno.h> but also no errors from the OS,
// so we can just make up our own values for the library's purposes.
enum class errc
{
address_family_not_supported = 1,
address_in_use,
// ...
};
}
#endif
This will allow a freestanding <charconv> to use std::errc.
More information about the Gcc-bugs
mailing list