Skip to content

Commit 6373112

Browse files
frobtechgithub-actions[bot]
authored andcommitted
Automerge: [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.
2 parents 0cb5cb3 + 0b91d77 commit 6373112

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)