X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fcompiler-error.lisp;h=aa597ce10a81481e281f431130854bed8dba2ef1;hb=70b392926636cc0d870a6e4e7dd8b574f998633d;hp=bd19505a80ae4ef3c991cd8b25f07d7eb4c26379;hpb=fea8ea02847ddc0864546a02480fb3e97d6fa318;p=sbcl.git diff --git a/src/compiler/compiler-error.lisp b/src/compiler/compiler-error.lisp index bd19505..aa597ce 100644 --- a/src/compiler/compiler-error.lisp +++ b/src/compiler/compiler-error.lisp @@ -82,7 +82,7 @@ ;;; CSR, 2003-05-13 (define-condition compiler-error (encapsulated-condition) () (:report (lambda (condition stream) - (print-object (encapsulated-condition condition) stream)))) + (print-object (encapsulated-condition condition) stream)))) ;;; Signal the appropriate condition. COMPILER-ERROR calls the bailout ;;; function so that it never returns (but compilation continues). @@ -100,31 +100,32 @@ (signal-error () (error condition))))) -(declaim (ftype (function (string &rest t) (values)) - compiler-warn compiler-style-warn)) -(defun compiler-warn (format-string &rest format-args) - (apply #'warn format-string format-args) +(defun compiler-warn (datum &rest arguments) + (apply #'warn datum arguments) (values)) -(defun compiler-style-warn (format-string &rest format-args) - (apply #'style-warn format-string format-args) +(defun compiler-style-warn (datum &rest arguments) + (apply #'style-warn datum arguments) (values)) (defun make-compiler-error-form (condition source) - ;; The condition must be literal so the this form kicks off the - ;; MAKE-LOAD-FORM in the file-compiler for COMPILED-PROGRAM-ERROR, - ;; not the encapsulated condition. - `(error ,(make-condition 'compiled-program-error - :condition condition - :source source))) + `(error 'compiled-program-error + :message ,(princ-to-string condition) + :source ,(princ-to-string source))) + +;;; Fatal compiler errors. We export FATAL-COMPILER-ERROR as an +;;; interface for errors that kill the compiler dead +;;; +;;; These are not a COMPILER-ERRORs, since we don't try to recover +;;; from them and keep chugging along, but instead immediately bail +;;; out of the entire COMPILE-FILE. + +(define-condition fatal-compiler-error (encapsulated-condition) + ()) ;;; the condition of COMPILE-FILE being unable to READ from the ;;; source file ;;; -;;; This is not a COMPILER-ERROR, since we don't try to recover from -;;; it and keep chugging along, but instead immediately bail out of -;;; the entire COMPILE-FILE. -;;; ;;; (The old CMU CL code did try to recover from this condition, but ;;; the code for doing that was messy and didn't always work right. ;;; Since in Common Lisp the simple act of reading and compiling code @@ -133,20 +134,17 @@ ;;; deeply confused, so we violate what'd otherwise be good compiler ;;; practice by not trying to recover from this error and bailing out ;;; instead.) -(define-condition input-error-in-compile-file (error) - (;; the original error which was trapped to produce this condition - (error :reader input-error-in-compile-file-error - :initarg :error) - ;; the position where the bad READ began, or NIL if unavailable, +(define-condition input-error-in-compile-file (fatal-compiler-error) + (;; the position where the bad READ began, or NIL if unavailable, ;; redundant, or irrelevant (position :reader input-error-in-compile-file-position - :initarg :position - :initform nil)) + :initarg :position + :initform nil)) (:report (lambda (condition stream) (format stream - "~@<~S failure in ~S~@[ at character ~W~]: ~2I~_~A~:>" - 'read - 'compile-file - (input-error-in-compile-file-position condition) - (input-error-in-compile-file-error condition))))) + "~@<~S failure in ~S~@[ at character ~W~]: ~2I~_~A~:>" + 'read + 'compile-file + (input-error-in-compile-file-position condition) + (encapsulated-condition condition)))))