<p></p>
<p>I has hoping I could fix this in platforms/Cross/vm/sqSetjmpShim.h but so far I have not been able to.</p>
<p>The issue is that mingw defines _setjmp, here's the definition that is used when clang is the compiler:</p>
<h1>242 "/usr/x86_64-w64-mingw32/sys-root/mingw/include/setjmp.h" 3</h1>
<p>int <strong>attribute</strong>((<strong>cdecl</strong>)) <strong>attribute</strong> ((<strong>nothrow</strong>,<strong>returns_twice</strong>))</p>
<p>So I tried a sqSetjmpShim.h like this:</p>
<p>#if !defined(_WIN32)</p>
<h1>undef setjmp</h1>
<h1>undef longjmp</h1>
<h1>define setjmp _setjmp</h1>
<h1>define longjmp _longjmp</h1>
<p>#endif<br>
/* mingw redeclares _setjmp so we have to provide an alternative <em>/<br>
#if <strong>MINGW32</strong> || <strong>MINGW64</strong> /</em> clang on cygwin/mingw */<br>
int <strong>attribute</strong>((<strong>nowthrow</strong>,<strong>returns_twice</strong>)) _setjmp0(jmp_buf);</p>
<h1>undef _setjmp</h1>
<h1>define _setjmp _setjmp0</h1>
<p>#endif</p>
<p>I know the code is being selected because if I preprocess via -E I see the declaration for _setjmp0.  But the define of _setjmp is not seen and so invocations of _setjmp are not changed by the preprocessor into invocations of _setjmp0.  Sigh...</p>
<p>A reason to prefer redefine _setjmp itself rather than adding our own non-conflicting version is that if any library code included in a plugin uses setjmp/longjmp then the longjmp will likely fail unless it uses our code.</p>
<p>The alternatives seem to be<br>
a) try and figure out why sqSetjmpShim.h is unable to map _setjmp to _setjmp0 and fix this<br>
b) if it cant be fixed, still define the symbols _setjmp and _setjmp0 in _setjmp-x64.asm (& _setjmp-x86.asm when we add it), have Slang emit osvm_setjmp and osvm_longjmp, and have sqSetjmpShim.h map osvm_setjmp and osvm_longjmp to _setjmp/_longjmp, and have _setjmp-x64.asm et al override all symbols for _setjmp/_longjmp, e.g.</p>
<pre><code>    .text
    .globl setjmp
    .globl sigsetjmp
    .globl _setjmp
    .globl _setjmp0
    .p2align        4, 0x90
</code></pre>
<p>setjmp:<br>
sigsetjmp:<br>
_setjmp:<br>
_setjmp0:<br>
....</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42130255">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AIJPEW244JQBQHONY5NSHYTSEZNFPANCNFSM4Q75H6MA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AIJPEW7UIP55UD7PUEAJ3NTSEZNFPA5CNFSM4Q75H6MKYY3PNVWWK3TUL52HS4DFVVBW63LNNF2EG33NNVSW45FKMNXW23LFNZ2F62LEZYBIFW2P.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42130255",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42130255",
"name": "View Commit"
},
"description": "View this Commit on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>