unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Nonsensical byte compiler warning.
Date: 1 Apr 2007 22:57:03 +0200	[thread overview]
Message-ID: <20070401221550.GB1063@muc.de> (raw)
In-Reply-To: <87lkhcj791.fsf@stupidchicken.com>

Hi Chong and David!

On Sun, Apr 01, 2007 at 02:10:18PM -0400, Chong Yidong wrote:
> David Kastrup <dak@gnu.org> 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.

  reply	other threads:[~2007-04-01 20:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-01 17:14 Nonsensical byte compiler warning David Kastrup
2007-04-01 18:10 ` Chong Yidong
2007-04-01 20:57   ` Alan Mackenzie [this message]
2007-04-02 12:29   ` Richard Stallman
2007-04-04  4:48     ` Markus Triska
2007-04-04  6:15       ` David Kastrup
2007-04-04  8:19         ` Markus Triska
2007-04-04  8:46           ` David Kastrup
2007-04-04  9:50             ` Markus Triska
2007-04-04 10:17               ` David Kastrup
2007-04-04 12:35                 ` Markus Triska
2007-04-04 18:25                 ` Markus Triska
2007-04-04 22:13                   ` David Kastrup
2007-04-05  6:52             ` Richard Stallman
2007-04-05  7:55               ` Markus Triska
2007-04-06 12:56                 ` Richard Stallman
2007-04-06 15:11                   ` Chong Yidong
2007-04-08 20:47                   ` Markus Triska
2007-04-09 15:42                     ` Richard Stallman
2007-04-10  3:53                       ` Glenn Morris
2007-04-10 17:27                         ` Markus Triska
2007-04-11  4:00                           ` Glenn Morris
2007-04-05 18:01               ` Chong Yidong
2007-04-04 20:08           ` Alan Mackenzie
2007-04-04 21:45             ` Markus Triska
2007-04-04 22:11               ` Chong Yidong
2007-04-05  5:44                 ` Markus Triska
2007-04-08  1:21             ` Kim F. Storm
2007-04-08 11:27               ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070401221550.GB1063@muc.de \
    --to=acm@muc.de \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).