From: Christophe Rhodes Date: Sat, 26 Oct 2002 11:22:51 +0000 (+0000) Subject: 0.7.9.3: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=07e690d6ec0491352758ac278f2fa828a0a92e90;p=sbcl.git 0.7.9.3: Make DEFGENERIC reject forbidden declarations --- diff --git a/src/pcl/boot.lisp b/src/pcl/boot.lisp index c2184b3..0d67f60 100644 --- a/src/pcl/boot.lisp +++ b/src/pcl/boot.lisp @@ -171,6 +171,24 @@ bootstrapping. (let ((car-option (car option))) (case car-option (declare + (when (and + (consp (cadr option)) + (member (first (cadr option)) + ;; FIXME: this list is slightly weird. + ;; ANSI (on the DEFGENERIC page) in one + ;; place allows only OPTIMIZE; in + ;; another place gives this list of + ;; disallowed declaration specifiers. + ;; This seems to be the only place where + ;; the FUNCTION declaration is + ;; mentioned; TYPE seems to be missing. + ;; Very strange. -- CSR, 2002-10-21 + '(declaration ftype function + inline notinline special))) + (error 'simple-program-error + :format-control "The declaration specifier ~S ~ + is not allowed inside DEFGENERIC." + :format-arguments (list (cadr option)))) (push (cdr option) (initarg :declarations))) ((:argument-precedence-order :method-combination) (if (initarg car-option) diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index f5062b7..ef478bf 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -308,6 +308,17 @@ (defmethod documentation ((x (eql '+)) y) "WRONG") (assert (string= (documentation '+ 'function) answer))) +;;; only certain declarations are permitted in DEFGENERIC +(macrolet ((assert-program-error (form) + `(multiple-value-bind (value error) + (ignore-errors ,form) + (assert (null value)) + (assert (typep error 'program-error))))) + (assert-program-error (defgeneric bogus-declaration (x) + (declare (special y)))) + (assert-program-error (defgeneric bogus-declaration2 (x) + (declare (notinline concatenate))))) + ;;;; success (sb-ext:quit :unix-status 104) diff --git a/version.lisp-expr b/version.lisp-expr index 33b868b..130d6ed 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.9.2" +"0.7.9.3"