summaryrefslogtreecommitdiffstatshomepage
path: root/unix-cpy/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-08 14:08:14 +0000
committerDamien George <damien.p.george@gmail.com>2014-04-08 14:08:14 +0000
commit26cf55ae05658c8a47719d46d48df8c9751108b5 (patch)
treebe29a2ba6c82b486b21e6a7efb98f22eb44645af /unix-cpy/main.c
parent094ebef259e86dfc0f1f3c1b493d81e5e8b1b6c4 (diff)
downloadmicropython-26cf55ae05658c8a47719d46d48df8c9751108b5.tar.gz
micropython-26cf55ae05658c8a47719d46d48df8c9751108b5.zip
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).
Diffstat (limited to 'unix-cpy/main.c')
-rw-r--r--unix-cpy/main.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/unix-cpy/main.c b/unix-cpy/main.c
index 944d26e9f3..6cdd72c5da 100644
--- a/unix-cpy/main.c
+++ b/unix-cpy/main.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -74,12 +75,11 @@ int main(int argc, char **argv) {
return 0;
}
-// for sqrt
-#include <math.h>
-machine_float_t machine_sqrt(machine_float_t x) {
- return sqrt(x);
-}
-
mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST;
}
+
+void nlr_jump_fail(void *val) {
+ printf("FATAL: uncaught NLR %p\n", val);
+ exit(1);
+}