Skip to content

Commit be3d7f9

Browse files
committed
py/nlr.h: Mark nlr_jump_fail as NORETURN.
1 parent 05fe66f commit be3d7f9

5 files changed

Lines changed: 9 additions & 1 deletion

File tree

bare-arm/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
4848
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
4949

5050
void nlr_jump_fail(void *val) {
51+
while (1);
5152
}
5253

5354
void NORETURN __fatal_error(const char *msg) {

minimal/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
8787
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
8888

8989
void nlr_jump_fail(void *val) {
90+
while (1);
9091
}
9192

9293
void NORETURN __fatal_error(const char *msg) {

py/nlr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ NORETURN void nlr_jump(void *val);
8282
// This must be implemented by a port. It's called by nlr_jump
8383
// if no nlr buf has been pushed. It must not return, but rather
8484
// should bail out with a fatal error.
85-
void nlr_jump_fail(void *val);
85+
NORETURN void nlr_jump_fail(void *val);
8686

8787
// use nlr_raise instead of nlr_jump so that debugging is easier
8888
#ifndef DEBUG

qemu-arm/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdint.h>
2+
#include <stdlib.h>
23
#include <stdio.h>
34
#include <string.h>
45
#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)
5960
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
6061

6162
void nlr_jump_fail(void *val) {
63+
printf("uncaught NLR\n");
64+
exit(1);
6265
}

qemu-arm/test_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdint.h>
2+
#include <stdlib.h>
23
#include <stdio.h>
34
#include <string.h>
45
#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)
9293
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
9394

9495
void nlr_jump_fail(void *val) {
96+
printf("uncaught NLR\n");
97+
exit(1);
9598
}

0 commit comments

Comments
 (0)