From 840f5a3fa4c9142fd0d63dea8e8b76bce49aaf67 Mon Sep 17 00:00:00 2001 From: "Tobias C. Rittweiler" Date: Wed, 16 Dec 2009 09:58:54 +0000 Subject: [PATCH] 1.0.33.13: Catch errors during compile-time-too processing. * Errors signaled within an (EVAL-WHEN (:COMPILE-TOPLEVEL) ...), i.e. during ``compile-time-too' processing, are now caught and reported just like errors at macroexpansion time. Previously, we landed in the debugger from within the compiler and thus provided pretty much no information about the actual source context to the user. Now, we won't land in the debugger, and the appropriate source context is reported along the error. * Some slight generalization in the test suite. * So we can add tests for errors in EVAL-WHEN and during macroexpansion. --- NEWS | 2 ++ src/compiler/main.lisp | 5 ++++- tests/compiler.test.sh | 22 +++++++++++++++++----- tests/expect.sh | 22 +++++++++++----------- version.lisp-expr | 2 +- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 3d11b7d..bb01da4 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ changes relative to sbcl-1.0.33: * enhancement: SB-INTROSPECT:DEFTYPE-LAMBDA-LIST now also works on most builtin types. + * enhancement: Errors during compile-time-too processing (i.e. EVAL-WHEN) + are now caught and reported just like errors during macroexpansion. * bug fix: #p"\\\\" can now be read without error on Win32. (reported by Willem Broekema; launchpad bug lp#489698). * bug fix: some minor code rearrangements to reenable warning-free building diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index df17921..49078b9 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -1206,7 +1206,10 @@ ;;; compilation. Normally just evaluate in the appropriate ;;; environment, but also compile if outputting a CFASL. (defun eval-compile-toplevel (body path) - (eval-in-lexenv `(progn ,@body) *lexenv*) + (handler-case (eval-in-lexenv `(progn ,@body) *lexenv*) + (error (condition) + (compiler-error "(during compile-time-too processing)~%~A" + condition))) (when *compile-toplevel-object* (let ((*compile-object* *compile-toplevel-object*)) (convert-and-maybe-compile `(progn ,@body) path)))) diff --git a/tests/compiler.test.sh b/tests/compiler.test.sh index 57a37a4..bac5690 100644 --- a/tests/compiler.test.sh +++ b/tests/compiler.test.sh @@ -156,7 +156,7 @@ cat > $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename <