diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td --- a/libc/config/linux/api.td +++ b/libc/config/linux/api.td @@ -18,7 +18,7 @@ #ifdef __cplusplus extern "C" #endif - _Noreturn void __assert_fail(const char *, const char *, unsigned, const char *); + _Noreturn void __assert_fail(const char *, const char *, unsigned, const char *) _Noexcept; #define assert(e) \ ((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__)) diff --git a/libc/include/__llvm-libc-common.h b/libc/include/__llvm-libc-common.h --- a/libc/include/__llvm-libc-common.h +++ b/libc/include/__llvm-libc-common.h @@ -32,6 +32,9 @@ #undef _Thread_local #define _Thread_local thread_local +#undef _Noexcept +#define _Noexcept noexcept + #else // not __cplusplus #undef __BEGIN_C_DECLS @@ -43,6 +46,9 @@ #undef __restrict #define __restrict restrict // C99 and above support the restrict keyword. +#undef _Noexcept +#define _Noexcept + #endif // __cplusplus #endif // LLVM_LIBC___COMMON_H diff --git a/libc/test/src/time/gmtime_test.cpp b/libc/test/src/time/gmtime_test.cpp --- a/libc/test/src/time/gmtime_test.cpp +++ b/libc/test/src/time/gmtime_test.cpp @@ -14,7 +14,6 @@ #include #include -#include using __llvm_libc::testing::ErrnoSetterMatcher::Fails; using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; diff --git a/libc/test/src/time/mktime_test.cpp b/libc/test/src/time/mktime_test.cpp --- a/libc/test/src/time/mktime_test.cpp +++ b/libc/test/src/time/mktime_test.cpp @@ -15,7 +15,6 @@ #include #include -#include using __llvm_libc::testing::ErrnoSetterMatcher::Fails; using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; diff --git a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp --- a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp +++ b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp @@ -81,7 +81,7 @@ if (i < size - 1) OS << ", "; } - OS << "), decltype(" << entrypoint << ")>, "; + OS << ") _Noexcept, decltype(" << entrypoint << ")>, "; OS << '"' << entrypoint << " prototype in TableGen does not match public header" << '"'; OS << ");\n"; @@ -93,9 +93,9 @@ // We provide dummy malloc and free implementations to support the case // when LLVM libc does to include them. - OS << "void *malloc(size_t) { return nullptr; }\n"; - OS << "void *realloc(void *, size_t) { return nullptr; }\n"; - OS << "void free(void *) {}\n"; + OS << "void *malloc(size_t) _Noexcept { return nullptr; }\n"; + OS << "void *realloc(void *, size_t) _Noexcept { return nullptr; }\n"; + OS << "void free(void *) _Noexcept {}\n"; return false; } diff --git a/libc/utils/HdrGen/PublicAPICommand.cpp b/libc/utils/HdrGen/PublicAPICommand.cpp --- a/libc/utils/HdrGen/PublicAPICommand.cpp +++ b/libc/utils/HdrGen/PublicAPICommand.cpp @@ -112,7 +112,7 @@ OS << ", "; } - OS << ");\n\n"; + OS << ") _Noexcept;\n\n"; } // Make another pass over entrypoints to emit object declarations.