Skip to content

Commit

Permalink
Cast jmp_buf on clang
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-s committed Jul 5, 2024
1 parent 8d99e39 commit e9c4e3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/bindings.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/function.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9c4e3a

Please sign in to comment.