mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-13 12:52:08 -08:00
Improved compiler handler example and processed the undefined-variable as warning
This commit is contained in:
parent
866cba66d7
commit
9c07ecd852
2 changed files with 10 additions and 7 deletions
|
|
@ -11,15 +11,18 @@ ECL 0.9l-p1:
|
|||
recommended procedure is to use HANDLER-BIND and _NOT_ to transfer control
|
||||
out of the handler, but to defer to the default ones.
|
||||
(use-package :c)
|
||||
(let ((messages nil))
|
||||
(let ((warnings nil))
|
||||
(with-compilation-unit ()
|
||||
(handler-bind ((compiler-error #'(lambda (c)
|
||||
(push c messages)
|
||||
(push c warnings)
|
||||
(abort)))
|
||||
(compiler-message #'(lambda (c) (push c messages))))
|
||||
(compile-file "foo.lsp")))
|
||||
(format t "~&;;; Printing messages")
|
||||
(loop for m in (nreverse messages)
|
||||
(compiler-message #'(lambda (c)
|
||||
(push c warnings)
|
||||
(muffle-warning))))
|
||||
(let ((*compile-verbose* nil))
|
||||
(compile-file "foo.lsp"))))
|
||||
(format t "~&;;; Printing compiler messages")
|
||||
(loop for m in (nreverse warnings)
|
||||
for i from 0
|
||||
do (format t "~&~@<;;; ~@;Message #~D~%~A~:>" i m)))
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@
|
|||
(format t "~&;;; Emitting code for ~s.~%" name))))
|
||||
|
||||
(defun undefined-variable (sym)
|
||||
(signal 'compiler-undefined-variable :name sym))
|
||||
(do-cmpwarn 'compiler-undefined-variable :name sym))
|
||||
|
||||
(defun baboon (&aux (*print-case* :upcase))
|
||||
(signal 'compiler-internal-error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue