Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit be8e574

Browse files
committed
py/nlrx86,x64: Replace #define of defined() with portable macro usage.
Using gcc -Wpedantic will warn that #define of defined() is non-portable and this patch fixes this.
1 parent 613510b commit be8e574

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

py/nlrx64.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
// x86-64 callee-save registers are:
3535
// rbx, rbp, rsp, r12, r13, r14, r15
3636

37-
#define NLR_OS_WINDOWS (defined(_WIN32) || defined(__CYGWIN__))
37+
#if defined(_WIN32) || defined(__CYGWIN__)
38+
#define NLR_OS_WINDOWS 1
39+
#else
40+
#define NLR_OS_WINDOWS 0
41+
#endif
3842

3943
__attribute__((used)) unsigned int nlr_push_tail(nlr_buf_t *nlr);
4044

py/nlrx86.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
// For reference, x86 callee save regs are:
3636
// ebx, esi, edi, ebp, esp, eip
3737

38-
#define NLR_OS_WINDOWS (defined(_WIN32) || defined(__CYGWIN__))
38+
#if defined(_WIN32) || defined(__CYGWIN__)
39+
#define NLR_OS_WINDOWS 1
40+
#else
41+
#define NLR_OS_WINDOWS 0
42+
#endif
3943

4044
#if NLR_OS_WINDOWS
4145
unsigned int nlr_push_tail(nlr_buf_t *nlr) asm("nlr_push_tail");

0 commit comments

Comments
 (0)