Date: Mon, 29 Dec 2025 23:48:57 +0000 From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Lexi Winter <lexi@le-Fay.ORG> Subject: git: cd2a65a60701 - stable/13 - sys/cdefs.h: add __noexcept and __noexcept_if Message-ID: <69531369.255c8.54a75166@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2a65a60701d806e8ebbf97b6c77c880e0c9746 commit cd2a65a60701d806e8ebbf97b6c77c880e0c9746 Author: Lexi Winter <ivy@FreeBSD.org> AuthorDate: 2024-02-02 16:41:40 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2025-12-29 23:46:45 +0000 sys/cdefs.h: add __noexcept and __noexcept_if These macros provide the C++11 noexcept and noexcept(...) keywords if we're compiling in a C++11 environment. Otherwise, they expand to an empty string. This will be used to add the required noexcept specifier to several libc functions as required in C++11. MFC after: 2 weeks Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1085 (cherry picked from commit 02b0d4b688cc4deb14cb6e7534a2a4958e48b753) --- sys/sys/cdefs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 8fd07ce85a05..96a3742c4a1d 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -394,6 +394,17 @@ #endif #endif +/* + * noexcept keyword added in C++11. + */ +#if defined(__cplusplus) && __cplusplus >= 201103L +#define __noexcept noexcept +#define __noexcept_if(__c) noexcept(__c) +#else +#define __noexcept +#define __noexcept_if(__c) +#endif + /* * nodiscard attribute added in C++17 and C23, but supported by both LLVM and * GCC in earlier language versions, so we use __has_c{,pp}_attribute to testhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69531369.255c8.54a75166>
