Skip to content

Commit

Permalink
Fix WARNS check return.
Browse files Browse the repository at this point in the history
Catch the return value of the enclosed form and return it from `warns`
check.  Previously, simply returned T or NIL, which caused problems with
surrounding code.
  • Loading branch information
rpgoldman committed Aug 18, 2023
1 parent 36e083e commit cad5ca9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/check.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,12 @@ is evaluated in a block named NIL, CONDITION-SPEC is not evaluated.
Is like SIGNALS, but does NOT abort the execution of BODY upon the signal
being raised."
(let ((block-name (gensym))
(signaled-p (gensym)))
(signaled-p (gensym))
(normal-return (gensym)))
(destructuring-bind (condition &optional reason-control reason-args)
(ensure-list condition-spec)
`(let ((,signaled-p nil))
`(let ((,signaled-p nil)
,normal-return)
(block ,block-name
(handler-bind ((,condition (lambda (c)
(unless (typep c 'warning)
Expand All @@ -279,15 +281,16 @@ being raised."
:test-expr ',condition)
(setf ,signaled-p t)
(muffle-warning c))))
(block nil
,@body))
(when ,signaled-p (return-from ,block-name t))
(setf ,normal-return
(block nil
,@body)))
(when ,signaled-p (return-from ,block-name ,normal-return))
(process-failure
',condition
,@(if reason-control
`(,reason-control ,@reason-args)
`("Failed to signal a ~S" ',condition)))
(return-from ,block-name nil))))))
(return-from ,block-name ,normal-return))))))

(defmacro finishes (&body body)
"Generates a pass if BODY executes to normal completion. In
Expand Down

0 comments on commit cad5ca9

Please sign in to comment.