[Bug libstdc++/104883] <system_error> should define all std::errc enumerators
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 22 10:47:17 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104883
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
>From PR 1007008 comment 2:
-- >8 --
We could do something like this for each enumerator:
#ifdef EFOO
foo = EFOO,
#else
foo = _GLIBCXX_ERRC_ORIGIN + __LINE__,
#endif
Where _GLIBCXX_ERRC_ORIGIN is some value intended to be higher than the highest
errno value on the OS. We only need fewer than 100 errc enumerators so
INT_MAX/2 might be OK.
We can use #line to set the __LINE__ to a fixed value in the file, so that the
constants don't change if we add/remove lines before the errc definition.
-- >8 --
We can use a default _GLIBCXX_ERRC_ORIGIN value, and allow it to be overridden
in config/os/*/os_defines.h if the default doesn't work.
More information about the Gcc-bugs
mailing list