From 9ac6b55584ea51025507d9b6dce9fb5a7f139edc Mon Sep 17 00:00:00 2001
From: toy <toy>
Date: Tue, 18 Feb 2003 16:55:49 +0000
Subject: [PATCH] For CASE and friends, the OTHERWISE clause is an OTHERWISE
 clause only if it's the last clause.  Otherwise, it's just a normal clause.

---
 code/macros.lisp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/code/macros.lisp b/code/macros.lisp
index ad7d17191..4b021172b 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.87 2003/02/08 11:33:39 gerd Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/macros.lisp,v 1.88 2003/02/18 16:55:49 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1243,11 +1243,17 @@
   (let ((keyform-value (gensym))
 	(clauses ())
 	(keys ()))
-    (dolist (case cases)
+    (do* ((case-list cases (cdr case-list))
+	  (case (first case-list) (first case-list)))
+	 ((null case-list))
       (cond ((atom case)
 	     (error "~S -- Bad clause in ~S." case name))
 	    ((and (not allow-otherwise)
-		 (memq (car case) '(t otherwise)))
+		  (null (cdr case-list))
+		  (memq (car case) '(t otherwise)))
+	     ;; The CLHS says OTHERWISE clause is an OTHERWISE clause
+	     ;; only if it's the last case.  Otherwise, it's just a
+	     ;; normal clause.
 	     (if errorp
 		 (error "No default clause allowed in ~S: ~S" name case)
 		 (push `(t nil ,@(rest case)) clauses)))
-- 
GitLab