libtrycatch  Diff

Differences From Artifact [e9c91601df]:

To Artifact [bac0e8a95b]:


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	jmp_buf TRYCATCH_CONCAT(trycatch_jmpbuf, __LINE__);		   \
	TRYCATCH_CONCAT(trycatch_frame, __LINE__) = trycatch_frame_push(); \
	trycatch_ex = setjmp(TRYCATCH_CONCAT(trycatch_jmpbuf, __LINE__));  \
	if (trycatch_ex == 0)						   \
		TRYCATCH_CONCAT(trycatch_frame, __LINE__)->jmpbuf =	   \
		    &TRYCATCH_CONCAT(trycatch_jmpbuf, __LINE__);	   \
	if (trycatch_ex == 0)
#define catch(ex)							\
	trycatch_frame_pop();						\
	for (int ex = trycatch_ex; trycatch_ex != 0; trycatch_ex = 0)
#define throw(ex) trycatch_throw(ex)
#define rethrow trycatch_throw(trycatch_ex)

struct trycatch_frame {
	jmp_buf *jmpbuf;
	struct trycatch_frame *prev;
};







|
|
|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	jmp_buf TRYCATCH_CONCAT(trycatch_jmpbuf, __LINE__);		   \
	TRYCATCH_CONCAT(trycatch_frame, __LINE__) = trycatch_frame_push(); \
	trycatch_ex = setjmp(TRYCATCH_CONCAT(trycatch_jmpbuf, __LINE__));  \
	if (trycatch_ex == 0)						   \
		TRYCATCH_CONCAT(trycatch_frame, __LINE__)->jmpbuf =	   \
		    &TRYCATCH_CONCAT(trycatch_jmpbuf, __LINE__);	   \
	if (trycatch_ex == 0)
#define catch(ex)							       \
	trycatch_frame_pop();						       \
	for (int ex = trycatch_ex; trycatch_ex != 0; trycatch_ex = 0, (void)ex)
#define throw(ex) trycatch_throw(ex)
#define rethrow trycatch_throw(trycatch_ex)

struct trycatch_frame {
	jmp_buf *jmpbuf;
	struct trycatch_frame *prev;
};