Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py/nlr: In MP_NLR_JUMP_HEAD make top and top_ptr volatile. #5008

Merged
merged 2 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions py/mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,15 @@ typedef double mp_float_t;
#define MP_UNLIKELY(x) __builtin_expect((x), 0)
#endif

// To annotate that code is unreachable
#ifndef MP_UNREACHABLE
#if defined(__GNUC__)
#define MP_UNREACHABLE __builtin_unreachable();
#else
#define MP_UNREACHABLE for (;;);
#endif
#endif

#ifndef MP_HTOBE16
#if MP_ENDIANNESS_LITTLE
# define MP_HTOBE16(x) ((uint16_t)( (((x) & 0xff) << 8) | (((x) >> 8) & 0xff) ))
Expand Down
6 changes: 1 addition & 5 deletions py/nlrthumb.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,7 @@ NORETURN void nlr_jump(void *val) {
: // clobbered registers
);

#if defined(__GNUC__)
__builtin_unreachable();
#else
for (;;); // needed to silence compiler warning
#endif
MP_UNREACHABLE
}

#endif // MICROPY_NLR_THUMB
2 changes: 1 addition & 1 deletion py/nlrx64.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ NORETURN void nlr_jump(void *val) {
: // clobbered registers
);

for (;;); // needed to silence compiler warning
MP_UNREACHABLE
}

#endif // MICROPY_NLR_X64
2 changes: 1 addition & 1 deletion py/nlrx86.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ NORETURN void nlr_jump(void *val) {
: // clobbered registers
);

for (;;); // needed to silence compiler warning
MP_UNREACHABLE
}

#endif // MICROPY_NLR_X86
2 changes: 1 addition & 1 deletion py/nlrxtensa.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ NORETURN void nlr_jump(void *val) {
: // clobbered registers
);

for (;;); // needed to silence compiler warning
MP_UNREACHABLE
}

#endif // MICROPY_NLR_XTENSA