1 ;;;; stuff originally from CMU CL's error.lisp which can or should
2 ;;;; come late (mostly related to the CONDITION class itself)
4 ;;;; FIXME: should perhaps be called condition.lisp, or moved into
7 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; This software is derived from the CMU CL system, which was
11 ;;;; written at Carnegie Mellon University and released into the
12 ;;;; public domain. The software is in the public domain and is
13 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
14 ;;;; files for more information.
16 (in-package "SB!KERNEL")
18 ;;;; the CONDITION class
20 (/show0 "late-target-error.lisp 20")
22 (eval-when (:compile-toplevel :load-toplevel :execute)
24 (def!struct (condition-class (:include slot-class)
25 (:constructor bare-make-condition-class))
26 ;; list of CONDITION-SLOT structures for the direct slots of this
28 (slots nil :type list)
29 ;; list of CONDITION-SLOT structures for all of the effective class
30 ;; slots of this class
31 (class-slots nil :type list)
32 ;; report function or NIL
33 (report nil :type (or function null))
34 ;; list of alternating initargs and initforms
35 (default-initargs () :type list)
36 ;; class precedence list as a list of class objects, with all
37 ;; non-condition classes removed
39 ;; a list of all the effective instance allocation slots of this
40 ;; class that have a non-constant initform or default-initarg.
41 ;; Values for these slots must be computed in the dynamic
42 ;; environment of MAKE-CONDITION.
43 (hairy-slots nil :type list))
45 (defun make-condition-class (&rest rest)
46 (apply #'bare-make-condition-class
47 (rename-key-args '((:name :%name)) rest)))
52 (:constructor make-condition-object (actual-initargs))
53 (:alternate-metaclass instance
57 ;; actual initargs supplied to MAKE-CONDITION
58 (actual-initargs (required-argument) :type list)
59 ;; a plist mapping slot names to any values that were assigned or
60 ;; defaulted after creation
61 (assigned-slots () :type list))
63 (defstruct (condition-slot (:copier nil))
64 (name (required-argument) :type symbol)
65 ;; list of all applicable initargs
66 (initargs (required-argument) :type list)
67 ;; names of reader and writer functions
68 (readers (required-argument) :type list)
69 (writers (required-argument) :type list)
70 ;; true if :INITFORM was specified
71 (initform-p (required-argument) :type (member t nil))
72 ;; If this is a function, call it with no args. Otherwise, it's the
74 (initform (required-argument) :type t)
75 ;; allocation of this slot, or NIL until defaulted
76 (allocation nil :type (member :instance :class nil))
77 ;; If ALLOCATION is :CLASS, this is a cons whose car holds the value.
78 (cell nil :type (or cons null)))
80 ;;; KLUDGE: It's not clear to me why CONDITION-CLASS has itself listed
81 ;;; in its CPL, while other classes derived from CONDITION-CLASS don't
82 ;;; have themselves listed in their CPLs. This behavior is inherited
83 ;;; from CMU CL, and didn't seem to be explained there, and I haven't
84 ;;; figured out whether it's right. -- WHN 19990612
85 (eval-when (:compile-toplevel :load-toplevel :execute)
86 (let ((condition-class (locally
87 ;; KLUDGE: There's a FIND-CLASS DEFTRANSFORM for
88 ;; constant class names which creates fast but
89 ;; non-cold-loadable, non-compact code. In this
90 ;; context, we'd rather have compact, cold-loadable
91 ;; code. -- WHN 19990928
92 (declare (notinline sb!xc:find-class))
93 (sb!xc:find-class 'condition))))
94 (setf (condition-class-cpl condition-class)
95 (list condition-class))))
97 (setf (condition-class-report (locally
98 ;; KLUDGE: There's a FIND-CLASS DEFTRANSFORM
99 ;; for constant class names which creates fast
100 ;; but non-cold-loadable, non-compact code. In
101 ;; this context, we'd rather have compact,
102 ;; cold-loadable code. -- WHN 19990928
103 (declare (notinline sb!xc:find-class))
104 (find-class 'condition)))
105 #'(lambda (cond stream)
106 (format stream "Condition ~S was signalled." (type-of cond))))
108 (eval-when (:compile-toplevel :load-toplevel :execute)
110 (defun find-condition-layout (name parent-types)
111 (let* ((cpl (remove-duplicates
114 (mapcar #'(lambda (x)
116 (sb!xc:find-class x)))
118 (cond-layout (info :type :compiler-layout 'condition))
119 (olayout (info :type :compiler-layout name))
120 ;; FIXME: Does this do the right thing in case of multiple
121 ;; inheritance? A quick look at DEFINE-CONDITION didn't make
122 ;; it obvious what ANSI intends to be done in the case of
123 ;; multiple inheritance, so it's not actually clear what the
126 (order-layout-inherits (concatenate 'simple-vector
127 (layout-inherits cond-layout)
128 (mapcar #'class-layout cpl)))))
130 (not (mismatch (layout-inherits olayout) new-inherits)))
132 (make-layout :class (make-undefined-class name)
133 :inherits new-inherits
135 :length (layout-length cond-layout)))))
139 ;;; FIXME: ANSI's definition of DEFINE-CONDITION says
140 ;;; Condition reporting is mediated through the PRINT-OBJECT method
141 ;;; for the condition type in question, with *PRINT-ESCAPE* always
142 ;;; being nil. Specifying (:REPORT REPORT-NAME) in the definition of
143 ;;; a condition type C is equivalent to:
144 ;;; (defmethod print-object ((x c) stream)
145 ;;; (if *print-escape* (call-next-method) (report-name x stream)))
146 ;;; The current code doesn't seem to quite match that.
147 (def!method print-object ((x condition) stream)
149 (print-unreadable-object (x stream :type t :identity t))
150 ;; KLUDGE: A comment from CMU CL here said
151 ;; 7/13/98 BUG? CPL is not sorted and results here depend on order of
152 ;; superclasses in define-condition call!
153 (dolist (class (condition-class-cpl (sb!xc:class-of x))
154 (error "no REPORT? shouldn't happen!"))
155 (let ((report (condition-class-report class)))
157 (return (funcall report x stream)))))))
159 ;;;; slots of CONDITION objects
161 (defvar *empty-condition-slot* '(empty))
163 (defun find-slot-default (class slot)
164 (let ((initargs (condition-slot-initargs slot))
165 (cpl (condition-class-cpl class)))
167 (let ((default-initargs (condition-class-default-initargs class)))
168 (dolist (initarg initargs)
169 (let ((val (getf default-initargs initarg *empty-condition-slot*)))
170 (unless (eq val *empty-condition-slot*)
171 (return-from find-slot-default
176 (if (condition-slot-initform-p slot)
177 (let ((initform (condition-slot-initform slot)))
178 (if (functionp initform)
181 (error "unbound condition slot: ~S" (condition-slot-name slot)))))
183 (defun find-condition-class-slot (condition-class slot-name)
185 (condition-class-cpl condition-class)
186 (error "There is no slot named ~S in ~S."
187 slot-name condition-class))
188 (dolist (slot (condition-class-slots sclass))
189 (when (eq (condition-slot-name slot) slot-name)
190 (return-from find-condition-class-slot slot)))))
192 (defun condition-writer-function (condition new-value name)
193 (dolist (cslot (condition-class-class-slots
194 (layout-class (%instance-layout condition)))
195 (setf (getf (condition-assigned-slots condition) name)
197 (when (eq (condition-slot-name cslot) name)
198 (return (setf (car (condition-slot-cell cslot)) new-value)))))
200 (defun condition-reader-function (condition name)
201 (let ((class (layout-class (%instance-layout condition))))
202 (dolist (cslot (condition-class-class-slots class))
203 (when (eq (condition-slot-name cslot) name)
204 (return-from condition-reader-function
205 (car (condition-slot-cell cslot)))))
207 (let ((val (getf (condition-assigned-slots condition) name
208 *empty-condition-slot*)))
209 (if (eq val *empty-condition-slot*)
210 (let ((actual-initargs (condition-actual-initargs condition))
211 (slot (find-condition-class-slot class name)))
213 (error "missing slot ~S of ~S" name condition))
214 (dolist (initarg (condition-slot-initargs slot))
215 (let ((val (getf actual-initargs
217 *empty-condition-slot*)))
218 (unless (eq val *empty-condition-slot*)
219 (return-from condition-reader-function
220 (setf (getf (condition-assigned-slots condition)
223 (setf (getf (condition-assigned-slots condition) name)
224 (find-slot-default class slot)))
229 (defun make-condition (thing &rest args)
231 "Make an instance of a condition object using the specified initargs."
232 ;; Note: ANSI specifies no exceptional situations in this function.
233 ;; signalling simple-type-error would not be wrong.
234 (let* ((thing (if (symbolp thing)
235 (sb!xc:find-class thing)
237 (class (typecase thing
238 (condition-class thing)
240 (error 'simple-type-error
242 :expected-type 'condition-class
243 :format-control "~S is not a condition class."
244 :format-arguments (list thing)))
246 (error 'simple-type-error
248 :expected-type 'condition-class
249 :format-control "bad thing for class argument:~% ~S"
250 :format-arguments (list thing)))))
251 (res (make-condition-object args)))
252 (setf (%instance-layout res) (class-layout class))
253 ;; Set any class slots with initargs present in this call.
254 (dolist (cslot (condition-class-class-slots class))
255 (dolist (initarg (condition-slot-initargs cslot))
256 (let ((val (getf args initarg *empty-condition-slot*)))
257 (unless (eq val *empty-condition-slot*)
258 (setf (car (condition-slot-cell cslot)) val)))))
259 ;; Default any slots with non-constant defaults now.
260 (dolist (hslot (condition-class-hairy-slots class))
261 (when (dolist (initarg (condition-slot-initargs hslot) t)
262 (unless (eq (getf args initarg *empty-condition-slot*)
263 *empty-condition-slot*)
265 (setf (getf (condition-assigned-slots res) (condition-slot-name hslot))
266 (find-slot-default class hslot))))
270 ;;;; DEFINE-CONDITION
272 (eval-when (:compile-toplevel :load-toplevel :execute)
273 (defun %compiler-define-condition (name direct-supers layout)
274 (multiple-value-bind (class old-layout)
275 (insured-find-class name #'condition-class-p #'make-condition-class)
276 (setf (layout-class layout) class)
277 (setf (class-direct-superclasses class)
278 (mapcar #'sb!xc:find-class direct-supers))
279 (cond ((not old-layout)
280 (register-layout layout))
281 ((not *type-system-initialized*)
282 (setf (layout-class old-layout) class)
283 (setq layout old-layout)
284 (unless (eq (class-layout class) layout)
285 (register-layout layout)))
286 ((redefine-layout-warning "current"
289 (layout-length layout)
290 (layout-inherits layout)
291 (layout-depthoid layout))
292 (register-layout layout :invalidate t))
293 ((not (class-layout class))
294 (register-layout layout)))
296 (setf (layout-info layout)
298 ;; KLUDGE: There's a FIND-CLASS DEFTRANSFORM for constant class
299 ;; names which creates fast but non-cold-loadable, non-compact
300 ;; code. In this context, we'd rather have compact, cold-loadable
301 ;; code. -- WHN 19990928
302 (declare (notinline sb!xc:find-class))
303 (layout-info (class-layout (sb!xc:find-class 'condition)))))
305 (setf (sb!xc:find-class name) class)
307 ;; Initialize CPL slot.
308 (setf (condition-class-cpl class)
309 (remove-if-not #'condition-class-p
310 (std-compute-class-precedence-list class))))
315 ;;; Compute the effective slots of class, copying inherited slots and
316 ;;; side-effecting direct slots.
317 (defun compute-effective-slots (class)
318 (collect ((res (copy-list (condition-class-slots class))))
319 (dolist (sclass (condition-class-cpl class))
320 (dolist (sslot (condition-class-slots sclass))
321 (let ((found (find (condition-slot-name sslot) (res)
324 (setf (condition-slot-initargs found)
325 (union (condition-slot-initargs found)
326 (condition-slot-initargs sslot)))
327 (unless (condition-slot-initform-p found)
328 (setf (condition-slot-initform-p found)
329 (condition-slot-initform-p sslot))
330 (setf (condition-slot-initform found)
331 (condition-slot-initform sslot)))
332 (unless (condition-slot-allocation found)
333 (setf (condition-slot-allocation found)
334 (condition-slot-allocation sslot))))
336 (res (copy-structure sslot)))))))
339 (defun %define-condition (name slots documentation report default-initargs)
340 (let ((class (sb!xc:find-class name)))
341 (setf (condition-class-slots class) slots)
342 (setf (condition-class-report class) report)
343 (setf (condition-class-default-initargs class) default-initargs)
344 (setf (fdocumentation name 'type) documentation)
348 ;; Set up reader and writer functions.
349 (let ((name (condition-slot-name slot)))
350 (dolist (reader (condition-slot-readers slot))
351 (setf (fdefinition reader)
352 #'(lambda (condition)
353 (condition-reader-function condition name))))
354 (dolist (writer (condition-slot-writers slot))
355 (setf (fdefinition writer)
356 #'(lambda (new-value condition)
357 (condition-writer-function condition new-value name))))))
359 ;; Compute effective slots and set up the class and hairy slots
360 ;; (subsets of the effective slots.)
361 (let ((eslots (compute-effective-slots class))
364 (mapcar #'condition-class-default-initargs
365 (condition-class-cpl class)))))
366 (dolist (slot eslots)
367 (ecase (condition-slot-allocation slot)
369 (unless (condition-slot-cell slot)
370 (setf (condition-slot-cell slot)
371 (list (if (condition-slot-initform-p slot)
372 (let ((initform (condition-slot-initform slot)))
373 (if (functionp initform)
376 *empty-condition-slot*))))
377 (push slot (condition-class-class-slots class)))
379 (setf (condition-slot-allocation slot) :instance)
380 (when (or (functionp (condition-slot-initform slot))
381 (dolist (initarg (condition-slot-initargs slot) nil)
382 (when (functionp (getf e-def-initargs initarg))
384 (push slot (condition-class-hairy-slots class))))))))
387 (defmacro define-condition (name (&rest parent-types) (&rest slot-specs)
390 "DEFINE-CONDITION Name (Parent-Type*) (Slot-Spec*) Option*
391 Define NAME as a condition type. This new type inherits slots and its
392 report function from the specified PARENT-TYPEs. A slot spec is a list of:
393 (slot-name :reader <rname> :initarg <iname> {Option Value}*
395 The DEFINE-CLASS slot options :ALLOCATION, :INITFORM, [slot] :DOCUMENTATION
396 and :TYPE and the overall options :DEFAULT-INITARGS and
397 [type] :DOCUMENTATION are also allowed.
399 The :REPORT option is peculiar to DEFINE-CONDITION. Its argument is either
400 a string or a two-argument lambda or function name. If a function, the
401 function is called with the condition and stream to report the condition.
402 If a string, the string is printed.
404 Condition types are classes, but (as allowed by ANSI and not as described in
405 CLtL2) are neither STANDARD-OBJECTs nor STRUCTURE-OBJECTs. WITH-SLOTS and
406 SLOT-VALUE may not be used on condition objects."
407 (let* ((parent-types (or parent-types '(condition)))
408 (layout (find-condition-layout name parent-types))
411 (default-initargs ()))
413 (all-readers nil append)
414 (all-writers nil append))
415 (dolist (spec slot-specs)
416 (when (keywordp spec)
417 (warn "Keyword slot name indicates probable syntax error:~% ~S"
419 (let* ((spec (if (consp spec) spec (list spec)))
420 (slot-name (first spec))
421 (allocation :instance)
427 (do ((options (rest spec) (cddr options)))
429 (unless (and (consp options) (consp (cdr options)))
430 (error "malformed condition slot spec:~% ~S." spec))
431 (let ((arg (second options)))
432 (case (first options)
433 (:reader (readers arg))
434 (:writer (writers arg))
437 (writers `(setf ,arg)))
440 (error "more than one :INITFORM in ~S" spec))
443 (:initarg (initargs arg))
445 (setq allocation arg))
448 (error "unknown slot option:~% ~S" (first options))))))
450 (all-readers (readers))
451 (all-writers (writers))
452 (slots `(make-condition-slot
454 :initargs ',(initargs)
457 :initform-p ',initform-p
459 ,(if (constantp initform)
461 `#'(lambda () ,initform)))))))
463 (dolist (option options)
464 (unless (consp option)
465 (error "bad option:~% ~S" option))
467 (:documentation (setq documentation (second option)))
469 (let ((arg (second option)))
472 `#'(lambda (condition stream)
473 (declare (ignore condition))
474 (write-string ,arg stream))
475 `#'(lambda (condition stream)
476 (funcall #',arg condition stream))))))
478 (do ((initargs (rest option) (cddr initargs)))
480 (let ((val (second initargs)))
481 (setq default-initargs
482 (list* `',(first initargs)
486 default-initargs)))))
488 (error "unknown option: ~S" (first option)))))
491 (warn "Condition slot setters probably not allowed in ANSI CL:~% ~S"
495 (eval-when (:compile-toplevel :load-toplevel :execute)
496 (%compiler-define-condition ',name ',parent-types ',layout))
498 (declaim (ftype (function (t) t) ,@(all-readers)))
499 (declaim (ftype (function (t t) t) ,@(all-writers)))
501 (%define-condition ',name
505 (list ,@default-initargs))))))
507 ;;;; DESCRIBE on CONDITIONs
509 ;;; a function to be used as the guts of DESCRIBE-OBJECT (CONDITION T)
510 ;;; eventually (once we get CLOS up and running so that we can define
512 (defun describe-condition (condition stream)
514 "~@<~S ~_is a ~S. ~_Its slot values are ~_~S.~:>"
518 (condition-actual-initargs condition)
519 (condition-assigned-slots condition))))
521 ;;;; various CONDITIONs specified by ANSI
523 (define-condition serious-condition (condition) ())
525 (define-condition error (serious-condition) ())
527 (define-condition warning (condition) ())
528 (define-condition style-warning (warning) ())
530 (defun simple-condition-printer (condition stream)
533 (simple-condition-format-control condition)
534 (simple-condition-format-arguments condition)))
536 (define-condition simple-condition ()
537 ((format-control :reader simple-condition-format-control
538 :initarg :format-control)
539 (format-arguments :reader simple-condition-format-arguments
540 :initarg :format-arguments
542 (:report simple-condition-printer))
544 (define-condition simple-warning (simple-condition warning) ())
546 (define-condition simple-error (simple-condition error) ())
548 (define-condition storage-condition (serious-condition) ())
550 (define-condition type-error (error)
551 ((datum :reader type-error-datum :initarg :datum)
552 (expected-type :reader type-error-expected-type :initarg :expected-type))
554 (lambda (condition stream)
556 "~@<The value ~2I~:_~S ~I~_is not of type ~2I~_~S.~:>"
557 (type-error-datum condition)
558 (type-error-expected-type condition)))))
560 (define-condition simple-type-error (simple-condition type-error) ())
562 (define-condition program-error (error) ())
563 (define-condition parse-error (error) ())
564 (define-condition control-error (error) ())
565 (define-condition stream-error (error)
566 ((stream :reader stream-error-stream :initarg :stream)))
568 (define-condition end-of-file (stream-error) ()
570 (lambda (condition stream)
573 (stream-error-stream condition)))))
575 (define-condition file-error (error)
576 ((pathname :reader file-error-pathname :initarg :pathname))
578 (lambda (condition stream)
580 "~@<error on file ~_~S: ~2I~:_~?~:>"
581 (file-error-pathname condition)
582 ;; FIXME: ANSI's FILE-ERROR doesn't have FORMAT-CONTROL and
583 ;; FORMAT-ARGUMENTS, and the inheritance here doesn't seem
584 ;; to give us FORMAT-CONTROL or FORMAT-ARGUMENTS either.
585 ;; So how does this work?
586 (serious-condition-format-control condition)
587 (serious-condition-format-arguments condition)))))
589 (define-condition package-error (error)
590 ((package :reader package-error-package :initarg :package)))
592 (define-condition cell-error (error)
593 ((name :reader cell-error-name :initarg :name)))
595 (define-condition unbound-variable (cell-error) ()
597 (lambda (condition stream)
599 "The variable ~S is unbound."
600 (cell-error-name condition)))))
602 (define-condition undefined-function (cell-error) ()
604 (lambda (condition stream)
606 "The function ~S is undefined."
607 (cell-error-name condition)))))
609 (define-condition arithmetic-error (error)
610 ((operation :reader arithmetic-error-operation
613 (operands :reader arithmetic-error-operands
615 (:report (lambda (condition stream)
617 "arithmetic error ~S signalled"
619 (when (arithmetic-error-operation condition)
621 "~%Operation was ~S, operands ~S."
622 (arithmetic-error-operation condition)
623 (arithmetic-error-operands condition))))))
625 (define-condition division-by-zero (arithmetic-error) ())
626 (define-condition floating-point-overflow (arithmetic-error) ())
627 (define-condition floating-point-underflow (arithmetic-error) ())
628 (define-condition floating-point-inexact (arithmetic-error) ())
629 (define-condition floating-point-invalid-operation (arithmetic-error) ())
631 (define-condition print-not-readable (error)
632 ((object :reader print-not-readable-object :initarg :object))
634 (lambda (condition stream)
635 (let ((obj (print-not-readable-object condition))
637 (format stream "~S cannot be printed readably." obj)))))
639 (define-condition reader-error (parse-error stream-error)
641 :reader reader-error-format-control
642 :initarg :format-control)
644 :reader reader-error-format-arguments
645 :initarg :format-arguments
648 (lambda (condition stream)
649 (let ((error-stream (stream-error-stream condition)))
650 (format stream "READER-ERROR ~@[at ~D ~]on ~S:~%~?"
651 (file-position error-stream) error-stream
652 (reader-error-format-control condition)
653 (reader-error-format-arguments condition))))))
655 ;;;; various other (not specified by ANSI) CONDITIONs
657 ;;;; These might logically belong in other files; they're here, after
658 ;;;; setup of CONDITION machinery, only because that makes it easier to
659 ;;;; get cold init to work.
661 ;;; KLUDGE: a condition for floating point errors when we can't or
662 ;;; won't figure out what type they are. (In FreeBSD and OpenBSD we
663 ;;; don't know how, at least as of sbcl-0.6.7; in Linux we probably
664 ;;; know how but the old code was broken by the conversion to POSIX
665 ;;; signal handling and hasn't been fixed as of sbcl-0.6.7.)
667 ;;; FIXME: Perhaps this should also be a base class for all
668 ;;; floating point exceptions?
669 (define-condition floating-point-exception (arithmetic-error)
670 ((flags :initarg :traps
672 :reader floating-point-exception-traps))
673 (:report (lambda (condition stream)
675 "An arithmetic error ~S was signalled.~%"
677 (let ((traps (floating-point-exception-traps condition)))
680 "Trapping conditions are: ~%~{ ~S~^~}~%"
683 "No traps are enabled? How can this be?"
686 (define-condition index-too-large-error (type-error)
689 (lambda (condition stream)
691 "The index ~S is too large."
692 (type-error-datum condition)))))
694 (define-condition io-timeout (stream-error)
695 ((direction :reader io-timeout-direction :initarg :direction))
697 (lambda (condition stream)
698 (declare (type stream stream))
700 "I/O timeout ~(~A~)ing ~S"
701 (io-timeout-direction condition)
702 (stream-error-stream condition)))))
704 (define-condition namestring-parse-error (parse-error)
705 ((complaint :reader namestring-parse-error-complaint :initarg :complaint)
706 (arguments :reader namestring-parse-error-arguments :initarg :arguments
708 (namestring :reader namestring-parse-error-namestring :initarg :namestring)
709 (offset :reader namestring-parse-error-offset :initarg :offset))
711 (lambda (condition stream)
713 "parse error in namestring: ~?~% ~A~% ~V@T^"
714 (namestring-parse-error-complaint condition)
715 (namestring-parse-error-arguments condition)
716 (namestring-parse-error-namestring condition)
717 (namestring-parse-error-offset condition)))))
719 (define-condition simple-package-error (simple-condition package-error) ())
721 (define-condition reader-package-error (reader-error) ())
723 (define-condition reader-eof-error (end-of-file)
724 ((context :reader reader-eof-error-context :initarg :context))
726 (lambda (condition stream)
728 "unexpected end of file on ~S ~A"
729 (stream-error-stream condition)
730 (reader-eof-error-context condition)))))
732 ;;;; restart definitions
734 (define-condition abort-failure (control-error) ()
736 "An ABORT restart was found that failed to transfer control dynamically."))
738 (defun abort (&optional condition)
740 "Transfer control to a restart named ABORT, signalling a CONTROL-ERROR if
742 (invoke-restart (find-restart 'abort condition))
743 ;; ABORT signals an error in case there was a restart named ABORT
744 ;; that did not transfer control dynamically. This could happen with
746 (error 'abort-failure))
748 (defun muffle-warning (&optional condition)
750 "Transfer control to a restart named MUFFLE-WARNING, signalling a
751 CONTROL-ERROR if none exists."
752 (invoke-restart (find-restart 'muffle-warning condition)))
754 (macrolet ((define-nil-returning-restart (name args doc)
755 #!-sb-doc (declare (ignore doc))
756 `(defun ,name (,@args &optional condition)
758 ;; FIXME: Perhaps this shared logic should be pulled out into
759 ;; FLET MAYBE-INVOKE-RESTART? See whether it shrinks code..
760 (when (find-restart ',name condition)
761 (invoke-restart ',name ,@args)))))
762 (define-nil-returning-restart continue ()
763 "Transfer control to a restart named CONTINUE, or return NIL if none exists.")
764 (define-nil-returning-restart store-value (value)
765 "Transfer control and VALUE to a restart named STORE-VALUE, or return NIL if
767 (define-nil-returning-restart use-value (value)
768 "Transfer control and VALUE to a restart named USE-VALUE, or return NIL if
771 (/show0 "late-target-error.lisp end of file")