Define __THROW to noexcept for C++11 and later
authorJonathan Wakely <jwakely@redhat.com>
Tue, 22 Sep 2020 10:54:38 +0000 (11:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 22 Sep 2020 10:54:38 +0000 (11:54 +0100)
commitd445d9ca8d961148ffde8ec597ecc0e050542024
tree05ab85b8d8a52d7c1b3c2f054a1601ea67eeefb2
parentcdf645427d176197b82f44308a5e131d69fb53ad
Define __THROW to noexcept for C++11 and later

The __THROW macro and friends expand to "throw ()" for C++ code, but
that syntax is deprecated in C++11 and no longer supported at all since
C++20. In order for glibc headers to be compatible with C++20,
"noexcept" should be used instead.

This patch uses "noexcept (true)" rather than just "noexcept", which is
semantically equivalent, but avoids any possibility of parsing
ambiguities if the next preprocessor token happens to be an opening
parenthesis. This is probably unnecessary, but it seems safer to be
cautious.
misc/sys/cdefs.h