diff options
author | Sven Linker <sven.linker@kernkonzept.com> | 2024-07-09 10:03:59 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-07-09 14:01:11 +0200 |
commit | 9827836ce5c6cf648a37202f7d5eb73af1667466 (patch) | |
tree | ed5d81adb9be8fa268c97b5b1c813c7ba0317702 | |
parent | 20ad89de9124db4178c8f41a097700f1923b1f58 (diff) |
c++: Remove deprecated dynamic exception specification
Dynamic exception specification using `throw()` is deprecated since
C++11 and removed in C++17. This change replaces `throw()` with
`noexcept` when compiling for newer standards.
Co-authored-by: Sven Linker <sven.linker@kernkonzept.com>
Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
-rw-r--r-- | include/sys/cdefs.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 5c4daebcd..9b3a02177 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -58,9 +58,15 @@ # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # else # if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# define __THROWNL throw () -# define __NTH(fct) __LEAF_ATTR fct throw () +/* Dynamic exception specification is deprecated since C++11, so + we only use it when compiling for an earlier standard. */ +# if __cplusplus < 201103UL +# define __THROW throw () +# else +# define __THROW noexcept +# endif +# define __THROWNL __THROW +# define __NTH(fct) __LEAF_ATTR fct __THROW # else # define __THROW # define __THROWNL |