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: Nonsensical byte compiler warning. Date: 1 Apr 2007 22:57:03 +0200 Message-ID: <20070401221550.GB1063@muc.de> References: <85ps6okoe5.fsf@lola.goethe.zz> <87lkhcj791.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1175461038 17981 80.91.229.12 (1 Apr 2007 20:57:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 1 Apr 2007 20:57:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 01 22:57:14 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 1HY76v-0001t6-Di for ged-emacs-devel@m.gmane.org; Sun, 01 Apr 2007 22:57:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HY79s-0007Sj-DD for ged-emacs-devel@m.gmane.org; Sun, 01 Apr 2007 17:00:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HY79p-0007Sd-31 for emacs-devel@gnu.org; Sun, 01 Apr 2007 17:00:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HY79n-0007SI-MB for emacs-devel@gnu.org; Sun, 01 Apr 2007 17:00:12 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HY79n-0007SF-I0 for emacs-devel@gnu.org; Sun, 01 Apr 2007 17:00:11 -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 1HY76p-000383-Bd for emacs-devel@gnu.org; Sun, 01 Apr 2007 16:57:07 -0400 Original-Received: (qmail 48342 invoked by uid 3782); 1 Apr 2007 20:57:03 -0000 Original-Received: from acm.muc.de (p54A3F262.dip.t-dialin.net [84.163.242.98]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Apr 2007 22:57:01 +0200 Original-Received: (qmail 11928 invoked by uid 1000); 1 Apr 2007 22:15:50 -0000 Original-Date: Sun, 1 Apr 2007 23:15:50 +0100 Content-Disposition: inline In-Reply-To: <87lkhcj791.fsf@stupidchicken.com> 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:68899 Archived-At: Hi Chong and David! On Sun, Apr 01, 2007 at 02:10:18PM -0400, Chong Yidong wrote: > David Kastrup writes: > > when compiling the latest source (with "make cvs-update" in the lisp > > subdirectory), I get > > Compiling /home/tmp/emacs/lisp/progmodes/cc-cmds.el... > > In c-end-of-defun: > > progmodes/cc-cmds.el:1612:4:Warning: value returned by `char-after' is not > > used > > Wrote /home/tmp/emacs/lisp/progmodes/cc-cmds.elc > > I have no idea where this compiler warning is supposed to come from. > I don't know why the byte-compiler printed this confusing message, but > it seems to be issuing a real warning. There is a `when' statement at > cc-cmds.el:1633 that has no effect, because the return value of the > surrounding `if' form is discarded. Yes. There's something stupid about the code there - it looks as though I've half deleted something at some stage. I'll sort it out early this week, sometime. (Other things are of higher priority at the moment.) > This is probably just a bit of cruft, and easily corrected > (eliminating the warning in the process). Alan, could you verify > this? No, this is a long standing problem with cc-cmds.el. I first tried to track it down (compiled with Emacs 21) in April 2006, but didn't succeed, beyond identifying the line which I needed to comment out to get rid of the warning. The line was "(eq (char-before) ?\})" and was at the time in `c-end-of-defun' (which has since been radically changed). That line is now L1635; commenting it out silences the warning. The bug never seemed important enough to lose a lot of sleep over, but it does irritate. The (more detailed) warning message reported by Emacs 21 is: While compiling toplevel forms: ** `(char-after (1- (point)))' called for effect Seemingly, `char-before' is implemented as a macro in the byte-compiler in Emacs 21. I strongly believe that cc-cmds.el gets compiled correctly, and that the spurious warning is a bug in the byte compiler, triggered by something unusual in cc-cmds.el. Chong, could you ask the byte-compiler hacker to look at this, please? (I don't know who that is). > *** emacs/lisp/progmodes/cc-cmds.el.~1.55.~ 2007-03-30 18:31:07.000000000 -0400 > --- emacs/lisp/progmodes/cc-cmds.el 2007-04-01 14:05:04.000000000 -0400 > *************** > *** 1630,1639 **** > (setq arg (1+ arg))) > (if (< arg 0) > (setq arg (c-backward-to-nth-BOF-{ (- arg) where))) > ! (when (and (= arg 0) > ! (c-syntactic-skip-backward "^}") > ! (eq (char-before) ?\})) > ! t)) > ;; Move forward to the } of a function > (if (> arg 0) > --- 1630,1637 ---- > (setq arg (1+ arg))) > (if (< arg 0) > (setq arg (c-backward-to-nth-BOF-{ (- arg) where))) > ! (if (= arg 0) > ! (c-syntactic-skip-backward "^}"))) > ;; Move forward to the } of a function > (if (> arg 0) -- Alan.