]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Test errno macros directly, not via autoconf [PR 93151]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 15 Dec 2020 20:28:11 +0000 (20:28 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 16 Dec 2020 13:36:02 +0000 (13:36 +0000)
commita2c2eec183acf25c9b214fa0827718e4d2fdfc93
tree6abf0adcdf1e9cd7ce97ca53e543ebb3a2674834
parent4d8476b05d7f9707e36f1aaa94a8ba02eed2955f
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 actuallydefined 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.
* configure.ac: Regenerate.
* 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.
libstdc++-v3/acinclude.m4
libstdc++-v3/config/os/generic/error_constants.h
libstdc++-v3/configure.ac
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/93151.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc