Skip to content

Commit 20ee0e1

Browse files
authored
Merge pull request #2864 from MaxDesiatov/patch-2
2 parents 53b5ff1 + c7491fb commit 20ee0e1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h

+35
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
TARGET_CPU_MIPS - Compiler is generating MIPS instructions
3535
TARGET_CPU_SPARC - Compiler is generating Sparc instructions
3636
TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
37+
TARGET_CPU_WASM32 - Compiler is generating WebAssembly instructions for 32-bit mode
3738
3839
3940
TARGET_OS_*
@@ -47,6 +48,7 @@
4748
TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
4849
TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
4950
TARGET_OS_CYGWIN - Generated code will run under 64-bit Cygwin
51+
TARGET_OS_WASI - Generated code will run under WebAssembly System Interface
5052
TARGET_OS_MAC - Generated code will run under Mac OS X variant
5153
TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
5254
TARGET_OS_IOS - Generated code will run under iOS
@@ -79,39 +81,52 @@
7981
#define TARGET_OS_BSD 0
8082
#define TARGET_OS_ANDROID 0
8183
#define TARGET_OS_CYGWIN 0
84+
#define TARGET_OS_WASI 0
8285
#elif __ANDROID__
8386
#define TARGET_OS_DARWIN 0
8487
#define TARGET_OS_LINUX 1
8588
#define TARGET_OS_WINDOWS 0
8689
#define TARGET_OS_BSD 0
8790
#define TARGET_OS_ANDROID 1
8891
#define TARGET_OS_CYGWIN 0
92+
#define TARGET_OS_WASI 0
8993
#elif __linux__
9094
#define TARGET_OS_DARWIN 0
9195
#define TARGET_OS_LINUX 1
9296
#define TARGET_OS_WINDOWS 0
9397
#define TARGET_OS_BSD 0
9498
#define TARGET_OS_ANDROID 0
9599
#define TARGET_OS_CYGWIN 0
100+
#define TARGET_OS_WASI 0
96101
#elif __CYGWIN__
97102
#define TARGET_OS_DARWIN 0
98103
#define TARGET_OS_LINUX 1
99104
#define TARGET_OS_WINDOWS 0
100105
#define TARGET_OS_BSD 0
101106
#define TARGET_OS_ANDROID 0
102107
#define TARGET_OS_CYGWIN 1
108+
#define TARGET_OS_WASI 0
103109
#elif _WIN32 || _WIN64
104110
#define TARGET_OS_DARWIN 0
105111
#define TARGET_OS_LINUX 0
106112
#define TARGET_OS_WINDOWS 1
107113
#define TARGET_OS_BSD 0
108114
#define TARGET_OS_ANDROID 0
115+
#define TARGET_OS_WASI 0
109116
#elif __unix__
110117
#define TARGET_OS_DARWIN 0
111118
#define TARGET_OS_LINUX 0
112119
#define TARGET_OS_WINDOWS 0
113120
#define TARGET_OS_BSD 1
114121
#define TARGET_OS_ANDROID 0
122+
#define TARGET_OS_WASI 0
123+
#elif __wasi__
124+
#define TARGET_OS_DARWIN 0
125+
#define TARGET_OS_LINUX 0
126+
#define TARGET_OS_WINDOWS 0
127+
#define TARGET_OS_BSD 0
128+
#define TARGET_OS_ANDROID 0
129+
#define TARGET_OS_WASI 1
115130
#else
116131
#error unknown operating system
117132
#endif
@@ -130,6 +145,7 @@
130145
#define TARGET_CPU_MIPS 0
131146
#define TARGET_CPU_MIPS64 0
132147
#define TARGET_CPU_S390X 0
148+
#define TARGET_CPU_WASM32 0
133149
#elif __arm64__ || __aarch64__
134150
#define TARGET_CPU_PPC 0
135151
#define TARGET_CPU_PPC64 0
@@ -140,6 +156,7 @@
140156
#define TARGET_CPU_MIPS 0
141157
#define TARGET_CPU_MIPS64 0
142158
#define TARGET_CPU_S390X 0
159+
#define TARGET_CPU_WASM32 0
143160
#elif __mips64__
144161
#define TARGET_CPU_PPC 0
145162
#define TARGET_CPU_PPC64 0
@@ -150,6 +167,7 @@
150167
#define TARGET_CPU_MIPS 0
151168
#define TARGET_CPU_MIPS64 1
152169
#define TARGET_CPU_S390X 0
170+
#define TARGET_CPU_WASM32 0
153171
#elif __powerpc64__
154172
#define TARGET_CPU_PPC 0
155173
#define TARGET_CPU_PPC64 1
@@ -160,6 +178,7 @@
160178
#define TARGET_CPU_MIPS 0
161179
#define TARGET_CPU_MIPS64 0
162180
#define TARGET_CPU_S390X 0
181+
#define TARGET_CPU_WASM32 0
163182
#elif __i386__
164183
#define TARGET_CPU_PPC 0
165184
#define TARGET_CPU_PPC64 0
@@ -170,6 +189,7 @@
170189
#define TARGET_CPU_MIPS 0
171190
#define TARGET_CPU_MIPS64 0
172191
#define TARGET_CPU_S390X 0
192+
#define TARGET_CPU_WASM32 0
173193
#elif __arm__
174194
#define TARGET_CPU_PPC 0
175195
#define TARGET_CPU_PPC64 0
@@ -180,6 +200,7 @@
180200
#define TARGET_CPU_MIPS 0
181201
#define TARGET_CPU_MIPS64 0
182202
#define TARGET_CPU_S390X 0
203+
#define TARGET_CPU_WASM32 0
183204
#elif __mips__
184205
#define TARGET_CPU_PPC 0
185206
#define TARGET_CPU_PPC64 0
@@ -190,6 +211,7 @@
190211
#define TARGET_CPU_MIPS 1
191212
#define TARGET_CPU_MIPS64 0
192213
#define TARGET_CPU_S390X 0
214+
#define TARGET_CPU_WASM32 0
193215
#elif __powerpc__
194216
#define TARGET_CPU_PPC 1
195217
#define TARGET_CPU_PPC64 0
@@ -200,6 +222,7 @@
200222
#define TARGET_CPU_MIPS 0
201223
#define TARGET_CPU_MIPS64 0
202224
#define TARGET_CPU_S390X 0
225+
#define TARGET_CPU_WASM32 0
203226
#elif __s390x__
204227
#define TARGET_CPU_PPC 0
205228
#define TARGET_CPU_PPC64 0
@@ -210,6 +233,18 @@
210233
#define TARGET_CPU_MIPS 0
211234
#define TARGET_CPU_MIPS64 0
212235
#define TARGET_CPU_S390X 1
236+
#define TARGET_CPU_WASM32 0
237+
#elif __wasm32__
238+
#define TARGET_CPU_PPC 0
239+
#define TARGET_CPU_PPC64 0
240+
#define TARGET_CPU_X86 0
241+
#define TARGET_CPU_X86_64 0
242+
#define TARGET_CPU_ARM 0
243+
#define TARGET_CPU_ARM64 0
244+
#define TARGET_CPU_MIPS 0
245+
#define TARGET_CPU_MIPS64 0
246+
#define TARGET_CPU_S390X 0
247+
#define TARGET_CPU_WASM32 1
213248
#else
214249
#error unknown architecture
215250
#endif

0 commit comments

Comments
 (0)