0.8.10.41:
authorChristophe Rhodes <csr21@cam.ac.uk>
Thu, 20 May 2004 15:55:35 +0000 (15:55 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Thu, 20 May 2004 15:55:35 +0000 (15:55 +0000)
Fix BUGS 280 and 312: no more bogus duplicate warning
definitions.
... it appears that one cannot distinguish between XEPs for the
various different purposes;
... and I don't propose to try to make it possible...
... so alternative strategy: make DEFUN check for it.  Less
hi-tech, but also less broken.
... alter %COMPILER-DEFUN again to distinguish between
:COMPILE-TOPLEVEL uses and non-:CT.
... means another change in fasl file version.
... more test cases.

BUGS
NEWS
src/code/defboot.lisp
src/code/early-fasl.lisp
src/compiler/ir1final.lisp
src/compiler/ir1tran-lambda.lisp
tests/compiler.test.sh
version.lisp-expr

diff --git a/BUGS b/BUGS
index d16501c..4398f22 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1086,39 +1086,6 @@ WORKAROUND:
 
  (see also bug 117)
 
-280: bogus WARNING about duplicate function definition 
-  In sbcl-0.8.3 and sbcl-0.8.1.47, if BS.MIN is defined inline,
-  e.g. by 
-     (declaim (inline bs.min))
-     (defun bs.min (bases) nil)
-  before compiling the file below, the compiler warns
-     Duplicate definition for BS.MIN found in one static
-     unit (usually a file).
-  when compiling 
-    (declaim (special *minus* *plus* *stagnant*))
-    (defun b.*.min (&optional (x () xp) (y () yp) &rest rest)
-      (bs.min avec))
-    (define-compiler-macro b.*.min (&rest rest)
-      `(bs.min ,@rest))
-    (defun afish-d-rbd (pd)
-      (if *stagnant* 
-          (b.*.min (foo-d-rbd *stagnant*))
-          (multiple-value-bind (reduce-fn initial-value)
-              (etypecase pd
-                (list (values #'bs.min 0))
-                (vector (values #'bs.min *plus*)))
-            (let ((cv-ks (cv (kpd.ks pd))))
-              (funcall reduce-fn d-rbds)))))
-    (defun bfish-d-rbd (pd)
-      (if *stagnant* 
-          (b.*.min (foo-d-rbd *stagnant*))
-          (multiple-value-bind (reduce-fn initial-value)
-              (etypecase pd
-                (list (values #'bs.min *minus*))
-                (vector (values #'bs.min 0)))
-            (let ((cv-ks (cv (kpd.ks pd))))
-              (funcall reduce-fn d-rbds)))))
-
 281: COMPUTE-EFFECTIVE-METHOD error signalling.
   (slightly obscured by a non-0 default value for
    SB-PCL::*MAX-EMF-PRECOMPUTE-METHODS*)
@@ -1330,18 +1297,6 @@ WORKAROUND:
   spurious errors should two threads attempt to tokenise at the same
   time.
 
-312:
-  (reported by Jon Dyte)
-  SBCL issues a warning "Duplicate definition of FOO" compiling
-
-    (declaim (inline foo))
-    (defun foo (x)
-      (1+ x))
-    (defun bar (y)
-      (list (foo y) (if (> y 1) (funcall (if (> y 0) #'foo #'identity) y))))
-
-  (probably related to the bug 280.)
-
 314: "LOOP :INITIALLY clauses and scope of initializers"
   reported by Bruno Haible sbcl-devel "various SBCL bugs" from CLISP
   test suite, originally by Thomas F. Burdick.
diff --git a/NEWS b/NEWS
index e186ee4..323e4a1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2448,6 +2448,9 @@ changes in sbcl-0.8.11 relative to sbcl-0.8.10:
   * fixed bug: as reported by Juan Ripoll on cmucl-imp,
     MULTIPLE-VALUE-BIND should be able to lexically bind lambda list
     keywords.
+  * fixed bugs 280 and 312: the checking for multiple definitions in a
+    file is less likely to become confused by uses of inline
+    functions.
   * optimization: rearranged the expansion of various defining macros
     so that each expands into only one top-level form in a
     :LOAD-TOPLEVEL context; this appears to decrease fasl sizes by
index 79eb722..a9cfbf7 100644 (file)
         (cold-fset ,name ,lambda)
 
         (eval-when (:compile-toplevel)
-          (sb!c:%compiler-defun ',name ',inline-lambda))
+          (sb!c:%compiler-defun ',name ',inline-lambda t))
         (eval-when (:load-toplevel :execute)
           (%defun ',name
                   ;; In normal compilation (not for cold load) this is
   (declare (type function def))
   (declare (type (or null simple-string) doc))
   (aver (legal-fun-name-p name)) ; should've been checked by DEFMACRO DEFUN
-  (sb!c:%compiler-defun name inline-lambda)
+  (sb!c:%compiler-defun name inline-lambda nil)
   (when (fboundp name)
     (/show0 "redefining NAME in %DEFUN")
     (style-warn "redefining ~S in DEFUN" name))
index 15cf2d0..5115bcb 100644 (file)
@@ -76,7 +76,7 @@
 ;;; versions which break binary compatibility. But it certainly should
 ;;; be incremented for release versions which break binary
 ;;; compatibility.
-(def!constant +fasl-file-version+ 49)
+(def!constant +fasl-file-version+ 50)
 ;;; (record of versions before 2003 deleted in 2003-04-26/0.pre8.107 or so)
 ;;; 38: (2003-01-05) changed names of internal SORT machinery
 ;;; 39: (2003-02-20) in 0.7.12.1 a slot was added to
 ;;;     microefficiency in sbcl-0.8.8.10
 ;;; 49: (2004-05-04) Changed implementation of DEFFOO macros and the
 ;;;     functions they expand to.
+;;; 50: (2004-05-20) Changed %COMPILER-DEFUN signature again.
 
 ;;; the conventional file extension for our fasl files
 (declaim (type simple-string *fasl-file-type*))
index 7fa816e..e0a9abf 100644 (file)
                   (type-specifier declared-ftype)
                   (type-specifier defined-ftype)))))
            (:defined
-            (setf (info :function :type source-name) defined-ftype)))
-         (when (fasl-output-p *compile-object*)
-           (if (member source-name *fun-names-in-this-file* :test #'equal)
-               (compiler-warn "~@<Duplicate definition for ~S found in ~
-                                one static unit (usually a file).~@:>"
-                              source-name)
-               (push source-name *fun-names-in-this-file*)))))))
+            (setf (info :function :type source-name) defined-ftype)))))))
   (values))
 
 ;;; Find all calls in COMPONENT to assumed functions and update the
index 053b6df..d1bd58f 100644 (file)
 ;;;
 ;;; The INLINE-EXPANSION is a LAMBDA-WITH-LEXENV, or NIL if there is
 ;;; no inline expansion.
-(defun %compiler-defun (name lambda-with-lexenv)
+(defun %compiler-defun (name lambda-with-lexenv compile-toplevel)
 
   (let ((defined-fun nil)) ; will be set below if we're in the compiler
 
-    (when (boundp '*lexenv*) ; when in the compiler
+    (when compile-toplevel
+      ;; better be in the compiler
+      (aver (boundp '*lexenv*)) 
       (when sb!xc:*compile-print*
        (compiler-mumble "~&; recognizing DEFUN ~S~%" name))
       (remhash name *free-funs*)
-      (setf defined-fun (get-defined-fun name)))
+      (setf defined-fun (get-defined-fun name))
 
-    (become-defined-fun-name name)
+      (aver (fasl-output-p *compile-object*))
+      (if (member name *fun-names-in-this-file* :test #'equal)
+         (compiler-warn "~@<Duplicate definition for ~S found in ~
+                          one static unit (usually a file).~@:>"
+                        name)
+         (push name *fun-names-in-this-file*)))
 
+    (become-defined-fun-name name)
+    
     (cond (lambda-with-lexenv
           (setf (info :function :inline-expansion-designator name)
                 lambda-with-lexenv)
index b7f34a1..0a4624c 100644 (file)
@@ -50,6 +50,23 @@ cat > $tmpfilename <<EOF
 EOF
 expect_clean_compile $tmpfilename
 
+# This shouldn't fail because it's not really a multiple definition
+cat > $tmpfilename <<EOF
+    (in-package :cl-user)
+    (eval-when (:compile-toplevel :load-toplevel :execute)
+      (defun foo (x) x))
+EOF
+expect_clean_compile $tmpfilename
+
+# Likewise
+cat > $tmpfilename <<EOF
+    (in-package :cl-user)
+    (eval-when (:compile-toplevel)
+      (defun foo (x) x))
+    (defun foo (x) x)
+EOF
+expect_clean_compile $tmpfilename
+
 # This shouldn't fail despite the apparent type mismatch, because of
 # the NOTINLINE declamation.
 cat > $tmpfilename <<EOF
@@ -60,6 +77,17 @@ cat > $tmpfilename <<EOF
 EOF
 expect_clean_compile $tmpfilename
 
+# This shouldn't fail, but did until sbcl-0.8.10.4x
+cat > $tmpfilename <<EOF
+    (in-package :cl-user)
+    (declaim (inline foo))
+    (defun foo (x)
+      (1+ x))
+    (defun bar (y)
+      (list (foo y) (if (> y 1) (funcall (if (> y 0) #'foo #'identity) y))))
+EOF
+expect_clean_compile $tmpfilename
+
 # This shouldn't fail despite the apparent type mismatch, because of
 # the NOTINLINE declaration.
 cat > $tmpfilename <<EOF
index e853de6..95de0ce 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".)
-"0.8.10.40"
+"0.8.10.41"