Skip to content

release/18.x: [libc++] Only include <setjmp.h> from the C library if it exists (#81887) #82045

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Feb 16, 2024

Backport d8278b6

Requested by: @ldionne

@llvmbot llvmbot requested a review from a team as a code owner February 16, 2024 21:51
@llvmbot llvmbot added this to the LLVM 18.X Release milestone Feb 16, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Feb 16, 2024

@mordante What do you think about merging this PR to the release branch?

@llvmbot llvmbot requested a review from mordante February 16, 2024 21:51
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Feb 16, 2024
@llvmbot
Copy link
Member Author

llvmbot commented Feb 16, 2024

@llvm/pr-subscribers-libcxx

Author: None (llvmbot)

Changes

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 --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

Copy link
Member

@mordante mordante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the Buildkite failures are due to the known Windows bot issues.

@tstellar
Copy link
Collaborator

One of these libc++ tests keeps failing. Is this a real failure?

…m#81887)

In 2cea1ba, we removed the <setjmp.h> header provided by libc++. However, we did not conditionally include the underlying <setjmp.h>
header only if the C library provides one, which we otherwise do consistently (see e.g. 647ddc0).

rdar://122978778
(cherry picked from commit d8278b6)
@tstellar tstellar merged commit 9c434b4 into llvm:release/18.x Feb 23, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
Development

Successfully merging this pull request may close these issues.

4 participants