[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6740: Spurious byte compiler warnings

From: Alan Mackenzie
Subject: bug#6740: Spurious byte compiler warnings
Date: Wed, 28 Jul 2010 19:45:11 +0000
User-agent: Mutt/1.5.9i

Hi, Juanma,

On Wed, Jul 28, 2010 at 07:56:32PM +0200, Juanma Barranquero wrote:
> > What use is this warning message?  How could it prompt a hacker to
> > improve his code?  (That's a genuine question, not a rhetorical one.)

> It's a warning about non-side-effects code whose result is discarded,
> so it obviously prompts the programmer to either check that it didn't
> make a mistake (like forgetting to assign the expression's result to a
> variable), or remove the code altogether if it is leftover code from a
> cut&paste or refactoring.

OK, thanks.

> > What do you mean by "generic" here?  Is the same trick performed on
> > symbols other than 'xemacs?

> The warning has *nothing* to do with the xemacs symbol. It would still
> be there if you did "(and (not (featurep 'cc-fix)) nil ...)". It just
> happens to be triggered, in this particular case, by the byte-compiler
> optimizing (featurep 'xemacs) to nil. So the warning is entirely
> generic.

I'm not any more doubting the correctness of the message; I'm doubting
its adequacy.  Without understanding that (featurep 'xemacs) has been
optimised to nil, it's impossible to understand the current message
(either of them).  I've spent a long, long time puzzling over this error
message.  If only there were a warning about 'xemacs, it would be plain
and obvious.

> > Does anybody actually care about "(featurep 'xemacs)" being optimised
> > away?

> IIRC, optimizing (featurep 'xemacs) => nil is done, *precisely*, to
> help compiling portable code.

Misunderstanding, sorry!  I'm all in favour of this optimisation being
done.  But I don't care about it, in the sense I don't want to have to
make sense of a confusing message about it.  Does anybody care about
it enough to want that message in this particular case?  Couldn't the
optimisation just be done quietly in the background, with no warning?
Or couldn't there be a warning like

    "`(featurep 'xemacs)' has been translated to nil"


> Because you can have

>  (if (featurep 'xemacs)
>      ;; lots of code which would throw warnings or errors on Emacs
>      ;; because of incompatible parameter profiles and such
>    ;; else
>    ;; code for emacs

> and compile it without getting warnings of errors in code that will
> never be executed on Emacs anyway.

OK, I can see that.

>     Juanma

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]