diff options
author | Damien George <damien.p.george@gmail.com> | 2017-02-16 17:23:06 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-06 17:13:16 +1100 |
commit | be3d7f91e5c71f3736cd85ce7016f2b5629cd6e9 (patch) | |
tree | 8db87603df4dc8e8e08f7df898c86b699a8421b8 | |
parent | 05fe66f68a1cf1b7587c55149472ab7bca843631 (diff) | |
download | micropython-be3d7f91e5c71f3736cd85ce7016f2b5629cd6e9.tar.gz micropython-be3d7f91e5c71f3736cd85ce7016f2b5629cd6e9.zip |
py/nlr.h: Mark nlr_jump_fail as NORETURN.
-rw-r--r-- | bare-arm/main.c | 1 | ||||
-rw-r--r-- | minimal/main.c | 1 | ||||
-rw-r--r-- | py/nlr.h | 2 | ||||
-rw-r--r-- | qemu-arm/main.c | 3 | ||||
-rw-r--r-- | qemu-arm/test_main.c | 3 |
5 files changed, 9 insertions, 1 deletions
diff --git a/bare-arm/main.c b/bare-arm/main.c index e6ce063989..99a7f926ef 100644 --- a/bare-arm/main.c +++ b/bare-arm/main.c @@ -48,6 +48,7 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); void nlr_jump_fail(void *val) { + while (1); } void NORETURN __fatal_error(const char *msg) { diff --git a/minimal/main.c b/minimal/main.c index 6b77b1a425..766ad6c1b4 100644 --- a/minimal/main.c +++ b/minimal/main.c @@ -87,6 +87,7 @@ mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) { MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); void nlr_jump_fail(void *val) { + while (1); } void NORETURN __fatal_error(const char *msg) { @@ -82,7 +82,7 @@ NORETURN void nlr_jump(void *val); // 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); +NORETURN void nlr_jump_fail(void *val); // use nlr_raise instead of nlr_jump so that debugging is easier #ifndef DEBUG diff --git a/qemu-arm/main.c b/qemu-arm/main.c index b6ff73980c..aa7247b446 100644 --- a/qemu-arm/main.c +++ b/qemu-arm/main.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include <stdlib.h> #include <stdio.h> #include <string.h> #include <malloc.h> @@ -59,4 +60,6 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); void nlr_jump_fail(void *val) { + printf("uncaught NLR\n"); + exit(1); } diff --git a/qemu-arm/test_main.c b/qemu-arm/test_main.c index 5c0c915c48..4d89930906 100644 --- a/qemu-arm/test_main.c +++ b/qemu-arm/test_main.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include <stdlib.h> #include <stdio.h> #include <string.h> #include <malloc.h> @@ -92,4 +93,6 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); void nlr_jump_fail(void *val) { + printf("uncaught NLR\n"); + exit(1); } |