Skip to content

Commit 0bdb838

Browse files
Remove the #include <setjmp.h> from _CStdlib.h
1 parent 167771c commit 0bdb838

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From cb22941ea55af1ce0c48cf21bf23aca56702461d Mon Sep 17 00:00:00 2001
2+
From: Yuta Saito <[email protected]>
3+
Date: Sun, 18 Aug 2024 14:02:58 +0000
4+
Subject: [PATCH] Remove the `#include <setjmp.h>` from `_CStdlib.h`
5+
6+
It seems like we don't use neither setjmp nor longjmp in the Foundation
7+
codebase, so we can safely remove this include.
8+
The main motivation for this change is to fix the build with the latest
9+
wasi-libc version. Recent wasi-libc versions started to provide
10+
`setjmp.h` header but it raises compilation errors unless Exception
11+
Handling feature (still under standardization process) is enabled.
12+
13+
See https://github.com/WebAssembly/wasi-libc/blob/wasi-sdk-22/libc-top-half/musl/include/setjmp.h
14+
---
15+
Sources/_FoundationCShims/include/_CStdlib.h | 4 ----
16+
1 file changed, 4 deletions(-)
17+
18+
diff --git a/Sources/_FoundationCShims/include/_CStdlib.h b/Sources/_FoundationCShims/include/_CStdlib.h
19+
index 87efc2d..15a72ca 100644
20+
--- a/Sources/_FoundationCShims/include/_CStdlib.h
21+
+++ b/Sources/_FoundationCShims/include/_CStdlib.h
22+
@@ -55,10 +55,6 @@
23+
#include <math.h>
24+
#endif
25+
26+
-#if __has_include(<setjmp.h>)
27+
-#include <setjmp.h>
28+
-#endif
29+
-
30+
#if __has_include(<signal.h>)
31+
/// Guard against including `signal.h` on WASI. The `signal.h` header file
32+
/// itself is available in wasi-libc, but it's just a stub that doesn't actually
33+
--
34+
2.43.2
35+

0 commit comments

Comments
 (0)