1.0.21.22: COMPILE-FILE and toplevel symbols
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 17 Oct 2008 11:57:32 +0000 (11:57 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Fri, 17 Oct 2008 11:57:32 +0000 (11:57 +0000)
 * The fopcompiler elided unused symbol references completely: warn
   and dump the appropriate SYMBOL-VALUE form even if the value is
   unused is the variable is undefined.

 * This reveals a missing start of a block comment in
   src/pcl/dfun.lisp -- fix it. Did you realize that ||# reads as a
   symbol? I didn't. One strike against using the "emacs friendly"
   #||...||# instead of #|...|#.

 * Also fix on #-sb-unicode issue in the test-suite.

NEWS
src/compiler/fopcompile.lisp
src/pcl/dfun.lisp
tests/compiler.pure.lisp
tests/compiler.test.sh
version.lisp-expr

diff --git a/NEWS b/NEWS
index 5befbfa..deaea56 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ changes in sbcl-1.0.22 relative to 1.0.21:
     was broken. (reporteed by Willem Broekema)
   * bug fix: SB-EXT:NATIVE-NAMESTRING on Windows did not work on
     pathnames without a directory.
+  * bug fix: COMPILE-FILE did not warn about undefined variable
+    references at toplevel, and LOAD of the resulting fasl did
+    not signal an error.
 
 changes in sbcl-1.0.21 relative to 1.0.20:
   * new feature: the compiler is able to track the effective type of a
index 16f9daf..6adfbf2 100644 (file)
                      ;; Special variable
                      (fopcompile `(symbol-value ',form) path for-value-p)
                      ;; Lexical
-                     (when for-value-p
-                       (let* ((lambda-var (cdr (assoc form (lexenv-vars *lexenv*))))
-                              (handle (when lambda-var
-                                        (lambda-var-fop-value lambda-var))))
-                         (if handle
-                             (sb!fasl::dump-push handle
-                                                 *compile-object*)
-                             (progn
-                               ;; Undefined variable. Signal a warning, and
-                               ;; treat it as a special variable reference,
-                               ;; like the real compiler does.
-                               (note-undefined-reference form :variable)
-                               (fopcompile `(symbol-value ',form)
-                                           path
-                                           for-value-p))))))))))
+                     (let* ((lambda-var (cdr (assoc form (lexenv-vars *lexenv*))))
+                            (handle (when lambda-var
+                                      (lambda-var-fop-value lambda-var))))
+                       (if handle
+                           (when for-value-p
+                             (sb!fasl::dump-push handle *compile-object*))
+                           (progn
+                             ;; Undefined variable. Signal a warning, and
+                             ;; treat it as a special variable reference, like
+                             ;; the real compiler does -- do not elide even if
+                             ;; the value is unused.
+                             (note-undefined-reference form :variable)
+                             (fopcompile `(symbol-value ',form)
+                                         path
+                                         for-value-p)))))))))
         ((listp form)
          (multiple-value-bind (macroexpansion macroexpanded-p)
              (sb!xc:macroexpand form *lexenv*)
index 3d5f353..96a0ffc 100644 (file)
@@ -1790,6 +1790,7 @@ Except see also BREAK-VICIOUS-METACIRCLE.  -- CSR, 2003-05-28
 ;;; I'm aware of, but they look like they might be useful for
 ;;; debugging or performance tweaking or something, so I've just
 ;;; commented them out instead of deleting them. -- WHN 2001-03-28
+#||
 (defun list-dfun (gf)
   (let* ((sym (type-of (gf-dfun-info gf)))
          (a (assq sym *dfun-list*)))
index 6fcfb21..0623c1f 100644 (file)
                       "foo"))))
 
 (with-test (:name :base-string-aref-type)
- (assert (eq 'base-char
+ (assert (eq #+sb-unicode 'base-char
+             #-sb-unicode 'character
              (funcall (compile nil
                                '(lambda (s)
                                  (sb-c::compiler-derived-type (aref (the base-string s) 0))))
index 5679935..0a479eb 100644 (file)
@@ -348,6 +348,13 @@ EOF
 expect_failed_compile $tmpfilename
 
 cat > $tmpfilename <<EOF
+x
+y
+z
+EOF
+expect_failed_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
 (declaim (optimize (speed 3) (space 0) (safety 0)))
 
 (defun foo (bar)
index 05892cc..42a05c0 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.21.21"
+"1.0.21.22"