[Bug libstdc++/93151] system_error header fails to compile with -D_XOPEN_SOURCE=600
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon May 9 16:40:27 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93151
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:4b5211c85aed64c7f6034dad8f57e03c0302c5ec
commit r9-10061-g4b5211c85aed64c7f6034dad8f57e03c0302c5ec
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Dec 15 20:28:11 2020 +0000
libstdc++: Test errno macros directly, not via autoconf [PR 93151]
This fixes a bug caused by a mismatch between the macros defined by
<errno.h> when GCC is built and the macros defined by <errno.h> when
users include <system_error>. If the user code is compiled with
_XOPEN_SOURCE defined to 500 or 600, Darwin suppresses the
ENOTRECOVERABLE and EOWNERDEAD macros, which are not defined by SUSv3
(aka POSIX.1-2001).
Since POSIX requires the errno macros to be macros (and not variables or
enumerators) we can just test for them directly using the preprocessor.
That means that <system_error> will match what is actually defined when
it's included, not what was defined when GCC was built. With that change
there is no need for the GLIBCXX_CHECK_SYSTEM_ERROR configure checks and
they can be removed.
libstdc++-v3/ChangeLog:
PR libstdc++/93151
* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Remove.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac (GLIBCXX_CHECK_SYSTEM_ERROR): Do not use.
* config/os/generic/error_constants.h: Test POSIX errno macros
directly, instead of corresponding _GLIBCXX_HAVE_EXXX macros.
* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc:
Likewise.
* testsuite/19_diagnostics/headers/system_error/93151.cc: New
test.
(cherry picked from commit a2c2eec183acf25c9b214fa0827718e4d2fdfc93)
More information about the Gcc-bugs
mailing list