From f960fb028d956fa80ce497e59743c486c16de992 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Wed, 7 Feb 1990 11:56:47 +0000
Subject: [PATCH] In ANNOTATE-COMPONENT-FOR-EVAL, also ignore references to
 :CLEANUP or :ESCAPE lambdas.

---
 compiler/eval-comp.lisp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/compiler/eval-comp.lisp b/compiler/eval-comp.lisp
index 877ab300f..fb1d3bcb8 100644
--- a/compiler/eval-comp.lisp
+++ b/compiler/eval-comp.lisp
@@ -141,6 +141,10 @@
     %unwind-protect %catch-breakup %unwind-protect-breakup %lexical-exit-breakup
     %continue-unwind %nlx-entry))
 
+;;; Some kinds of functions are only passed as arguments to funny functions,
+;;; and are never actually evaluated at run time.
+;;;
+(defconstant non-closed-function-kinds '(:cleanup :escape))
 
 ;;; ANNOTATE-COMPONENT-FOR-EVAL -- Internal.
 ;;;
@@ -195,6 +199,10 @@
 			  (member (c::global-var-name leaf) undefined-funny-funs
 				  :test #'eq))
 		     :unused)
+		    ((and leaf (typep leaf 'clambda)
+			  (member (functional-kind leaf)
+				  non-closed-function-kinds))
+		     :unused)
 		    (t
 		     (typecase dest
 		       ;; Change locations in eval.lisp that think :return could
-- 
GitLab