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))
121 (concatenate 'simple-vector
122 (layout-inherits cond-layout)
123 (mapcar #'class-layout cpl))))
125 (not (mismatch (layout-inherits olayout) new-inherits)))
127 (make-layout :class (make-undefined-class name)
128 :inherits new-inherits
130 :length (layout-length cond-layout)))))
134 ;;; FIXME: ANSI's definition of DEFINE-CONDITION says
135 ;;; Condition reporting is mediated through the PRINT-OBJECT method
136 ;;; for the condition type in question, with *PRINT-ESCAPE* always
137 ;;; being nil. Specifying (:REPORT REPORT-NAME) in the definition of
138 ;;; a condition type C is equivalent to:
139 ;;; (defmethod print-object ((x c) stream)
140 ;;; (if *print-escape* (call-next-method) (report-name x stream)))
141 ;;; The current code doesn't seem to quite match that.
142 (def!method print-object ((x condition) stream)
144 (print-unreadable-object (x stream :type t :identity t))
145 ;; KLUDGE: A comment from CMU CL here said
146 ;; 7/13/98 BUG? CPL is not sorted and results here depend on order of
147 ;; superclasses in define-condition call!
148 (dolist (class (condition-class-cpl (sb!xc:class-of x))
149 (error "no REPORT? shouldn't happen!"))
150 (let ((report (condition-class-report class)))
152 (return (funcall report x stream)))))))
154 ;;;; slots of CONDITION objects
156 (defvar *empty-condition-slot* '(empty))
158 (defun find-slot-default (class slot)
159 (let ((initargs (condition-slot-initargs slot))
160 (cpl (condition-class-cpl class)))
162 (let ((default-initargs (condition-class-default-initargs class)))
163 (dolist (initarg initargs)
164 (let ((val (getf default-initargs initarg *empty-condition-slot*)))
165 (unless (eq val *empty-condition-slot*)
166 (return-from find-slot-default
171 (if (condition-slot-initform-p slot)
172 (let ((initform (condition-slot-initform slot)))
173 (if (functionp initform)
176 (error "unbound condition slot: ~S" (condition-slot-name slot)))))
178 (defun find-condition-class-slot (condition-class slot-name)
180 (condition-class-cpl condition-class)
181 (error "There is no slot named ~S in ~S."
182 slot-name condition-class))
183 (dolist (slot (condition-class-slots sclass))
184 (when (eq (condition-slot-name slot) slot-name)
185 (return-from find-condition-class-slot slot)))))
187 (defun condition-writer-function (condition new-value name)
188 (dolist (cslot (condition-class-class-slots
189 (layout-class (%instance-layout condition)))
190 (setf (getf (condition-assigned-slots condition) name)
192 (when (eq (condition-slot-name cslot) name)
193 (return (setf (car (condition-slot-cell cslot)) new-value)))))
195 (defun condition-reader-function (condition name)
196 (let ((class (layout-class (%instance-layout condition))))
197 (dolist (cslot (condition-class-class-slots class))
198 (when (eq (condition-slot-name cslot) name)
199 (return-from condition-reader-function
200 (car (condition-slot-cell cslot)))))
202 (let ((val (getf (condition-assigned-slots condition) name
203 *empty-condition-slot*)))
204 (if (eq val *empty-condition-slot*)
205 (let ((actual-initargs (condition-actual-initargs condition))
206 (slot (find-condition-class-slot class name)))
208 (error "missing slot ~S of ~S" name condition))
209 (dolist (initarg (condition-slot-initargs slot))
210 (let ((val (getf actual-initargs
212 *empty-condition-slot*)))
213 (unless (eq val *empty-condition-slot*)
214 (return-from condition-reader-function
215 (setf (getf (condition-assigned-slots condition)
218 (setf (getf (condition-assigned-slots condition) name)
219 (find-slot-default class slot)))
224 (defun make-condition (thing &rest args)
226 "Make an instance of a condition object using the specified initargs."
227 ;; Note: ANSI specifies no exceptional situations in this function.
228 ;; signalling simple-type-error would not be wrong.
229 (let* ((thing (if (symbolp thing)
230 (sb!xc:find-class thing)
232 (class (typecase thing
233 (condition-class thing)
235 (error 'simple-type-error
237 :expected-type 'condition-class
238 :format-control "~S is not a condition class."
239 :format-arguments (list thing)))
241 (error 'simple-type-error
243 :expected-type 'condition-class
244 :format-control "bad thing for class argument:~% ~S"
245 :format-arguments (list thing)))))
246 (res (make-condition-object args)))
247 (setf (%instance-layout res) (class-layout class))
248 ;; Set any class slots with initargs present in this call.
249 (dolist (cslot (condition-class-class-slots class))
250 (dolist (initarg (condition-slot-initargs cslot))
251 (let ((val (getf args initarg *empty-condition-slot*)))
252 (unless (eq val *empty-condition-slot*)
253 (setf (car (condition-slot-cell cslot)) val)))))
254 ;; Default any slots with non-constant defaults now.
255 (dolist (hslot (condition-class-hairy-slots class))
256 (when (dolist (initarg (condition-slot-initargs hslot) t)
257 (unless (eq (getf args initarg *empty-condition-slot*)
258 *empty-condition-slot*)
260 (setf (getf (condition-assigned-slots res) (condition-slot-name hslot))
261 (find-slot-default class hslot))))
265 ;;;; DEFINE-CONDITION
267 (eval-when (:compile-toplevel :load-toplevel :execute)
268 (defun %compiler-define-condition (name direct-supers layout)
269 (multiple-value-bind (class old-layout)
270 (insured-find-class name #'condition-class-p #'make-condition-class)
271 (setf (layout-class layout) class)
272 (setf (class-direct-superclasses class)
273 (mapcar #'sb!xc:find-class direct-supers))
274 (cond ((not old-layout)
275 (register-layout layout))
276 ((not *type-system-initialized*)
277 (setf (layout-class old-layout) class)
278 (setq layout old-layout)
279 (unless (eq (class-layout class) layout)
280 (register-layout layout)))
281 ((redefine-layout-warning "current"
284 (layout-length layout)
285 (layout-inherits layout)
286 (layout-depthoid layout))
287 (register-layout layout :invalidate t))
288 ((not (class-layout class))
289 (register-layout layout)))
291 (setf (layout-info layout)
293 ;; KLUDGE: There's a FIND-CLASS DEFTRANSFORM for constant class
294 ;; names which creates fast but non-cold-loadable, non-compact
295 ;; code. In this context, we'd rather have compact, cold-loadable
296 ;; code. -- WHN 19990928
297 (declare (notinline sb!xc:find-class))
298 (layout-info (class-layout (sb!xc:find-class 'condition)))))
300 (setf (sb!xc:find-class name) class)
302 ;; Initialize CPL slot from layout.
305 (let ((inherits (layout-inherits layout)))
306 (do ((i (1- (length inherits)) (1- i)))
308 (let ((super (sb!xc:find-class
310 (layout-class (svref inherits i))))))
311 (when (typep super 'condition-class)
313 (setf (condition-class-cpl class) (cpl))))
319 ;;; Compute the effective slots of class, copying inherited slots and
320 ;;; side-effecting direct slots.
321 (defun compute-effective-slots (class)
322 (collect ((res (copy-list (condition-class-slots class))))
323 (dolist (sclass (condition-class-cpl class))
324 (dolist (sslot (condition-class-slots sclass))
325 (let ((found (find (condition-slot-name sslot) (res)
328 (setf (condition-slot-initargs found)
329 (union (condition-slot-initargs found)
330 (condition-slot-initargs sslot)))
331 (unless (condition-slot-initform-p found)
332 (setf (condition-slot-initform-p found)
333 (condition-slot-initform-p sslot))
334 (setf (condition-slot-initform found)
335 (condition-slot-initform sslot)))
336 (unless (condition-slot-allocation found)
337 (setf (condition-slot-allocation found)
338 (condition-slot-allocation sslot))))
340 (res (copy-structure sslot)))))))
343 (defun %define-condition (name slots documentation report default-initargs)
344 (let ((class (sb!xc:find-class name)))
345 (setf (condition-class-slots class) slots)
346 (setf (condition-class-report class) report)
347 (setf (condition-class-default-initargs class) default-initargs)
348 (setf (fdocumentation name 'type) documentation)
352 ;; Set up reader and writer functions.
353 (let ((name (condition-slot-name slot)))
354 (dolist (reader (condition-slot-readers slot))
355 (setf (fdefinition reader)
356 #'(lambda (condition)
357 (condition-reader-function condition name))))
358 (dolist (writer (condition-slot-writers slot))
359 (setf (fdefinition writer)
360 #'(lambda (new-value condition)
361 (condition-writer-function condition new-value name))))))
363 ;; Compute effective slots and set up the class and hairy slots
364 ;; (subsets of the effective slots.)
365 (let ((eslots (compute-effective-slots class))
368 (mapcar #'condition-class-default-initargs
369 (condition-class-cpl class)))))
370 (dolist (slot eslots)
371 (ecase (condition-slot-allocation slot)
373 (unless (condition-slot-cell slot)
374 (setf (condition-slot-cell slot)
375 (list (if (condition-slot-initform-p slot)
376 (let ((initform (condition-slot-initform slot)))
377 (if (functionp initform)
380 *empty-condition-slot*))))
381 (push slot (condition-class-class-slots class)))
383 (setf (condition-slot-allocation slot) :instance)
384 (when (or (functionp (condition-slot-initform slot))
385 (dolist (initarg (condition-slot-initargs slot) nil)
386 (when (functionp (getf e-def-initargs initarg))
388 (push slot (condition-class-hairy-slots class))))))))
391 (defmacro define-condition (name (&rest parent-types) (&rest slot-specs)
394 "DEFINE-CONDITION Name (Parent-Type*) (Slot-Spec*) Option*
395 Define NAME as a condition type. This new type inherits slots and its
396 report function from the specified PARENT-TYPEs. A slot spec is a list of:
397 (slot-name :reader <rname> :initarg <iname> {Option Value}*
399 The DEFINE-CLASS slot options :ALLOCATION, :INITFORM, [slot] :DOCUMENTATION
400 and :TYPE and the overall options :DEFAULT-INITARGS and
401 [type] :DOCUMENTATION are also allowed.
403 The :REPORT option is peculiar to DEFINE-CONDITION. Its argument is either
404 a string or a two-argument lambda or function name. If a function, the
405 function is called with the condition and stream to report the condition.
406 If a string, the string is printed.
408 Condition types are classes, but (as allowed by ANSI and not as described in
409 CLtL2) are neither STANDARD-OBJECTs nor STRUCTURE-OBJECTs. WITH-SLOTS and
410 SLOT-VALUE may not be used on condition objects."
411 (let* ((parent-types (or parent-types '(condition)))
412 (layout (find-condition-layout name parent-types))
415 (default-initargs ()))
417 (all-readers nil append)
418 (all-writers nil append))
419 (dolist (spec slot-specs)
420 (when (keywordp spec)
421 (warn "Keyword slot name indicates probable syntax error:~% ~S"
423 (let* ((spec (if (consp spec) spec (list spec)))
424 (slot-name (first spec))
425 (allocation :instance)
431 (do ((options (rest spec) (cddr options)))
433 (unless (and (consp options) (consp (cdr options)))
434 (error "malformed condition slot spec:~% ~S." spec))
435 (let ((arg (second options)))
436 (case (first options)
437 (:reader (readers arg))
438 (:writer (writers arg))
441 (writers `(setf ,arg)))
444 (error "more than one :INITFORM in ~S" spec))
447 (:initarg (initargs arg))
449 (setq allocation arg))
452 (error "unknown slot option:~% ~S" (first options))))))
454 (all-readers (readers))
455 (all-writers (writers))
456 (slots `(make-condition-slot
458 :initargs ',(initargs)
461 :initform-p ',initform-p
463 ,(if (constantp initform)
465 `#'(lambda () ,initform)))))))
467 (dolist (option options)
468 (unless (consp option)
469 (error "bad option:~% ~S" option))
471 (:documentation (setq documentation (second option)))
473 (let ((arg (second option)))
476 `#'(lambda (condition stream)
477 (declare (ignore condition))
478 (write-string ,arg stream))
479 `#'(lambda (condition stream)
480 (funcall #',arg condition stream))))))
482 (do ((initargs (rest option) (cddr initargs)))
484 (let ((val (second initargs)))
485 (setq default-initargs
486 (list* `',(first initargs)
490 default-initargs)))))
492 (error "unknown option: ~S" (first option)))))
495 (warn "Condition slot setters probably not allowed in ANSI CL:~% ~S"
499 (eval-when (:compile-toplevel :load-toplevel :execute)
500 (%compiler-define-condition ',name ',parent-types ',layout))
502 (declaim (ftype (function (t) t) ,@(all-readers)))
503 (declaim (ftype (function (t t) t) ,@(all-writers)))
505 (%define-condition ',name
509 (list ,@default-initargs))))))
511 ;;;; DESCRIBE on CONDITIONs
513 ;;; a function to be used as the guts of DESCRIBE-OBJECT (CONDITION T)
514 ;;; eventually (once we get CLOS up and running so that we can define
516 (defun describe-condition (condition stream)
518 "~@<~S ~_is a ~S. ~_Its slot values are ~_~S.~:>"
522 (condition-actual-initargs condition)
523 (condition-assigned-slots condition))))
525 ;;;; various CONDITIONs specified by ANSI
527 (define-condition serious-condition (condition) ())
529 (define-condition error (serious-condition) ())
531 (define-condition warning (condition) ())
532 (define-condition style-warning (warning) ())
534 (defun simple-condition-printer (condition stream)
537 (simple-condition-format-control condition)
538 (simple-condition-format-arguments condition)))
540 (define-condition simple-condition ()
541 ((format-control :reader simple-condition-format-control
542 :initarg :format-control)
543 (format-arguments :reader simple-condition-format-arguments
544 :initarg :format-arguments
546 (:report simple-condition-printer))
548 (define-condition simple-warning (simple-condition warning) ())
550 ;;; This is the condition type used by ERROR and CERROR when
551 ;;; a format-control string is supplied as the first argument.
552 (define-condition simple-error (simple-condition error) ())
554 (define-condition storage-condition (serious-condition) ())
556 (define-condition type-error (error)
557 ((datum :reader type-error-datum :initarg :datum)
558 (expected-type :reader type-error-expected-type :initarg :expected-type))
560 (lambda (condition stream)
562 "~@<The value ~2I~:_~S ~I~_is not of type ~2I~_~S.~:>"
563 (type-error-datum condition)
564 (type-error-expected-type condition)))))
566 (define-condition program-error (error) ())
567 (define-condition parse-error (error) ())
568 (define-condition control-error (error) ())
569 (define-condition stream-error (error)
570 ((stream :reader stream-error-stream :initarg :stream)))
572 (define-condition end-of-file (stream-error) ()
574 (lambda (condition stream)
577 (stream-error-stream condition)))))
579 (define-condition file-error (error)
580 ((pathname :reader file-error-pathname :initarg :pathname))
582 (lambda (condition stream)
584 "~@<error on file ~_~S: ~2I~:_~?~:>"
585 (file-error-pathname condition)
586 ;; FIXME: ANSI's FILE-ERROR doesn't have FORMAT-CONTROL and
587 ;; FORMAT-ARGUMENTS, and the inheritance here doesn't seem
588 ;; to give us FORMAT-CONTROL or FORMAT-ARGUMENTS either.
589 ;; So how does this work?
590 (serious-condition-format-control condition)
591 (serious-condition-format-arguments condition)))))
593 (define-condition package-error (error)
594 ((package :reader package-error-package :initarg :package)))
596 (define-condition cell-error (error)
597 ((name :reader cell-error-name :initarg :name)))
599 (define-condition unbound-variable (cell-error) ()
601 (lambda (condition stream)
603 "The variable ~S is unbound."
604 (cell-error-name condition)))))
606 (define-condition undefined-function (cell-error) ()
608 (lambda (condition stream)
610 "The function ~S is undefined."
611 (cell-error-name condition)))))
613 (define-condition arithmetic-error (error)
614 ((operation :reader arithmetic-error-operation
617 (operands :reader arithmetic-error-operands
619 (:report (lambda (condition stream)
621 "arithmetic error ~S signalled"
623 (when (arithmetic-error-operation condition)
625 "~%Operation was ~S, operands ~S."
626 (arithmetic-error-operation condition)
627 (arithmetic-error-operands condition))))))
629 (define-condition division-by-zero (arithmetic-error) ())
630 (define-condition floating-point-overflow (arithmetic-error) ())
631 (define-condition floating-point-underflow (arithmetic-error) ())
632 (define-condition floating-point-inexact (arithmetic-error) ())
633 (define-condition floating-point-invalid-operation (arithmetic-error) ())
635 (define-condition print-not-readable (error)
636 ((object :reader print-not-readable-object :initarg :object))
638 (lambda (condition stream)
639 (let ((obj (print-not-readable-object condition))
641 (format stream "~S cannot be printed readably." obj)))))
643 (define-condition reader-error (parse-error stream-error)
645 :reader reader-error-format-control
646 :initarg :format-control)
648 :reader reader-error-format-arguments
649 :initarg :format-arguments
652 (lambda (condition stream)
653 (let ((error-stream (stream-error-stream condition)))
654 (format stream "READER-ERROR ~@[at ~D ~]on ~S:~%~?"
655 (file-position error-stream) error-stream
656 (reader-error-format-control condition)
657 (reader-error-format-arguments condition))))))
659 ;;;; various other (not specified by ANSI) CONDITIONs
661 ;;;; These might logically belong in other files; they're here, after
662 ;;;; setup of CONDITION machinery, only because that makes it easier to
663 ;;;; get cold init to work.
665 ;;; KLUDGE: a condition for floating point errors when we can't or
666 ;;; won't figure out what type they are. (In FreeBSD and OpenBSD we
667 ;;; don't know how, at least as of sbcl-0.6.7; in Linux we probably
668 ;;; know how but the old code was broken by the conversion to POSIX
669 ;;; signal handling and hasn't been fixed as of sbcl-0.6.7.)
671 ;;; FIXME: Perhaps this should also be a base class for all
672 ;;; floating point exceptions?
673 (define-condition floating-point-exception (arithmetic-error)
674 ((flags :initarg :traps
676 :reader floating-point-exception-traps))
677 (:report (lambda (condition stream)
679 "An arithmetic error ~S was signalled.~%"
681 (let ((traps (floating-point-exception-traps condition)))
684 "Trapping conditions are: ~%~{ ~S~^~}~%"
687 "No traps are enabled? How can this be?"
690 (define-condition index-too-large-error (type-error)
693 (lambda (condition stream)
695 "The index ~S is too large."
696 (type-error-datum condition)))))
698 (define-condition io-timeout (stream-error)
699 ((direction :reader io-timeout-direction :initarg :direction))
701 (lambda (condition stream)
702 (declare (type stream stream))
704 "I/O timeout ~(~A~)ing ~S"
705 (io-timeout-direction condition)
706 (stream-error-stream condition)))))
708 (define-condition namestring-parse-error (parse-error)
709 ((complaint :reader namestring-parse-error-complaint :initarg :complaint)
710 (arguments :reader namestring-parse-error-arguments :initarg :arguments
712 (namestring :reader namestring-parse-error-namestring :initarg :namestring)
713 (offset :reader namestring-parse-error-offset :initarg :offset))
715 (lambda (condition stream)
717 "parse error in namestring: ~?~% ~A~% ~V@T^"
718 (namestring-parse-error-complaint condition)
719 (namestring-parse-error-arguments condition)
720 (namestring-parse-error-namestring condition)
721 (namestring-parse-error-offset condition)))))
723 (define-condition simple-package-error (simple-condition package-error) ())
725 (define-condition reader-package-error (reader-error) ())
727 (define-condition reader-eof-error (end-of-file)
728 ((context :reader reader-eof-error-context :initarg :context))
730 (lambda (condition stream)
732 "unexpected end of file on ~S ~A"
733 (stream-error-stream condition)
734 (reader-eof-error-context condition)))))
736 ;;;; restart definitions
738 (define-condition abort-failure (control-error) ()
740 "An ABORT restart was found that failed to transfer control dynamically."))
742 (defun abort (&optional condition)
744 "Transfer control to a restart named ABORT, signalling a CONTROL-ERROR if
746 (invoke-restart (find-restart 'abort condition))
747 ;; ABORT signals an error in case there was a restart named ABORT
748 ;; that did not transfer control dynamically. This could happen with
750 (error 'abort-failure))
752 (defun muffle-warning (&optional condition)
754 "Transfer control to a restart named MUFFLE-WARNING, signalling a
755 CONTROL-ERROR if none exists."
756 (invoke-restart (find-restart 'muffle-warning condition)))
758 (macrolet ((define-nil-returning-restart (name args doc)
759 #!-sb-doc (declare (ignore doc))
760 `(defun ,name (,@args &optional condition)
762 ;; FIXME: Perhaps this shared logic should be pulled out into
763 ;; FLET MAYBE-INVOKE-RESTART? See whether it shrinks code..
764 (when (find-restart ',name condition)
765 (invoke-restart ',name ,@args)))))
766 (define-nil-returning-restart continue ()
767 "Transfer control to a restart named CONTINUE, or return NIL if none exists.")
768 (define-nil-returning-restart store-value (value)
769 "Transfer control and VALUE to a restart named STORE-VALUE, or return NIL if
771 (define-nil-returning-restart use-value (value)
772 "Transfer control and VALUE to a restart named USE-VALUE, or return NIL if
775 (/show0 "late-target-error.lisp end of file")