aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2025-04-01 16:24:59 -0400
committerAndrew Dunstan <andrew@dunslane.net>2025-04-01 16:24:59 -0400
commitc313fa4602defe1be947370ab5b217ca163a1e3c (patch)
treee51f67385079fe9f42591aeaf88ea55f4ae5bcff
parente19dc74491e68e1df05c99c4937929cef3092a3b (diff)
downloadpostgresql-c313fa4602defe1be947370ab5b217ca163a1e3c.tar.gz
postgresql-c313fa4602defe1be947370ab5b217ca163a1e3c.zip
Use workaround of __builtin_setjmp only on MINGW on MSVCRT
MSVCRT is not present Windows/ARM64 and the workaround is not necessary on any UCRT based toolchain. Author: Lars Kanis <lars@greiz-reinsdorf.de> Discussion: https://postgr.es/m/CAHXCYb2OjNHtoGVKyXtXmw4B3bUXwJX6M-Lcp1KcMCRUMLOocA@mail.gmail.com
-rw-r--r--src/include/c.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/include/c.h b/src/include/c.h
index 8cdc16a0f4a..94697aab428 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1326,19 +1326,19 @@ extern int fdatasync(int fildes);
/*
* When there is no sigsetjmp, its functionality is provided by plain
* setjmp. We now support the case only on Windows. However, it seems
- * that MinGW-64 has some longstanding issues in its setjmp support,
- * so on that toolchain we cheat and use gcc's builtins.
+ * that MinGW-64 has some longstanding issues in its setjmp support when
+ * building with MSVCRT, so on that toolchain we cheat and use gcc's builtins.
*/
#ifdef WIN32
-#ifdef __MINGW64__
+#if defined(__MINGW64__) && !defined(_UCRT)
typedef intptr_t sigjmp_buf[5];
#define sigsetjmp(x,y) __builtin_setjmp(x)
#define siglongjmp __builtin_longjmp
-#else /* !__MINGW64__ */
+#else /* !defined(__MINGW64__) || defined(_UCRT) */
#define sigjmp_buf jmp_buf
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp longjmp
-#endif /* __MINGW64__ */
+#endif /* defined(__MINGW64__) && !defined(_UCRT) */
#endif /* WIN32 */
/* /port compatibility functions */