]>
Commit | Line | Data |
---|---|---|
320054e8 DG |
1 | #ifndef _SETJMP_H |
2 | #define _SETJMP_H | |
3 | ||
4 | #ifdef __cplusplus | |
5 | extern "C" { | |
6 | #endif | |
7 | ||
8 | #include <features.h> | |
9 | ||
e5f14be3 | 10 | #ifdef __wasilibc_unmodified_upstream /* WASI has no setjmp */ |
320054e8 DG |
11 | #include <bits/setjmp.h> |
12 | ||
13 | typedef struct __jmp_buf_tag { | |
14 | __jmp_buf __jb; | |
15 | unsigned long __fl; | |
16 | unsigned long __ss[128/sizeof(long)]; | |
17 | } jmp_buf[1]; | |
18 | ||
19 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ | |
20 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ | |
21 | || defined(_BSD_SOURCE) | |
22 | typedef jmp_buf sigjmp_buf; | |
23 | int sigsetjmp (sigjmp_buf, int); | |
24 | _Noreturn void siglongjmp (sigjmp_buf, int); | |
25 | #endif | |
26 | ||
27 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ | |
28 | || defined(_BSD_SOURCE) | |
29 | int _setjmp (jmp_buf); | |
30 | _Noreturn void _longjmp (jmp_buf, int); | |
31 | #endif | |
32 | ||
33 | int setjmp (jmp_buf); | |
34 | _Noreturn void longjmp (jmp_buf, int); | |
35 | ||
36 | #define setjmp setjmp | |
37 | #else | |
9f103c28 | 38 | #warning setjmp is not yet implemented for WASI |
320054e8 DG |
39 | #endif |
40 | ||
41 | #ifdef __cplusplus | |
42 | } | |
43 | #endif | |
44 | ||
45 | #endif |