Skip to content
Snippets Groups Projects
Commit 05ad7b8f authored by pmai's avatar pmai
Browse files

Fixes for a bug reported by Matthew Danish that allowed special

declarations for constants and other cases that are not allowed.  The
fix is a bit more involved since proclaim must work during cold-load,
at a time where the package system isn't yet set up, and therefore the
info database will incorrectly report all symbols as constants.
parent ae9f91f8
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/proclaim.lisp,v 1.35 2001/03/04 20:12:25 pw Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/proclaim.lisp,v 1.36 2001/12/07 03:10:33 pmai Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
(defun %declaim (x) (defun %declaim (x)
(proclaim x)) (proclaim x))
;;; %declaim -- Interface ;;; PROCLAIM -- Public
;;; ;;;
;;; This function is the guts of proclaim, since it does the global ;;; This function is the guts of proclaim, since it does the global
;;; environment updating. ;;; environment updating.
...@@ -340,6 +340,26 @@ ...@@ -340,6 +340,26 @@
(dolist (name args) (dolist (name args)
(unless (symbolp name) (unless (symbolp name)
(error "Variable name is not a symbol: ~S." name)) (error "Variable name is not a symbol: ~S." name))
(unless (or (member (info variable kind name) '(:global :special))
;; If we are still in cold-load, and the package system
;; is not set up, the global db will claim all variables
;; are keywords/constants, because all symbols have the
;; same package nil. Proceed normally in this case:
(null (symbol-package :end)))
(cond
((eq name 'nil)
(error "Nihil ex nihil, can't declare ~S special." name))
((eq name 't)
(error "Veritas aeterna, can't declare ~S special." name))
((keywordp name)
(error "Can't declare ~S special, it is a keyword." name))
(t
(cerror "Proceed anyway."
"Trying to declare ~S special, which is ~A." name
(ecase (info variable kind name)
(:constant "a constant")
(:alien "an alien variable")
(:macro "a symbol macro"))))))
(clear-info variable constant-value name) (clear-info variable constant-value name)
(setf (info variable kind name) :special))) (setf (info variable kind name) :special)))
(type (type
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment