diff options
author | Tanguy <tanguy@status.im> | 2022-06-14 12:37:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 12:37:31 +0200 |
commit | 251bdc1d5aed98fccb31677dda3c3ead9be2f6bf (patch) | |
tree | dd02fc575bfbfabbabfdcd3c90de4dc00a9f4437 /lib/system | |
parent | b41226001ce596fe520fd326a302c6f4e91c2504 (diff) | |
download | Nim-251bdc1d5aed98fccb31677dda3c3ead9be2f6bf.tar.gz |
Windows: enable nimRawSetjmp by default [backport] (#19891)
* Windows: enable nimRawSetjmp by default See #19197. The default setjmp can randomly segfault on windows * Attempt to disable the flag for bootstraping * Disable styleCheck for c_setjmp
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/ansi_c.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 23fb9fdef..5d0ecc01c 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -116,6 +116,7 @@ elif defined(nimBuiltinSetjmp): proc c_builtin_setjmp(jmpb: ptr pointer): cint {. importc: "__builtin_setjmp", nodecl.} c_builtin_setjmp(unsafeAddr jmpb[0]) + elif defined(nimRawSetjmp) and not defined(nimStdSetjmp): when defined(windows): # No `_longjmp()` on Windows. @@ -127,10 +128,16 @@ elif defined(nimRawSetjmp) and not defined(nimStdSetjmp): # prone to stack corruption during unwinding, so we disable that by setting # it to NULL. # More details: https://github.com/status-im/nimbus-eth2/issues/3121 + when defined(nimHasStyleChecks): + {.push styleChecks: off.} + proc c_setjmp*(jmpb: C_JmpBuf): cint = proc c_setjmp_win(jmpb: C_JmpBuf, ctx: pointer): cint {. header: "<setjmp.h>", importc: "_setjmp".} c_setjmp_win(jmpb, nil) + + when defined(nimHasStyleChecks): + {.pop.} else: proc c_longjmp*(jmpb: C_JmpBuf, retval: cint) {. header: "<setjmp.h>", importc: "_longjmp".} |