X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fcompiler-error.lisp;h=41a1d3b919912941534307d51196fbd634d2929b;hb=69e6aef5e6fb3bd682c7a2cbf774034d2ea58ee8;hp=f3b542636766c7e954fb38dfeae8cbe4fc4e9f89;hpb=ac93aa515b197d751dad85d70432ebc87fac420a;p=sbcl.git diff --git a/src/compiler/compiler-error.lisp b/src/compiler/compiler-error.lisp index f3b5426..41a1d3b 100644 --- a/src/compiler/compiler-error.lisp +++ b/src/compiler/compiler-error.lisp @@ -91,14 +91,27 @@ (let ((condition (coerce-to-condition datum arguments 'simple-program-error 'compiler-error))) (restart-case - (progn - (cerror "Replace form with call to ERROR." - 'compiler-error - :condition condition) - (funcall *compiler-error-bailout* condition) - (bug "Control returned from *COMPILER-ERROR-BAILOUT*.")) + (cerror "Replace form with call to ERROR." + 'compiler-error + :condition condition) (signal-error () - (error condition))))) + (error condition))) + (funcall *compiler-error-bailout* condition) + (bug "Control returned from *COMPILER-ERROR-BAILOUT*."))) + +(defmacro with-compiler-error-resignalling (&body body) + `(handler-bind + ((compiler-error + (lambda (c) + (if (boundp '*compiler-error-bailout*) + ;; if we're in the compiler, delegate either to a higher + ;; authority or, if that's us, back down to the + ;; outermost compiler handler... + (signal c) + ;; ... if we're not in the compiler, better signal the + ;; error straight away. + (invoke-restart 'signal-error))))) + ,@body)) (defun compiler-warn (datum &rest arguments) (apply #'warn datum arguments) @@ -108,10 +121,15 @@ (apply #'style-warn datum arguments) (values)) +(defun source-to-string (source) + (write-to-string source + :escape t :readably nil :pretty t + :circle t :array nil)) + (defun make-compiler-error-form (condition source) `(error 'compiled-program-error :message ,(princ-to-string condition) - :source ,(princ-to-string source))) + :source ,(source-to-string source))) ;;; Fatal compiler errors. We export FATAL-COMPILER-ERROR as an ;;; interface for errors that kill the compiler dead