From: Nikodemus Siivola Date: Tue, 5 Oct 2010 08:26:15 +0000 (+0000) Subject: 1.0.43.25: (LOOP WITH NIL = ...) caused unused variable style-warnings X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=f59b6f1f0406f2bbcbec4fa712c0e6d5df06e737;p=sbcl.git 1.0.43.25: (LOOP WITH NIL = ...) caused unused variable style-warnings Patch by Roman Marynchak. Fixes lp#613871. Always declare #:LOOP-IGNORE variables ignored -- even if they have initializations. --- diff --git a/NEWS b/NEWS index d52d2e5..7890257 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ changes relative to sbcl-1.0.43: so badly. (lp#654485) * bug fix: SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME no longer signals an error for eg. STRUCTURE. (lp#458015) + * bug fix: LOOP WITH NIL = ... signalled an unused variable style-warning. + (lp#613871, thanks to Roman Marynchak) changes in sbcl-1.0.43 relative to sbcl-1.0.42: * incompatible change: FD-STREAMS no longer participate in the serve-event diff --git a/src/code/loop.lisp b/src/code/loop.lisp index eea95f8..d42be8f 100644 --- a/src/code/loop.lisp +++ b/src/code/loop.lisp @@ -1037,9 +1037,8 @@ code to be loaded. (cond ((null name) (setq name (gensym "LOOP-IGNORE-")) (push (list name initialization) *loop-vars*) - (if (null initialization) - (push `(ignore ,name) *loop-declarations*) - (loop-declare-var name dtype))) + (push `(ignore ,name) *loop-declarations*) + (loop-declare-var name dtype)) ((atom name) (when (or (assoc name *loop-vars*) (loop-var-p name)) diff --git a/tests/loop.pure.lisp b/tests/loop.pure.lisp index 84a833a..804cac0 100644 --- a/tests/loop.pure.lisp +++ b/tests/loop.pure.lisp @@ -256,3 +256,15 @@ (assert (equal '("foo" "bar") (funcall fun (vector "foo" "bar")))))) + +(with-test (:name :bug-lp613871) + (multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (loop with nil = 1 repeat 2 collect t))) + (assert (null warnings-p)) + (assert (null failure-p)) + (assert (equal '(t t) (funcall function)))) + (multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (loop with nil repeat 2 collect t))) + (assert (null warnings-p)) + (assert (null failure-p)) + (assert (equal '(t t) (funcall function))))) diff --git a/version.lisp-expr b/version.lisp-expr index b34225a..f09282b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,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.43.24" +"1.0.43.25"