[llvm-branch-commits] [libcxx] 9c434b4 - [libc++] Only include <setjmp.h> from the C library if it exists (#81887)

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Feb 23 12:47:33 PST 2024


Author: Louis Dionne
Date: 2024-02-23T12:46:52-08:00
New Revision: 9c434b47332a7e4128e5bedba44e4de18eadd564

URL: https://github.com/llvm/llvm-project/commit/9c434b47332a7e4128e5bedba44e4de18eadd564
DIFF: https://github.com/llvm/llvm-project/commit/9c434b47332a7e4128e5bedba44e4de18eadd564.diff

LOG: [libc++] Only include <setjmp.h> from the C library if it exists (#81887)

In 2cea1babefbb, 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. 647ddc08f43c).

rdar://122978778
(cherry picked from commit d8278b682386f51dfba204849c624672a3df40c7)

Added: 
    

Modified: 
    libcxx/include/csetjmp

Removed: 
    


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


        


More information about the llvm-branch-commits mailing list