Skip to content

Commit d8278b6

Browse files
authored
[libc++] Only include <setjmp.h> from the C library if it exists (#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
1 parent 450462c commit d8278b6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libcxx/include/csetjmp

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ void longjmp(jmp_buf env, int val);
3333
#include <__assert> // all public C++ headers provide the assertion handler
3434
#include <__config>
3535

36-
#include <setjmp.h>
36+
// <setjmp.h> is not provided by libc++
37+
#if __has_include(<setjmp.h>)
38+
# include <setjmp.h>
39+
# ifdef _LIBCPP_SETJMP_H
40+
# error "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
41+
# endif
42+
#endif
3743

3844
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3945
# pragma GCC system_header

0 commit comments

Comments
 (0)