From: Chris Hanson Date: Sat, 10 Nov 2018 07:03:30 +0000 (-0800) Subject: Fix problems when trying to compile under macOS. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~114 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e21064ab718f7c7726b8dc314c0a3831d6bf2a93;p=mit-scheme.git Fix problems when trying to compile under macOS. --- diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac index ff2ab757d..d40f5999c 100644 --- a/src/microcode/configure.ac +++ b/src/microcode/configure.ac @@ -238,12 +238,13 @@ if test x"${GCC}" = xyes; then -Wno-error=stringop-truncation \ ; do AC_MSG_CHECKING([for compiler warning $flag]) - SAVED_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $flag" + SAVED_CFLAGS=${CFLAGS} + CFLAGS="${SAVED_CFLAGS} ${flag} -Werror" AC_TRY_COMPILE([],[], - [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(yes) + CFLAGS="${SAVED_CFLAGS} ${flag}"], [AC_MSG_RESULT(no) - CFLAGS="$SAVED_CFLAGS"]) + CFLAGS=${SAVED_CFLAGS}]) done # other possibilities: diff --git a/src/microcode/uxtrap.c b/src/microcode/uxtrap.c index aecdc5a2f..b3943349a 100644 --- a/src/microcode/uxtrap.c +++ b/src/microcode/uxtrap.c @@ -199,7 +199,7 @@ trap_handler (const char * message, SIGINFO_T info, SIGCONTEXT_T * scp) { - int code = ((SIGINFO_VALID_P (info)) ? (SIGINFO_CODE (info)) : 0); + int code = (SIGINFO_CODE (info)); bool stack_overflowed_p = (STACK_OVERFLOWED_P ()); enum trap_state old_trap_state = trap_state; @@ -243,9 +243,7 @@ trap_handler (const char * message, ">> [The earlier trap raised signal %d (%s), code %d.]\n", saved_signo, (find_signal_name (saved_signo)), - ((SIGINFO_VALID_P (saved_info)) - ? (SIGINFO_CODE (saved_info)) - : 0)); + (SIGINFO_CODE (saved_info))); fprintf (stdout, ">> Successful recovery is %sunlikely.\n", ((WITHIN_CRITICAL_SECTION_P ()) ? "extremely " : "")); } @@ -680,7 +678,10 @@ find_signal_code_name (int signo, SIGINFO_T info, SIGCONTEXT_T * scp) { unsigned long code = 0; const char * name = 0; +#ifdef HAVE_REAL_SIGINFO_T +#ifdef SIGINFO_VALID_P if (SIGINFO_VALID_P (info)) +#endif { code = (SIGINFO_CODE (info)); SPECIAL_SIGNAL_CODE_NAMES (); @@ -698,6 +699,7 @@ find_signal_code_name (int signo, SIGINFO_T info, SIGCONTEXT_T * scp) entry += 1; } } +#endif /* HAVE_REAL_SIGINFO_T */ return (cons ((ulong_to_integer (code)), ((name == 0) @@ -731,6 +733,7 @@ classify_pc (unsigned long pc, (*r_block_addr) = block_addr; return (pcl_constant); } +#ifdef ADDRESS_UCODE_P if (ADDRESS_UCODE_P (pc)) { int index = (pc_to_builtin_index (pc)); @@ -750,6 +753,7 @@ classify_pc (unsigned long pc, if ((OBJECT_TYPE (GET_PRIMITIVE)) == TC_PRIMITIVE) return (pcl_primitive); } +#endif /* ADDRESS_UCODE_P */ } #else if ((ADDRESS_UCODE_P (pc)) diff --git a/src/microcode/uxtrap.h b/src/microcode/uxtrap.h index 3ad7998c1..be3880017 100644 --- a/src/microcode/uxtrap.h +++ b/src/microcode/uxtrap.h @@ -334,8 +334,9 @@ struct full_sigcontext #endif #define SIGINFO_T siginfo_t * +#define HAVE_REAL_SIGINFO_T 1 #define SIGINFO_VALID_P(info) ((info) != 0) -#define SIGINFO_CODE(info) ((info) -> si_code) +#define SIGINFO_CODE(info) (((info) != 0) ? ((info) -> si_code) : (0)) #define __SIGCONTEXT_REG(scp, ir) ((((scp) -> uc_mcontext) . gregs) [(ir)]) @@ -390,7 +391,7 @@ struct full_sigcontext #endif /* mips */ #ifdef __IA32__ - + #if defined(__FreeBSD__) || defined(__DragonFly__) # include #endif @@ -740,7 +741,8 @@ typedef struct #ifdef HAVE_SIGACTION_SIGINFO_SIGNALS # define SIGINFO_T siginfo_t * -# define SIGINFO_VALID_P(info) (1) +# define HAVE_REAL_SIGINFO_T 1 +# undef SIGINFO_VALID_P # define SIGINFO_CODE(info) ((info) -> si_code) # define SIGCONTEXT_ARG_T void # define SIGCONTEXT_T ucontext_t @@ -748,7 +750,8 @@ typedef struct #ifndef SIGINFO_T # define SIGINFO_T int -# define SIGINFO_VALID_P(info) (0) +# undef HAVE_REAL_SIGINFO_T +# undef SIGINFO_VALID_P # define SIGINFO_CODE(info) (0) #endif @@ -809,10 +812,6 @@ typedef struct #ifdef __CYGWIN__ extern unsigned int end; #endif - -#ifndef ADDRESS_UCODE_P -# define ADDRESS_UCODE_P(addr) (0) -#endif /* Machine/OS-independent section */