add _Noreturn function attribute, with fallback for pre-C11 GNUC
[musl] / include / setjmp.h
1 #ifndef _SETJMP_H
2 #define _SETJMP_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #if __STDC_VERSION__ >= 201112L
9 #elif defined(__GNUC__)
10 #define _Noreturn __attribute__((__noreturn__))
11 #else
12 #define _Noreturn
13 #endif
14
15 #include <bits/setjmp.h>
16
17
18 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
19  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
20  || defined(_BSD_SOURCE)
21 typedef struct {
22         jmp_buf __jb;
23         unsigned long __fl;
24         unsigned long __ss[128/sizeof(long)];
25 } sigjmp_buf[1];
26 int sigsetjmp (sigjmp_buf, int);
27 void siglongjmp (sigjmp_buf, int);
28 #endif
29
30
31 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
32  || defined(_BSD_SOURCE)
33 int _setjmp (jmp_buf);
34 void _longjmp (jmp_buf, int);
35 #endif
36
37
38 int setjmp (jmp_buf);
39 _Noreturn void longjmp (jmp_buf, int);
40
41 #define setjmp setjmp
42 #define longjmp longjmp
43
44 #ifdef __cplusplus
45 }
46 #endif
47
48 #endif