On Thu, 24 Apr 2025, Jacek Caban wrote:

On 24.04.2025 12:49, Martin Storsjö wrote:
On Thu, 24 Apr 2025, Jacek Caban wrote:

Instead of for specific architectures. Fixes setjmp on ARM64EC.
---
mingw-w64-headers/crt/setjmp.h | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h
index 2dc7d8739..11d736492 100644
--- a/mingw-w64-headers/crt/setjmp.h
+++ b/mingw-w64-headers/crt/setjmp.h
@@ -224,21 +224,21 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
#ifndef _INC_SETJMPEX
#  if defined(_X86_) || defined(__i386__)
#    define setjmp(BUF) _setjmp3((BUF), NULL)
-#  elif ((defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)) && (!defined(__SEH__) || !__has_builtin(__builtin_sponentry) || defined(__USE_MINGW_SETJMP_NON_SEH)))
-#    define setjmp(BUF) __mingw_setjmp((BUF))
-#    define longjmp __mingw_longjmp
-  int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __mingw_setjmp(jmp_buf _Buf); -  __MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __mingw_longjmp(jmp_buf _Buf,int _Value);
-#  elif defined(__SEH__) && !defined(__USE_MINGW_SETJMP_NON_SEH)
-#    if defined(__aarch64__) || defined(_ARM64_) || defined(__arm__) || defined(_ARM_)
-#      define setjmp(BUF) _setjmp((BUF), __builtin_sponentry())
-#    elif (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
-#      define setjmp(BUF) _setjmp((BUF), mingw_getsp())
+#  elif !defined(__SEH__) || defined(__USE_MINGW_SETJMP_NON_SEH)
+#    if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
+#      define setjmp(BUF) __mingw_setjmp((BUF))
+#      define longjmp __mingw_longjmp
+      int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __mingw_setjmp(jmp_buf _Buf); +      __MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __mingw_longjmp(jmp_buf _Buf,int _Value);
#    else
-#      define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
+#      define setjmp(BUF) _setjmp((BUF), NULL)
#    endif
+#  elif __has_builtin(__builtin_sponentry)
+#    define setjmp(BUF) _setjmp((BUF), __builtin_sponentry())
+#  elif (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
+#    define setjmp(BUF) _setjmp((BUF), mingw_getsp())
#  else
-#    define setjmp(BUF) _setjmp((BUF), NULL)
+#    define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
#  endif
  int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp(jmp_buf _Buf, void *_Ctx);   int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp3(jmp_buf _Buf, void *_Ctx);
--
2.49.0

Thanks; when viewed with "git show -w" to ignore whitespace, this one looks like a nice simplification.

(It could be nice with a separate cleanup step on top to just deduplicate the _ARM_ vs __arm__ style arch ifdefs - IIRC we've decided elsewhere that there's no reason to perpetuate that style? Although after this change, there's not many such checks left anyway.)


Sorry, I misread initially. I’ve split out the reordering change from the __builtin_sponentry part, dropped the MSVC-style target macro changes and pushed. I hope that's fine. Thanks for the reviews!

Thanks, what you pushed seems fine!

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to