From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bojohan+news@dd.chalmers.se (Johan =?utf-8?Q?Bockg=C3=A5rd?=) Newsgroups: gmane.emacs.devel Subject: Re: [bojohan+mail@dd.chalmers.se: The `cl-functions' byte compiler warning doesn't work] Date: Wed, 13 Jun 2007 02:13:21 +0200 Message-ID: References: <466C2412.5040600@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1181694003 16347 80.91.229.12 (13 Jun 2007 00:20:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Jun 2007 00:20:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 13 02:20:00 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HyGac-0002cQ-Ly for ged-emacs-devel@m.gmane.org; Wed, 13 Jun 2007 02:19:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HyGac-00038Q-0u for ged-emacs-devel@m.gmane.org; Tue, 12 Jun 2007 20:19:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HyGZx-0002qC-5J for emacs-devel@gnu.org; Tue, 12 Jun 2007 20:19:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HyGZw-0002p1-4h for emacs-devel@gnu.org; Tue, 12 Jun 2007 20:19:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HyGZw-0002ov-1h for emacs-devel@gnu.org; Tue, 12 Jun 2007 20:19:16 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HyGZv-0005GS-Ir for emacs-devel@gnu.org; Tue, 12 Jun 2007 20:19:15 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HyGZA-0001AB-9B for emacs-devel@gnu.org; Wed, 13 Jun 2007 02:18:28 +0200 Original-Received: from gamma02.me.chalmers.se ([129.16.50.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Jun 2007 02:18:28 +0200 Original-Received: from bojohan+news by gamma02.me.chalmers.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Jun 2007 02:18:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 80 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: gamma02.me.chalmers.se Mail-Copies-To: never User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:aShnoIcgji8JSWzbNG69nksG5+0= X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:72732 Archived-At: martin rudalics writes: > I've checked in a fix. Please try. The change is correct. However, I've found two further problems in this function: (defun byte-compile-find-cl-functions () (unless byte-compile-cl-functions (dolist (elt load-history) (when (and (stringp (car elt)) (string-match "^cl\\>" (file-name-nondirectory (car elt)))) (setq byte-compile-cl-functions (append byte-compile-cl-functions (cdr elt))))) (let ((tail byte-compile-cl-functions)) (while tail (if (and (consp (car tail)) (eq (car (car tail)) 'autoload)) (setcar tail (cdr (car tail)))) (setq tail (cdr tail)))))) 1. It looks for `(autoload . FOO)' entries in load-history, but not for `(defun . FOO)' (it wrongly assumes that functions are represented by plain symbols). 2. It modifies load-history as a side-effect. (And byte-compile-cl-functions contains useless non-function (require/t/provide) entries) This illustrates the problems: $ emacs -Q (require 'cl) (byte-compile (lambda () (subst nil nil nil))) => no warning (byte-compile (lambda () (subst-if nil nil nil))) => Warning: Function `subst-if' from cl package called at runtime ;; The `(autoload . CL-FUNCTION)' entries in `load-history' have been replaced by `CL-FUNCTION'. In the first case, the (defun . subst) entry is not respected. In the second case, the `(autoload . subst-if)' entry is found. This is transformed into a symbol by `setcar'ing structure shared between byte-compile-cl-functions and load-history. This patch uses the `(defun . FOO)' entry format, and avoids modifying load-history: --- bytecomp.el 13 Jun 2007 01:27:08 +0200 2.201 +++ bytecomp.el 13 Jun 2007 01:02:49 +0200 @@ -1359,12 +1359,12 @@ (string-match "^cl\\>" (file-name-nondirectory (car elt)))) (setq byte-compile-cl-functions - (append byte-compile-cl-functions - (cdr elt))))) + (append (cdr elt) + byte-compile-cl-functions)))) (let ((tail byte-compile-cl-functions)) (while tail (if (and (consp (car tail)) - (eq (car (car tail)) 'autoload)) + (memq (car (car tail)) '(autoload defun))) (setcar tail (cdr (car tail)))) (setq tail (cdr tail)))))) -- Johan Bockgård