Skip to content

Commit

Permalink
[libc++] Only include <setjmp.h> from the C library if it exists (#81887
Browse files Browse the repository at this point in the history
)

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)
  • Loading branch information
ldionne authored and tstellar committed Feb 23, 2024
1 parent 4195885 commit 9c434b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libcxx/include/csetjmp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9c434b4

Please sign in to comment.