SB-EXT:WITH-TIMEOUT expands to something like
(if (> ,expires 0)
Which results in annoying unreachable code notes when EXPIRES is a
constant. I changed its implementation thus:
(defmacro sb!ext:with-timeout (expires &body body)
(flet ((generate-timeouting-body (expires body)
;; FIXME: a temporary compatibility workaround for CLX, if unsafe
;; unwinds are handled revisit it.
`(let ((,timer (make-timer (lambda ()
(cerror "Continue" 'sb!ext::timeout)))))
(schedule-timer ,timer ,expires)
;; We try to avoid Dead Code notes due to constant propagation.
(if (and (numberp expires) (> expires 0))
(generate-timeouting-body expires body)
`(if (> expires 0)
,(generate-timeouting-body expires body)
You may want to tweak this using CONSTANTP, or some internal machinery.