+(declaim (ftype (function (list list) list)
+ process-unhandle-conditions-decl))
+(defun process-unhandle-conditions-decl (spec list)
+ (let ((new (copy-alist list)))
+ (dolist (clause (cdr spec))
+ (destructuring-bind (typespec restart-name) clause
+ (let ((ospec (rassoc restart-name new :test #'eq)))
+ (if ospec
+ (let ((type-specifier
+ (type-specifier
+ (type-intersection
+ (specifier-type (car ospec))
+ (specifier-type `(not ,typespec))))))
+ (if type-specifier
+ (setf (car ospec) type-specifier)
+ (setq new
+ (delete restart-name new :test #'eq :key #'cdr))))
+ ;; do nothing?
+ nil))))
+ new))
+(declaim (ftype (function (list list) list)
+ process-unmuffle-conditions-decl))
+(defun process-unmuffle-conditions-decl (spec list)
+ (process-unhandle-conditions-decl
+ (cons 'unhandle-conditions
+ (mapcar (lambda (x) (list x 'muffle-warning)) (cdr spec)))
+ list))
+
+(declaim (ftype (function (list list) list)
+ process-package-lock-decl))
+(defun process-package-lock-decl (spec old)
+ (let ((decl (car spec))
+ (list (cdr spec)))
+ (ecase decl
+ (disable-package-locks
+ (union old list :test #'equal))
+ (enable-package-locks
+ (set-difference old list :test #'equal)))))
+
+;;; ANSI defines the declaration (FOO X Y) to be equivalent to
+;;; (TYPE FOO X Y) when FOO is a type specifier. This function
+;;; implements that by converting (FOO X Y) to (TYPE FOO X Y).
+(defun canonized-decl-spec (decl-spec)
+ (let ((id (first decl-spec)))
+ (unless (symbolp id)
+ (error "The declaration identifier is not a symbol: ~S" id))
+ (let ((id-is-type (info :type :kind id))
+ (id-is-declared-decl (info :declaration :recognized id)))
+ (cond ((and id-is-type id-is-declared-decl)
+ (compiler-error
+ "ambiguous declaration ~S:~% ~
+ ~S was declared as a DECLARATION, but is also a type name."
+ decl-spec id))
+ (id-is-type
+ (cons 'type decl-spec))
+ (t
+ decl-spec)))))
+
+(defvar *queued-proclaims*) ; initialized in !COLD-INIT-FORMS
+
+(!begin-collecting-cold-init-forms)
+(!cold-init-forms (setf *queued-proclaims* nil))
+(!defun-from-collected-cold-init-forms !early-proclaim-cold-init)
+
+(defun sb!xc:proclaim (raw-form)
+ #+sb-xc (/show0 "entering PROCLAIM, RAW-FORM=..")
+ #+sb-xc (/hexstr raw-form)
+ (let* ((form (canonized-decl-spec raw-form))
+ (kind (first form))
+ (args (rest form)))