diff --git a/src/bindings.lisp b/src/bindings.lisp index 2697da4e..37d12414 100644 --- a/src/bindings.lisp +++ b/src/bindings.lisp @@ -131,14 +131,15 @@ ;; use a jump buffer of type intptr_t[5] instead of jmp_buf (see ;; https://gcc.gnu.org/onlinedocs/gcc/Nonlocal-Gotos.html). #-win32 - (format stream "__thread jmp_buf fatal_lisp_error_handler;~%~%") + (format stream "__thread jmp_buf fatal_lisp_error_handler;~%") #+win32 - (format stream "__thread intptr_t fatal_lisp_error_handler[5];~%~%") + (format stream "__thread intptr_t fatal_lisp_error_handler[5];~%") + (format stream "#ifdef __clang__~%# define JMP_BUF_CAST (void **)~%#else~%# define JMP_BUF_CAST~%#endif~%~%") (when (sb-sys:find-foreign-symbol-address "set_lossage_handler") (format stream "void set_lossage_handler(void (*handler)(void));~%")) (format stream "void ldb_monitor(void);~%~%") (format stream "int fatal_sbcl_error_occurred = 0;~%~%") - (format stream "void return_from_lisp(void) { fatal_sbcl_error_occurred = 1; fflush(stdout); fflush(stderr); ~a(fatal_lisp_error_handler, 1); }~%~%" + (format stream "void return_from_lisp(void) { fatal_sbcl_error_occurred = 1; fflush(stdout); fflush(stderr); ~a(JMP_BUF_CAST fatal_lisp_error_handler, 1); }~%~%" *longjmp-operator*) (dolist (api (library-apis library)) (write-api-to-source api stream)) diff --git a/src/function.lisp b/src/function.lisp index c09155c2..0dbb0f8e 100644 --- a/src/function.lisp +++ b/src/function.lisp @@ -96,7 +96,7 @@ if (!setjmp(fatal_lisp_error_handler)) { (list "result")))))) (format nil "~a {~%~a~%}~%" header - (format nil " if (!fatal_sbcl_error_occurred && !~a((void **) fatal_lisp_error_handler)) { + (format nil " if (!fatal_sbcl_error_occurred && !~a(JMP_BUF_CAST fatal_lisp_error_handler)) { ~a } else { ~a