headers: Remove the unused ifdefs for USE_NO_MINGW_SETJMP_TWO_ARGS

This was added in the form of USE_MINGW_SETJMP_TWO_ARGS in
6ef8b92929 in 2008, then changed
so that USE_MINGW_SETJMP_TWO_ARGS was defined automatically for
64 bit targets in 5b99e86d44 one
day later.

In 82347ded0d in 2009, i386 targets
were changed to use _setjmp3 instead of _setjmp. In this change,
the automatic setting of USE_MINGW_SETJMP_TWO_ARGS was removed and
the ifdef was inverted into USE_NO_MINGW_SETJMP_TWO_ARGS. This
left the old codepaths unused unless the user set
USE_NO_MINGW_SETJMP_TWO_ARGS manually.

To the best of our knowledge, no users have been using
USE_NO_MINGW_SETJMP_TWO_ARGS, and it only would have worked on i386
targets anyway. Thus remove this to reduce unnecessary complexity
in this otherwise complex header.

This change looks like a large change unless the diff viewer is
instructed to ignore whitespace changes (with e.g. "git show -w");
when removing the outer ifdef I reindent the inner preprocessor
defines and clarify the indentation structure in places with
mixed indentation step sizes.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2023-03-08 14:06:52 +02:00
parent ac7db0d3ff
commit ead648bf31

View File

@ -211,62 +211,52 @@ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
#define __has_builtin(x) 0
#endif
#if !defined(USE_NO_MINGW_SETJMP_TWO_ARGS)
# ifdef _UCRT
# ifdef _WIN64
# define _setjmp __intrinsic_setjmpex
# else
# define _setjmp __intrinsic_setjmp
# endif
# elif defined(__aarch64__)
/* ARM64 msvcrt.dll lacks _setjmp, only has _setjmpex. */
# define _setjmp _setjmpex
#ifdef _UCRT
# ifdef _WIN64
# define _setjmp __intrinsic_setjmpex
# else
# define _setjmp __intrinsic_setjmp
# endif
# 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
#elif defined(__aarch64__)
/* ARM64 msvcrt.dll lacks _setjmp, only has _setjmpex. */
# define _setjmp _setjmpex
#endif
#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_)
# 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__)
# elif (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
# define setjmp(BUF) _setjmp((BUF), mingw_getsp())
# else
# define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
# endif
# else
# define setjmp(BUF) _setjmp((BUF), NULL)
# define setjmp(BUF) _setjmp((BUF), __builtin_frame_address (0))
# endif
# else
# define setjmp(BUF) _setjmp((BUF), NULL)
# 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);
# else
# undef setjmp
# ifdef __SEH__
# if (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
#else
# undef setjmp
# ifdef __SEH__
# if (__MINGW_GCC_VERSION < 40702) && !defined(__clang__)
# define setjmp(BUF) _setjmpex((BUF), mingw_getsp())
# define setjmpex(BUF) _setjmpex((BUF), mingw_getsp())
# else
# else
# define setjmp(BUF) _setjmpex((BUF), __builtin_frame_address (0))
# define setjmpex(BUF) _setjmpex((BUF), __builtin_frame_address (0))
# endif
# else
# define setjmp(BUF) _setjmpex((BUF), NULL)
# define setjmpex(BUF) _setjmpex((BUF), NULL)
# endif
# else
# define setjmp(BUF) _setjmpex((BUF), NULL)
# define setjmpex(BUF) _setjmpex((BUF), NULL)
# endif
int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmpex(jmp_buf _Buf,void *_Ctx);
# endif
#else
# if !defined(_INC_SETJMPEX)
# define setjmp _setjmp
# endif
int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) setjmp(jmp_buf _Buf);
#endif
#pragma pop_macro("__has_builtin")