From e1cf2466998905e8e19e14cae6e478861ffd04ee Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 20 May 2004 15:55:35 +0000 Subject: [PATCH] 0.8.10.41: 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 | 45 -------------------------------------- NEWS | 3 +++ src/code/defboot.lisp | 4 ++-- src/code/early-fasl.lisp | 3 ++- src/compiler/ir1final.lisp | 8 +------ src/compiler/ir1tran-lambda.lisp | 17 ++++++++++---- tests/compiler.test.sh | 28 ++++++++++++++++++++++++ version.lisp-expr | 2 +- 8 files changed, 50 insertions(+), 60 deletions(-) diff --git a/BUGS b/BUGS index d16501c..4398f22 100644 --- 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 --- 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 diff --git a/src/code/defboot.lisp b/src/code/defboot.lisp index 79eb722..a9cfbf7 100644 --- a/src/code/defboot.lisp +++ b/src/code/defboot.lisp @@ -184,7 +184,7 @@ (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 @@ -201,7 +201,7 @@ (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)) diff --git a/src/code/early-fasl.lisp b/src/code/early-fasl.lisp index 15cf2d0..5115bcb 100644 --- a/src/code/early-fasl.lisp +++ b/src/code/early-fasl.lisp @@ -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 @@ -107,6 +107,7 @@ ;;; 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*)) diff --git a/src/compiler/ir1final.lisp b/src/compiler/ir1final.lisp index 7fa816e..e0a9abf 100644 --- a/src/compiler/ir1final.lisp +++ b/src/compiler/ir1final.lisp @@ -87,13 +87,7 @@ (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 "~@" - 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 diff --git a/src/compiler/ir1tran-lambda.lisp b/src/compiler/ir1tran-lambda.lisp index 053b6df..d1bd58f 100644 --- a/src/compiler/ir1tran-lambda.lisp +++ b/src/compiler/ir1tran-lambda.lisp @@ -1081,18 +1081,27 @@ ;;; ;;; 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 "~@" + 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) diff --git a/tests/compiler.test.sh b/tests/compiler.test.sh index b7f34a1..0a4624c 100644 --- a/tests/compiler.test.sh +++ b/tests/compiler.test.sh @@ -50,6 +50,23 @@ cat > $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < $tmpfilename < 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 <