Skip to content

Commit 0b91d77

Browse files
authored
[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.
1 parent a957ced commit 0b91d77

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libc/include/__llvm-libc-common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353
#define __restrict restrict // C99 and above support the restrict keyword.
5454

5555
#undef __NOEXCEPT
56+
#ifdef __GNUC__
57+
#define __NOEXCEPT __attribute__((__nothrow__))
58+
#else
5659
#define __NOEXCEPT
60+
#endif
5761

5862
#endif // __cplusplus
5963

0 commit comments

Comments
 (0)