diff --git a/RELEASES.rst b/RELEASES.rst index 6f1def6ad1..6f50a2bfc4 100644 --- a/RELEASES.rst +++ b/RELEASES.rst @@ -3279,6 +3279,10 @@ Planned * Fix harmless -Wcast-align warnings on armhf (GH-1793) +* Use __builtin_{setjmp,longjmp} for MinGW (GH-1443) + +* Identify Cygwin as "cygwin" instead of "windows" in Duktape.env (GH-1443) + * Various compiler warning fixes (GH-1788) * Add automatic workaround for union aliasing issues with FreeBSD + -m32 + diff --git a/config/platforms.yaml b/config/platforms.yaml index 00bed2e987..8254590f0e 100644 --- a/config/platforms.yaml +++ b/config/platforms.yaml @@ -32,6 +32,7 @@ autodetect: check: DUK_F_DURANGO include: platform_durango.h.in - + # For Cygwin POSIX target, __CYGWIN__ will be set but _WIN32 etc won't. name: Windows check: DUK_F_WINDOWS include: platform_windows.h.in diff --git a/config/platforms/platform_cygwin.h.in b/config/platforms/platform_cygwin.h.in index cfe458b58b..3144e060b4 100644 --- a/config/platforms/platform_cygwin.h.in +++ b/config/platforms/platform_cygwin.h.in @@ -12,4 +12,4 @@ #define DUK_SETJMP(jb) _setjmp((jb)) #define DUK_LONGJMP(jb) _longjmp((jb), 1) -#define DUK_USE_OS_STRING "windows" +#define DUK_USE_OS_STRING "cygwin" diff --git a/config/platforms/platform_windows.h.in b/config/platforms/platform_windows.h.in index 9e6fcf9ec8..bd53016309 100644 --- a/config/platforms/platform_windows.h.in +++ b/config/platforms/platform_windows.h.in @@ -57,3 +57,12 @@ #if !defined(DUK_USE_BYTEORDER) #define DUK_USE_BYTEORDER 1 #endif + +/* Use __builtin_setjmp() for MinGW to avoid issues described in: + * http://www.agardner.me/golang/windows/cgo/64-bit/setjmp/longjmp/2016/02/29/go-windows-setjmp-x86.html. + */ +#if defined(DUK_F_MINGW) +#define DUK_JMPBUF_TYPE jmp_buf +#define DUK_SETJMP(jb) __builtin_setjmp((jb)) +#define DUK_LONGJMP(jb) __builtin_longjmp((jb), 1) +#endif