[llvm-branch-commits] [libcxx] release/18.x: [libc++] Only include <setjmp.h> from the C library if it exists (#81887) (PR #82045)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 16 13:52:07 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: None (llvmbot)
<details>
<summary>Changes</summary>
Backport d8278b6
Requested by: @<!-- -->ldionne
---
Full diff: https://github.com/llvm/llvm-project/pull/82045.diff
1 Files Affected:
- (modified) libcxx/include/csetjmp (+7-1)
``````````diff
diff --git a/libcxx/include/csetjmp b/libcxx/include/csetjmp
index d219c8e6cb2250..9012cad22ebe74 100644
--- a/libcxx/include/csetjmp
+++ b/libcxx/include/csetjmp
@@ -33,7 +33,13 @@ void longjmp(jmp_buf env, int val);
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
-#include <setjmp.h>
+// <setjmp.h> is not provided by libc++
+#if __has_include(<setjmp.h>)
+# include <setjmp.h>
+# ifdef _LIBCPP_SETJMP_H
+# error "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
+# endif
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
``````````
</details>
https://github.com/llvm/llvm-project/pull/82045
More information about the llvm-branch-commits
mailing list