1.0.43.25: (LOOP WITH NIL = ...) caused unused variable style-warnings
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 5 Oct 2010 08:26:15 +0000 (08:26 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 5 Oct 2010 08:26:15 +0000 (08:26 +0000)
 Patch by Roman Marynchak. Fixes lp#613871.

 Always declare #:LOOP-IGNORE variables ignored -- even if they
 have initializations.

NEWS
src/code/loop.lisp
tests/loop.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index d52d2e5..7890257 100644 (file)
--- 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
index eea95f8..d42be8f 100644 (file)
@@ -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))
index 84a833a..804cac0 100644 (file)
     (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)))))
index b34225a..f09282b 100644 (file)
@@ -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"