Skip to content

Conversation

@frobtech
Copy link
Contributor

C++11 introduced noexcept, but throw() can be used in older
versions of the language.

C++11 introduced `noexcept`, but `throw()` can be used in older
versions of the language.
@frobtech frobtech marked this pull request as ready for review January 17, 2025 00:21
@llvmbot llvmbot added the libc label Jan 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 17, 2025

@llvm/pr-subscribers-libc

Author: Roland McGrath (frobtech)

Changes

C++11 introduced noexcept, but throw() can be used in older
versions of the language.


Full diff: https://github.com/llvm/llvm-project/pull/123260.diff

1 Files Affected:

  • (modified) libc/include/__llvm-libc-common.h (+4)
diff --git a/libc/include/__llvm-libc-common.h b/libc/include/__llvm-libc-common.h
index c63eb134a5e5d7..b5a23c5765f4d8 100644
--- a/libc/include/__llvm-libc-common.h
+++ b/libc/include/__llvm-libc-common.h
@@ -39,7 +39,11 @@
 #define _Thread_local thread_local
 
 #undef __NOEXCEPT
+#if __cplusplus >= 201103L
 #define __NOEXCEPT noexcept
+#else
+#define __NOEXCEPT throw()
+#endif
 
 #else // not __cplusplus
 

@frobtech frobtech merged commit a4e87da into llvm:main Jan 17, 2025
15 checks passed
@frobtech frobtech deleted the p/libc-noexcept-pre11 branch January 17, 2025 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants