Skip to content

Commit 0516700

Browse files
committed
restructure nlr.h for udefined archtectures
1 parent 1a53ced commit 0516700

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

py/nlr.h

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,38 @@
3636

3737
// If MICROPY_NLR_SETJMP is not enabled then auto-detect the machine arch
3838
#if !defined(MICROPY_NLR_SETJMP) || !MICROPY_NLR_SETJMP
39-
#define MICROPY_NLR_SETJMP (0)
4039
// A lot of nlr-related things need different treatment on Windows
41-
#if defined(_WIN32) || defined(__CYGWIN__)
42-
#define MICROPY_NLR_OS_WINDOWS 1
43-
#else
44-
#define MICROPY_NLR_OS_WINDOWS 0
45-
#endif
46-
#if defined(__i386__)
47-
#define MICROPY_NLR_X86 (1)
48-
#define MICROPY_NLR_NUM_REGS (6)
49-
#elif defined(__x86_64__)
50-
#define MICROPY_NLR_X64 (1)
51-
#if MICROPY_NLR_OS_WINDOWS
52-
#define MICROPY_NLR_NUM_REGS (10)
40+
#if defined(_WIN32) || defined(__CYGWIN__)
41+
#define MICROPY_NLR_OS_WINDOWS 1
5342
#else
54-
#define MICROPY_NLR_NUM_REGS (8)
43+
#define MICROPY_NLR_OS_WINDOWS 0
5544
#endif
56-
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
57-
#define MICROPY_NLR_THUMB (1)
58-
#define MICROPY_NLR_NUM_REGS (10)
59-
#elif defined(__xtensa__)
60-
#define MICROPY_NLR_XTENSA (1)
61-
#define MICROPY_NLR_NUM_REGS (10)
62-
#else
63-
#define MICROPY_NLR_SETJMP (1)
45+
#if defined(__i386__)
46+
#define MICROPY_NLR_X86 (1)
47+
#define MICROPY_NLR_NUM_REGS (6)
48+
#elif defined(__x86_64__)
49+
#define MICROPY_NLR_X64 (1)
50+
#if MICROPY_NLR_OS_WINDOWS
51+
#define MICROPY_NLR_NUM_REGS (10)
52+
#else
53+
#define MICROPY_NLR_NUM_REGS (8)
54+
#endif
55+
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
56+
#define MICROPY_NLR_THUMB (1)
57+
#define MICROPY_NLR_NUM_REGS (10)
58+
#elif defined(__xtensa__)
59+
#define MICROPY_NLR_XTENSA (1)
60+
#define MICROPY_NLR_NUM_REGS (10)
61+
#else
62+
#define MICROPY_NLR_SETJMP (1)
6463
//#warning "No native NLR support for this arch, using setjmp implementation"
64+
#endif
6565
#endif
66+
67+
// If MICROPY_NLR_SETJMP is not defined above - define/disable it here
68+
69+
#if !defined(MICROPY_NLR_SETJMP)
70+
#define MICROPY_NLR_SETJMP (0)
6671
#endif
6772

6873
#if MICROPY_NLR_SETJMP

0 commit comments

Comments
 (0)