-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.h
48 lines (39 loc) · 842 Bytes
/
error.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef ERROR_H
#define ERROR_H
#include <setjmp.h>
#include <signal.h>
struct jmploc {
jmp_buf loc;
};
extern struct jmploc *handler;
extern int exception;
extern int suppressint;
extern volatile sig_atomic_t intpending;
/* must be non zero */
#define EXINT 1
#define EXERR 2
#define barrier() ({ __asm__ __volatile__ ("": : :"memory"); })
#define INTOFF \
({ \
suppressint++; \
barrier(); \
0; \
})
#define INTON \
({ \
barrier(); \
if (--suppressint == 0 && intpending) onint(); \
0; \
})
#define FORCEINTON \
({ \
barrier(); \
suppressint = 0; \
if (intpending) onint(); \
0; \
})
void exraise(int) __attribute__((noreturn));
void onint(void) __attribute__((noreturn));
void raiseexc(int, const char *, ...) __attribute__((noreturn));
void raiseerr(const char *, ...) __attribute__((noreturn));
#endif