From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: add-change-log-entry Date: Sun, 22 Jul 2007 13:24:04 +0000 Message-ID: <20070722132404.GC895@muc.de> References: <469E1BAA.8090407@gnu.org> <469E248F.1050604@gmx.at> <469E8702.5000204@gmx.at> <46A07200.6010103@gmx.at> <46A1CD47.7070802@gmx.at> <46A318F9.6090006@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1185110659 5494 80.91.229.12 (22 Jul 2007 13:24:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2007 13:24:19 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 22 15:24:17 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 1ICbPz-0001bW-RG for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2007 15:24:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ICbPz-0004FE-3u for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2007 09:24:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ICbPu-0004EG-PR for emacs-devel@gnu.org; Sun, 22 Jul 2007 09:24:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ICbPt-0004Dh-IB for emacs-devel@gnu.org; Sun, 22 Jul 2007 09:24:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ICbPt-0004Dd-Fh for emacs-devel@gnu.org; Sun, 22 Jul 2007 09:24:09 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ICbPs-0005j7-OS for emacs-devel@gnu.org; Sun, 22 Jul 2007 09:24:09 -0400 Original-Received: (qmail 27770 invoked by uid 3782); 22 Jul 2007 13:24:06 -0000 Original-Received: from acm.muc.de (p54A3E96B.dip.t-dialin.net [84.163.233.107]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 22 Jul 2007 15:24:00 +0200 Original-Received: (qmail 2818 invoked by uid 1000); 22 Jul 2007 13:24:04 -0000 Content-Disposition: inline In-Reply-To: <46A318F9.6090006@gmx.at> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: FreeBSD 4.6-4.9 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:75296 Archived-At: Schönen guten Sontag, Martin! On Sun, Jul 22, 2007 at 10:44:41AM +0200, martin rudalics wrote: > > BTW, may I defvar c-beginning-of-defun and c-end-of-defun here, > > they are driving me mad. No, you may not! The only place they are defined, and as defuns, not variables, is in cc-cmds.el. > > You can add defvars for them without values or doc strings whenever > > needed to prevent warnings about code that is correct. > My question was non-sensical. I should have asked instead: What is the > canonical way to avoid byte-compiler messages for the undefined Er, I have a suspicion that this is a bug in the byte compiler that I wrote a fix for and forgot to commit. [Apologies to Richard, who asked me to commit it.] Would you please try this patch out and tell me if it fixes anything: [ Date: Tue, 23 May 2006 10:15:06 +0000 (GMT) From: Alan Mackenzie To: emacs-devel@gnu.org Subject: BUG + FIX. Spurious "might not be defined at runtime" from byte-compile-filei] ######################################################################### Hi, Emacs! Evaluate the following: (defun foo () (bar)) (byte-compile 'foo) (defun bar ()) (byte-compile 'bar) Get a cup of coffee, go for a twenty mile run, come back and do some furious hacking. Then do M-x byte-compile-file jrandom.el. You get the spurious warning: ** The function `bar' might not be defined at runtime. This happens because the (byte-compile 'foo) form (correctly) flags 'bar as an unknown function, recording it in byte-compile-unresolved-functions. The subsequent byte-compile-file initialises this variable AFTER doing the compilation rather than before - hence the silly warning. It seems to me this state of affairs was probably caused by the sloppy doc-string for the variable - it doesn't give any context for when its contents are gathered and used, hence hackers were (subconsciously) scared to initialise it properly, fearing they might discard important info. So I've amended the doc-string too. Should I commit this fix? 2006-05-23 Alan Mackenzie * emacs-lisp/bytecomp.el (byte-compile-from-buffer): initialize byte-compile-unresolved-functions before doing a compilation rather than afterwards. Amend the variable's doc-string. Index: bytecomp.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v retrieving revision 2.183 diff -c -r2.183 bytecomp.el *** bytecomp.el 11 Apr 2006 17:58:49 -0000 2.183 --- bytecomp.el 23 May 2006 09:56:18 -0000 *************** *** 453,459 **** (defvar byte-compile-unresolved-functions nil "Alist of undefined functions to which calls have been compiled. ! Used for warnings when the function is not known to be defined or is later defined with incorrect args.") (defvar byte-compile-noruntime-functions nil --- 453,460 ---- (defvar byte-compile-unresolved-functions nil "Alist of undefined functions to which calls have been compiled. ! This variable is only significant whilst compiling an entire buffer. ! Used for warnings when a function is not known to be defined or is later defined with incorrect args.") (defvar byte-compile-noruntime-functions nil *************** *** 1821,1826 **** --- 1822,1832 ---- (save-excursion (set-buffer inbuffer) (goto-char 1) + ;; Should we always do this? When calling multiple files, it + ;; would be useful to delay this warning until all have been + ;; compiled. A: Yes! b-c-u-f might contain dross from a + ;; previous byte-compile. + (setq byte-compile-unresolved-functions nil) ;; Compile the forms from the input buffer. (while (progn *************** *** 1837,1847 **** ;; Make warnings about unresolved functions ;; give the end of the file as their position. (setq byte-compile-last-position (point-max)) ! (byte-compile-warn-about-unresolved-functions) ! ;; Should we always do this? When calling multiple files, it ! ;; would be useful to delay this warning until all have ! ;; been compiled. ! (setq byte-compile-unresolved-functions nil)) ;; Fix up the header at the front of the output ;; if the buffer contains multibyte characters. (and filename (byte-compile-fix-header filename inbuffer outbuffer)))) --- 1843,1849 ---- ;; Make warnings about unresolved functions ;; give the end of the file as their position. (setq byte-compile-last-position (point-max)) ! (byte-compile-warn-about-unresolved-functions)) ;; Fix up the header at the front of the output ;; if the buffer contains multibyte characters. (and filename (byte-compile-fix-header filename inbuffer outbuffer)))) ######################################################################### -- Alan. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel