From dddc2e8b9d9049230c42f8ed5d00540edea8792a Mon Sep 17 00:00:00 2001
From: toy <toy>
Date: Thu, 21 Nov 2002 20:02:26 +0000
Subject: [PATCH] :allow-other-keys is a valid keyword arg.  Make it so.  (This
 is modelled after the corresponding code in SBCL.)

---
 compiler/ir1tran.lisp |  7 ++-----
 compiler/locall.lisp  | 22 ++++++++++++++++++----
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/compiler/ir1tran.lisp b/compiler/ir1tran.lisp
index 1d7ecdc37..c0480d792 100644
--- a/compiler/ir1tran.lisp
+++ b/compiler/ir1tran.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/compiler/ir1tran.lisp,v 1.130 2002/08/12 16:08:13 toy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/ir1tran.lisp,v 1.131 2002/11/21 20:02:26 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1248,16 +1248,13 @@
 ;;; Make-Keyword  --  Internal
 ;;;
 ;;;    Make the keyword for a keyword arg, checking that the keyword isn't
-;;; already used by one of the Vars.  We also check that the keyword isn't the
-;;; magical :allow-other-keys.
+;;; already used by one of the Vars.
 ;;;
 (defun make-keyword (symbol vars keywordify)
   (declare (symbol symbol) (list vars) (values symbol))
   (let ((key (if (and keywordify (not (keywordp symbol)))
 		 (intern (symbol-name symbol) "KEYWORD")
 		 symbol)))
-    (when (eq key :allow-other-keys)
-      (compiler-error "You can't have a keyword arg called :allow-other-keys."))
     (dolist (var vars)
       (let ((info (lambda-var-arg-info var)))
 	(when (and info
diff --git a/compiler/locall.lisp b/compiler/locall.lisp
index eedfaa48a..0ee3d6c12 100644
--- a/compiler/locall.lisp
+++ b/compiler/locall.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/compiler/locall.lisp,v 1.51 2002/08/21 17:55:20 toy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/locall.lisp,v 1.52 2002/11/21 20:02:26 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -548,7 +548,9 @@
 	 (args (combination-args call))
 	 (more (nthcdr max args))
 	 (flame (policy call (or (> speed brevity) (> space brevity))))
-	 (loser nil))
+	 (loser nil)
+	 (allowp nil)
+	 (allow-found nil))
     (collect ((temps)
 	      (more-temps)
 	      (ignores)
@@ -594,17 +596,29 @@
 	    (let ((name (continuation-value cont))
 		  (dummy (first temp))
 		  (val (second temp)))
+	      ;; FIXME:  check whether KEY was supplied earlier
+	      (when (and (eq name :allow-other-keys) (not allow-found))
+		(let ((val (second key)))
+		  (cond ((constant-continuation-p val)
+			 (setq allow-found t
+			       allowp (continuation-value val)))
+			(t
+			 (when flame
+			   (compiler-note "non-constant :ALLOW-OTHER-KEYS value"))
+			 (setf (basic-combination-kind call) :error)
+			 (return-from convert-more-call)))))
 	      (dolist (var (key-vars)
 			   (progn
 			     (ignores dummy val)
-			     (setq loser name)))
+			     (unless (eq name :allow-other-keys)
+			       (setq loser name))))
 		(let ((info (lambda-var-arg-info var)))
 		  (when (eq (arg-info-keyword info) name)
 		    (ignores dummy)
 		    (supplied (cons var val))
 		    (return)))))))
 	
-	(when (and loser (not (optional-dispatch-allowp fun)))
+	(when (and loser (not (optional-dispatch-allowp fun)) (not allowp))
 	  (compiler-warning "Function called with unknown argument keyword ~S."
 			    loser)
 	  (setf (basic-combination-kind call) :error)
-- 
GitLab