From: Nikodemus Siivola Date: Mon, 28 Feb 2011 12:12:19 +0000 (+0000) Subject: 1.0.46.17: nicer STYLE-WARNINGS from IGNORE and IGNORABLE declarations X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=eda188832e16afa22cfdb274184d08d3228f9504;p=sbcl.git 1.0.46.17: nicer STYLE-WARNINGS from IGNORE and IGNORABLE declarations Fixes lp#726331, based on patch by Robert P. Goldman. --- diff --git a/NEWS b/NEWS index 5bf31b0..80d240b 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ changes relative to sbcl-1.0.46: * enhancement: (FORMAT "foo" ...) and similar signal a compile-time warning. (lp#327223) * enhancement: no more "in: LAMBDA NIL" messages from the compiler for forms processed using EVAL -- now the appropriate toplevel form is reported instead. + * enhancement: more legible style-warnings for inappropriate IGNORE and IGNORABLE + declarations. (lp#726331) * optimization: SLOT-VALUE &co are faster in the presence of SLOT-VALUE-USING-CLASS and its compatriots. * optimization: core startup time is reduced by 30% on x86-64. (lp#557357) diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index 1dff082..a46f8ad 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -1333,26 +1333,41 @@ (dolist (name (rest spec)) (let ((var (find-in-bindings-or-fbindings name vars fvars))) (cond - ((not var) - ;; ANSI's definition for "Declaration IGNORE, IGNORABLE" - ;; requires that this be a STYLE-WARNING, not a full WARNING. - (compiler-style-warn "declaring unknown variable ~S to be ignored" - name)) - ;; FIXME: This special case looks like non-ANSI weirdness. - ((and (consp var) (eq (car var) 'macro)) - ;; Just ignore the IGNORE decl. - ) - ((functional-p var) - (setf (leaf-ever-used var) t)) - ((and (lambda-var-specvar var) (eq (first spec) 'ignore)) - ;; ANSI's definition for "Declaration IGNORE, IGNORABLE" - ;; requires that this be a STYLE-WARNING, not a full WARNING. - (compiler-style-warn "declaring special variable ~S to be ignored" - name)) - ((eq (first spec) 'ignorable) - (setf (leaf-ever-used var) t)) - (t - (setf (lambda-var-ignorep var) t))))) + ((not var) + ;; ANSI's definition for "Declaration IGNORE, IGNORABLE" + ;; requires that this be a STYLE-WARNING, not a full WARNING. + (multiple-value-call #'compiler-style-warn + "~A declaration for ~A: ~A" + (first spec) + (if (symbolp name) + (values + (case (info :variable :kind name) + (:special "a special variable") + (:global "a global lexical variable") + (:alien "a global alien variable") + (t "an unknown variable")) + name) + (values + (if (info :function :kind (second name)) + "a global function" + "an unknown function") + (second name))))) + ((and (consp var) (eq (car var) 'macro)) + ;; Just ignore the IGNORE decl: we don't currently signal style-warnings + ;; for unused symbol-macros, so there's no need to do anything. + ) + ((functional-p var) + (setf (leaf-ever-used var) t)) + ((and (lambda-var-specvar var) (eq (first spec) 'ignore)) + ;; ANSI's definition for "Declaration IGNORE, IGNORABLE" + ;; requires that this be a STYLE-WARNING, not a full WARNING. + (compiler-style-warn "Declaring special variable ~S to be ~A" + name + (first spec))) + ((eq (first spec) 'ignorable) + (setf (leaf-ever-used var) t)) + (t + (setf (lambda-var-ignorep var) t))))) (values)) (defun process-dx-decl (names vars fvars kind) diff --git a/version.lisp-expr b/version.lisp-expr index 86cef74..45ce16b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -20,4 +20,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.46.16" +"1.0.46.17"