diff options
Diffstat (limited to '05/tcc-0.9.25/setjmp.h')
-rw-r--r-- | 05/tcc-0.9.25/setjmp.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/05/tcc-0.9.25/setjmp.h b/05/tcc-0.9.25/setjmp.h new file mode 100644 index 0000000..b3ffce1 --- /dev/null +++ b/05/tcc-0.9.25/setjmp.h @@ -0,0 +1,21 @@ +#ifndef _SETJMP_H +#define _SETJMP_H + +#include <stdc_common.h> + +typedef long jmp_buf[3]; + +// @NONSTANDARD: we don't actually support setjmp + +int setjmp(jmp_buf env) { + return 0; +} + +void __longjmp(jmp_buf env, int val, const char *filename, int line) { + fprintf(stderr, "Error: Tried to longjmp from %s:%d with value %d\n", filename, line, val); + _Exit(-1); +} + +#define longjmp(env, val) __longjmp(env, val, __FILE__, __LINE__) + +#endif |