Subject: Re: bug#6740: Spurious byte compiler warnings

From: Alan Mackenzie <[email-masked]>
Date: Tue, 27 Jul 2010 21:23:28 +0000

Hi, Dan,

On Tue, Jul 27, 2010 at 04:26:03PM -0400, Dan Nicolaescu wrote:
> Alan Mackenzie <[email-masked]> writes:

> > Hi, Emacs!

> > (i) Start Emacs, even a most recent bzr version, with -Q.
> > (ii) Put the following into the *scratch* buffer:

> >     (eval-when-compile
> >       (if (and (not (featurep 'cc-fix))
> >                (featurep 'xemacs)
> >                (progn
> >                  (require 'font-lock)
> >                  (let (font-lock-keywords)
> >                    (font-lock-compile-keywords '("\\<\\>"))
> >                    font-lock-keywords)))
> >           (cc-load "cc-fix")))

> >   (This fragment is at the top level, and taken from cc-defs.el.).
> > (iii) do M-x compile-defun on this form.

> > The byte compiler then issues the following two identical error
> > messages:

> >     Warning: value returned from (featurep (quote cc-fix)) is unused
> >     Warning: value returned from (featurep (quote cc-fix)) is unused

> > It is obvious that that value is indeed used.  This is a bug.

> The byte compiler knows that (featurep 'xemacs) is false, so 
>  (and (not (featurep 'cc-fix)) ... )
> will be false, so the featurep result is indeed unused.

Ah, thanks for the explanation!  But .....

It's a bug that the error message is repeated, at the very least.  And
the message is most assuredly false because (featurep 'cc-fix) isn't
always false - for example when it's run under XEmacs.

> If you use (and (featurep 'xemacs) (not (featurep 'cc-fix) ...
> the warning will go away.

At the very least, emitting such arcane warnings is unhelpful.  Are there
any circumstances in which such a warning might help a hacker improve his
code?  Surely we aren't in the business of making it difficult to adapt
code for XEmacs?

I think it's clear, the only code containing (featurep 'xemacs) is
portable code.  Can we please remove this unhelpful warning?

-- 
Alan Mackenzie (Nuremberg, Germany).