From 8e7173ae9687b70742c395eac84b587c923fb2f8 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 7 Jun 2004 01:01:33 +0000 Subject: [PATCH] Use "sigsetjmp" instead of "setjmp", because "setjmp" may be a macro on some systems. --- ChangeLog | 3 +++ configure.in | 1 + jit/jit-insn.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5541f44..5cfb54d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ * jit/jit-value.c: fix a warning. + * configure.in, jit/jit-insn.c: use "sigsetjmp" instead of + "setjmp", because "setjmp" may be a macro on some systems. + 2004-06-06 Miroslaw Dobrzanski-Neumann * jit/jit-alloc.c (jit_flush_exec): flush cache lines properly diff --git a/configure.in b/configure.in index 0c2a8b5..d5c50ec 100644 --- a/configure.in +++ b/configure.in @@ -419,6 +419,7 @@ AC_CHECK_FUNCS(isnanl isinfl finitel fmodl remainderl dreml ceill floorl) AC_CHECK_FUNCS(acosl asinl atanl atan2l cosl coshl expl logl log10l powl) AC_CHECK_FUNCS(sinl sinhl sqrtl tanl tanhl) AC_CHECK_FUNCS(dlopen cygwin_conv_to_win32_path mmap munmap mprotect) +AC_CHECK_FUNCS(sigsetjmp __sigsetjmp) AC_FUNC_ALLOCA AC_OUTPUT([ diff --git a/jit/jit-insn.c b/jit/jit-insn.c index 4df7765..994b1a4 100644 --- a/jit/jit-insn.c +++ b/jit/jit-insn.c @@ -6397,7 +6397,7 @@ static int initialize_setjmp_block(jit_function_t func) jit_label_t end_label = jit_label_undefined; jit_label_t rethrow_label = jit_label_undefined; jit_type_t type; - jit_value_t args[1]; + jit_value_t args[2]; jit_value_t value; /* Bail out if we have already done this before */ @@ -6443,7 +6443,37 @@ static int initialize_setjmp_block(jit_function_t func) (void *)_jit_unwind_push_setjmp, type, args, 1, JIT_CALL_NOTHROW); jit_type_free(type); - /* Call "setjmp" with "&setjmp_value" as its argument */ + /* Call "__sigsetjmp" or "setjmp" with "&setjmp_value" as its argument. + We prefer "__sigsetjmp" because it is least likely to be a macro */ +#if defined(HAVE___SIGSETJMP) || defined(HAVE_SIGSETJMP) + { + jit_type_t params[2]; + params[0] = jit_type_void_ptr; + params[1] = jit_type_sys_int; + type = jit_type_create_signature + (jit_abi_cdecl, jit_type_int, params, 2, 1); + } + if(!type) + { + return 0; + } + args[0] = jit_insn_address_of(func, func->builder->setjmp_value); + args[1] = jit_value_create_nint_constant(func, jit_type_sys_int, 1); +#if defined(HAVE___SIGSETJMP) + value = jit_insn_call_native + (func, "__sigsetjmp", (void *)__sigsetjmp, + type, args, 2, JIT_CALL_NOTHROW); +#else + value = jit_insn_call_native + (func, "sigsetjmp", (void *)sigsetjmp, + type, args, 2, JIT_CALL_NOTHROW); +#endif + jit_type_free(type); + if(!value) + { + return 0; + } +#else /* !HAVE_SIGSETJMP */ type = jit_type_void_ptr; type = jit_type_create_signature (jit_abi_cdecl, jit_type_int, &type, 1, 1); @@ -6459,6 +6489,7 @@ static int initialize_setjmp_block(jit_function_t func) { return 0; } +#endif /* !HAVE_SIGSETJMP */ /* Branch to the end of the init code if "setjmp" returned zero */ if(!jit_insn_branch_if_not(func, value, &end_label)) -- 2.47.3