summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2015-11-20 15:18:42 +0100
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-11-24 17:34:14 +0200
commitbf1570cb2559ba12ca86b2dbb26be665300ffe5e (patch)
treef4daab4692efc97f2bab395e0a52e54d92f61549 /py
parent6edffd0df5092dd4303e453c55ccfbc970476b53 (diff)
downloadmicropython-bf1570cb2559ba12ca86b2dbb26be665300ffe5e.tar.gz
micropython-bf1570cb2559ba12ca86b2dbb26be665300ffe5e.zip
nlr: Use single preprocessor symbol to check if building on Windows
Diffstat (limited to 'py')
-rw-r--r--py/nlrx64.S12
-rw-r--r--py/nlrx86.S15
2 files changed, 16 insertions, 11 deletions
diff --git a/py/nlrx64.S b/py/nlrx64.S
index 91889c93f9..8dda025cad 100644
--- a/py/nlrx64.S
+++ b/py/nlrx64.S
@@ -41,10 +41,14 @@
#define NLR_TOP (mp_state_ctx + NLR_TOP_OFFSET)
#endif
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define NLR_OS_WINDOWS
+#endif
+
.file "nlr.s"
.text
-#if !defined(__CYGWIN__)
+#if !defined(NLR_OS_WINDOWS)
/******************************************************************************/
//
@@ -140,11 +144,11 @@ nlr_jump:
je _nlr_jump_fail # transfer control to nlr_jump_fail
#endif
-#else // !defined(__CYGWIN__)
+#else // !defined(NLR_OS_WINDOWS)
/******************************************************************************/
//
-// Functions for Cygwin
+// Functions for Windows
//
/******************************************************************************/
@@ -210,6 +214,6 @@ nlr_jump:
movq %rax, %rcx # put argument back in first-arg register
je nlr_jump_fail # transfer control to nlr_jump_fail
-#endif // !defined(__CYGWIN__)
+#endif // !defined(NLR_OS_WINDOWS)
#endif // defined(__x86_64__) && !MICROPY_NLR_SETJMP
diff --git a/py/nlrx86.S b/py/nlrx86.S
index a2ddb174ad..a6ec4b73c7 100644
--- a/py/nlrx86.S
+++ b/py/nlrx86.S
@@ -36,6 +36,7 @@
#define NLR_TOP_OFFSET (2 * 4)
#if defined(_WIN32) || defined(__CYGWIN__)
+#define NLR_OS_WINDOWS
#define NLR_TOP (_mp_state_ctx + NLR_TOP_OFFSET)
#else
#define NLR_TOP (mp_state_ctx + NLR_TOP_OFFSET)
@@ -47,7 +48,7 @@
/**************************************/
// mp_uint_t nlr_push(4(%esp)=nlr_buf_t *nlr)
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(NLR_OS_WINDOWS)
.globl _nlr_push
.def _nlr_push; .scl 2; .type 32; .endef
_nlr_push:
@@ -69,14 +70,14 @@ nlr_push:
mov %edx, NLR_TOP # stor new nlr_buf (to make linked list)
xor %eax, %eax # return 0, normal return
ret # return
-#if !(defined(_WIN32) || defined(__CYGWIN__))
+#if !defined(NLR_OS_WINDOWS)
.size nlr_push, .-nlr_push
#endif
/**************************************/
// void nlr_pop()
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(NLR_OS_WINDOWS)
.globl _nlr_pop
.def _nlr_pop; .scl 2; .type 32; .endef
_nlr_pop:
@@ -89,14 +90,14 @@ nlr_pop:
mov (%eax), %eax # load prev nlr_buf
mov %eax, NLR_TOP # store nlr_top (to unlink list)
ret # return
-#if !(defined(_WIN32) || defined(__CYGWIN__))
+#if !defined(NLR_OS_WINDOWS)
.size nlr_pop, .-nlr_pop
#endif
/**************************************/
// void nlr_jump(4(%esp)=mp_uint_t val)
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(NLR_OS_WINDOWS)
.globl _nlr_jump
.def _nlr_jump; .scl 2; .type 32; .endef
_nlr_jump:
@@ -107,7 +108,7 @@ nlr_jump:
#endif
mov NLR_TOP, %edx # load nlr_top
test %edx, %edx # check for nlr_top being NULL
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(NLR_OS_WINDOWS)
je _nlr_jump_fail # fail if nlr_top is NULL
#else
je nlr_jump_fail # fail if nlr_top is NULL
@@ -126,7 +127,7 @@ nlr_jump:
xor %eax, %eax # clear return register
inc %al # increase to make 1, non-local return
ret # return
-#if !(defined(_WIN32) || defined(__CYGWIN__))
+#if !defined(NLR_OS_WINDOWS)
.size nlr_jump, .-nlr_jump
#endif