1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

tests/checkasm: Simplify logic for WASI signal handling

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Zhao Zhili 2024-12-04 19:36:47 +08:00
parent ca889b1328
commit 018ec4fe5f
2 changed files with 5 additions and 18 deletions

View File

@ -771,9 +771,7 @@ static LONG NTAPI signal_handler(EXCEPTION_POINTERS *e) {
return EXCEPTION_CONTINUE_EXECUTION; /* never reached, but shuts up gcc */
}
#endif
#else
#ifndef _WASI_EMULATED_SIGNAL
#elif !defined(_WASI_EMULATED_SIGNAL)
static void signal_handler(int s);
static const struct sigaction signal_handler_act = {
@ -788,8 +786,6 @@ static void signal_handler(int s) {
checkasm_load_context(s);
}
}
#endif // _WASI_EMULATED_SIGNAL
#endif
/* Compares a string with a wildcard pattern. */
@ -938,13 +934,11 @@ int main(int argc, char *argv[])
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
AddVectoredExceptionHandler(0, signal_handler);
#endif
#else
#ifndef _WASI_EMULATED_SIGNAL
#elif !defined(_WASI_EMULATED_SIGNAL)
sigaction(SIGBUS, &signal_handler_act, NULL);
sigaction(SIGFPE, &signal_handler_act, NULL);
sigaction(SIGILL, &signal_handler_act, NULL);
sigaction(SIGSEGV, &signal_handler_act, NULL);
#endif // _WASI_EMULATED_SIGNAL
#endif
#if HAVE_PRCTL && defined(PR_SET_UNALIGN)
prctl(PR_SET_UNALIGN, PR_UNALIGN_SIGBUS);

View File

@ -66,23 +66,16 @@ typedef struct { CONTEXT c; int status; } checkasm_context;
#define checkasm_save_context() 0
#define checkasm_load_context() do {} while (0)
#endif
#else // _WIN32
#ifdef _WASI_EMULATED_SIGNAL
#elif defined(_WASI_EMULATED_SIGNAL)
#define checkasm_context void*
#define checkasm_save_context() 0
#define checkasm_load_context() do {} while (0)
#else // _WASI_EMULATED_SIGNAL
#else
#include <setjmp.h>
typedef sigjmp_buf checkasm_context;
#define checkasm_save_context() checkasm_handle_signal(sigsetjmp(checkasm_context_buf, 1))
#define checkasm_load_context(s) siglongjmp(checkasm_context_buf, s)
#endif // _WASI_EMULATED_SIGNAL
#endif // _WIN32
#endif
void checkasm_check_aacencdsp(void);
void checkasm_check_aacpsdsp(void);