From fff343fc1fe4789912d21cf8d7c80bcd3788a3c2 Mon Sep 17 00:00:00 2001
From: pw <pw>
Date: Sat, 13 Sep 1997 20:28:10 +0000
Subject: [PATCH] Minor change to inhibit compiler notes about dead code
 removal when WITH-INPUT-FROM-STRING was called with an END argument.

---
 code/macros.lisp | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/code/macros.lisp b/code/macros.lisp
index a5f58110d..08d31d46e 100644
--- a/code/macros.lisp
+++ b/code/macros.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.51 1997/09/03 20:27:08 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.52 1997/09/13 20:28:10 pw Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1391,20 +1391,22 @@
 (defmacro with-input-from-string ((var string &key index start end) &body (forms decls))
   "Binds the Var to an input stream that returns characters from String and
   executes the body.  See manual for details."
-  `(let ((,var
-	  ,(cond ((null end)
-		  `(make-string-input-stream ,string ,(or start 0)))
-		 ((symbolp end)
-		  `(if ,end
-		       (make-string-input-stream ,string ,(or start 0) ,end)
-		     (make-string-input-stream ,string ,(or start 0))))
-		 (t
-		  `(make-string-input-stream ,string ,(or start 0) ,end)))))
-     ,@decls
-     (unwind-protect
-       (progn ,@forms)
-       (close ,var)
-       ,@(if index `((setf ,index (string-input-stream-current ,var)))))))
+  ;; The once-only inhibits compiler note for unreachable code when 'end' is true.
+  (once-only ((string string))
+    `(let ((,var
+	    ,(cond ((null end)
+		    `(make-string-input-stream ,string ,(or start 0)))
+		   ((symbolp end)
+		    `(if ,end
+			 (make-string-input-stream ,string ,(or start 0) ,end)
+			 (make-string-input-stream ,string ,(or start 0))))
+		   (t
+		    `(make-string-input-stream ,string ,(or start 0) ,end)))))
+       ,@decls
+       (unwind-protect
+	   (progn ,@forms)
+	 (close ,var)
+	 ,@(if index `((setf ,index (string-input-stream-current ,var))))))))
 
 
 (defmacro with-output-to-string ((var &optional string) &body (forms decls))
-- 
GitLab