diff options
| author | Damien George <damien.p.george@gmail.com> | 2019-08-19 15:50:02 +1000 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-12-12 11:01:39 -0800 |
| commit | 63046d800d64081a4f7756476f5249179179ff5e (patch) | |
| tree | 63d200c7056424d05acce451a875f504aca45b50 /py/mpconfig.h | |
| parent | 887f64eed8d7c06182aa100a8131cc9b8b7dbd47 (diff) | |
py: Introduce MP_UNREACHABLE macro to annotate unreachable code.
And use it to replace the same pattern at the end of nlrthumb.c:nlr_jump.
Diffstat (limited to 'py/mpconfig.h')
| -rwxr-xr-x | py/mpconfig.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 3ec383817..a0d211bfa 100755 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1440,6 +1440,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) )) |
