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

Consistent with glibc headers, where `noexcept` is used in C++
(or `throw()` in older C++ which llvm-libc doesn't support) in
the public function declarations, `__attribute__((__nothrow__))` is
used in C for compilers that support it.
This commit is contained in:
Roland McGrath
2024-12-17 12:18:37 -08:00
committed by GitHub
parent a957cedea9
commit 0b91d77bf4

View File

@@ -53,7 +53,11 @@
#define __restrict restrict // C99 and above support the restrict keyword.
#undef __NOEXCEPT
#ifdef __GNUC__
#define __NOEXCEPT __attribute__((__nothrow__))
#else
#define __NOEXCEPT
#endif
#endif // __cplusplus