From: Juanma Barranquero <lekktu@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: Dan Nicolaescu <dann@gnu.org>, 6740@debbugs.gnu.org
Subject: bug#6740: Spurious byte compiler warnings
Date: Wed, 28 Jul 2010 19:56:32 +0200 [thread overview]
Message-ID: <AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@mail.gmail.com> (raw)
In-Reply-To: <20100728174933.GB2999@muc.de>
> But
> this discussion is most emphatically NOT about compiled code. It's about
> the process of compiling sources.
Warnings do not affect compatibility, so no problem there (though I
admit they are ugly).
> 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.
> 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.
> Surely it is a bug that "(featurep 'cc-fix)" appears in the message
> rather than "(featurep 'xemacs)". This situation is not about 'cc-fix,
> it's about 'xemacs.
Absolutely no, as shown above. At the point the byte-compiler throws
the warning, it does not know (I think) where the relevant nil came
from. It is rightly complaining that (featurep 'cc-fix) does nothing
and returns a value that goes unused. It would be possible to store
the original code before optimization and pass it to the warning
generation code, but it is likely not worth it.
> Does
> anybody actually care about "(featurep 'xemacs)" being optimised away?
IIRC, optimizing (featurep 'xemacs) => nil is done, *precisely*, to
help compiling portable code. 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.
Juanma
next prev parent reply other threads:[~2010-07-28 17:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 20:06 bug#6740: Spurious byte compiler warnings Alan Mackenzie
2010-07-27 20:26 ` Dan Nicolaescu
2010-07-27 21:23 ` Alan Mackenzie
2010-07-27 22:57 ` Juanma Barranquero
2010-07-28 17:49 ` Alan Mackenzie
2010-07-28 17:56 ` Juanma Barranquero [this message]
2010-07-28 19:45 ` Alan Mackenzie
2010-07-28 19:54 ` Juanma Barranquero
2010-07-28 23:00 ` Dan Nicolaescu
2010-07-29 20:24 ` Alan Mackenzie
2010-07-29 20:36 ` Juanma Barranquero
2010-07-27 21:40 ` Stefan Monnier
2020-11-19 4:25 ` Stefan Kangas
2020-11-24 6:40 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@mail.gmail.com' \
--to=lekktu@gmail.com \
--cc=6740@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=dann@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.