From 64774a0877bab6720f3d69a508dab4b861e8c9e3 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Thu, 4 Aug 2005 16:00:04 +0000
Subject: [PATCH] Funcalling a special form signals an undefined-function
 error, but the error object didn't include a value for the cell-error-name.

Fix this by defining a separate function for each special form in
CMUCL and making it the symbol-function for the symbol.  (Previously,
it was just the same function for all symbols.)  Could we do something
better than this?
---
 compiler/macros.lisp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/compiler/macros.lisp b/compiler/macros.lisp
index f5e57625f..7e30ef803 100644
--- a/compiler/macros.lisp
+++ b/compiler/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/compiler/macros.lisp,v 1.54 2004/09/11 19:18:02 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/macros.lisp,v 1.55 2005/08/04 16:00:04 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -178,7 +178,17 @@
 	 (setf (info function ir1-convert ',name) #',fn-name)
 	 (setf (info function kind ',name) ,kind)
 	 ,@(when (eq kind :special-form)
-	     `((setf (symbol-function ',name) #'special-form-function)))))))
+	     ;; Define a special function that signals an error if we
+	     ;; try to funcall the special form.  And then make this
+	     ;; function the symbol-function for the symbol.
+	     `((defun ,(symbolicate "SPECIAL-FORM-FUNCTION-" name) (&rest stuff)
+		 (declare (ignore stuff))
+		 (error 'simple-undefined-function
+			:name ',name
+			:format-control "Can't funcall the SYMBOL-FUNCTION of the special form ~A."
+			:format-arguments (list ',name)))
+	       (setf (symbol-function ',name)
+		     (function ,(symbolicate "SPECIAL-FORM-FUNCTION-" name)))))))))
 
 
 ;;; Def-Source-Transform  --  Interface
-- 
GitLab