[libc-commits] [libc] [libc] Use __attribute__((__nothrow__)) for __NOEXCEPT in C (PR #114653)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Nov 4 09:51:15 PST 2024


================
@@ -47,7 +47,14 @@
 #define __restrict restrict // C99 and above support the restrict keyword.
 
 #undef __NOEXCEPT
+#if defined(__has_attribute)
+#if __has_attribute(__nothrow__)
----------------
nickdesaulniers wrote:

We really don't need to be wrapping the use of this attribute in __has_attribute checks (and checks for __has_attribute).  __has_attribute has been available since GCC 5 and prehistoric versions of clang.  Example: https://godbolt.org/z/vxo4Tq9KK

If our minimum supported compiler versions support these features, then wrapping them in checks upon checks is unnecessary noise in the sources. Please remove them.

https://github.com/llvm/llvm-project/pull/114653


More information about the libc-commits mailing list