Add a check for NULL nlr_top in nlr_jump.

If no nlr_buf has been pushed, and an nlr_jump is called, then control
is transferred to nlr_jump_fail (which should bail out with a fatal
error).
This commit is contained in:
Damien George
2014-04-08 14:08:14 +00:00
parent 094ebef259
commit 26cf55ae05
8 changed files with 53 additions and 16 deletions

View File

@@ -27,6 +27,11 @@ unsigned int nlr_push(nlr_buf_t *);
void nlr_pop(void);
void nlr_jump(void *val) __attribute__((noreturn));
// This must be implemented by a port. It's called by nlr_jump
// if no nlr buf has been pushed. It must not return, but rather
// should bail out with a fatal error.
void nlr_jump_fail(void *val);
// use nlr_raise instead of nlr_jump so that debugging is easier
#ifndef DEBUG
#define nlr_raise(val) nlr_jump(val)