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.
This commit is contained in:
parent
af5c998f37
commit
0c80cb39af
|
@ -1527,6 +1527,15 @@ typedef double mp_float_t;
|
||||||
#define MP_UNLIKELY(x) __builtin_expect((x), 0)
|
#define MP_UNLIKELY(x) __builtin_expect((x), 0)
|
||||||
#endif
|
#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
|
#ifndef MP_HTOBE16
|
||||||
#if MP_ENDIANNESS_LITTLE
|
#if MP_ENDIANNESS_LITTLE
|
||||||
# define MP_HTOBE16(x) ((uint16_t)( (((x) & 0xff) << 8) | (((x) >> 8) & 0xff) ))
|
# define MP_HTOBE16(x) ((uint16_t)( (((x) & 0xff) << 8) | (((x) >> 8) & 0xff) ))
|
||||||
|
|
|
@ -135,11 +135,7 @@ NORETURN void nlr_jump(void *val) {
|
||||||
: // clobbered registers
|
: // clobbered registers
|
||||||
);
|
);
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
MP_UNREACHABLE
|
||||||
__builtin_unreachable();
|
|
||||||
#else
|
|
||||||
for (;;); // needed to silence compiler warning
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MICROPY_NLR_THUMB
|
#endif // MICROPY_NLR_THUMB
|
||||||
|
|
Loading…
Reference in New Issue