[PATCH] Define __THROW to noexcept for C++11 and later

Andreas Schwab schwab@linux-m68k.org
Tue Sep 22 13:34:58 GMT 2020


On Sep 22 2020, Jonathan Wakely via Libc-alpha wrote:

> 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.
>
> Built and tested successfully with "make check" on
> x86_64-pc-linux-gnu.

Ok.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list