From: Alan Mackenzie <acm@muc.de>
To: 39385@debbugs.gnu.org
Subject: bug#39385: Erroneous interaction of eval-when-compile and condition-case
Date: Sat, 1 Feb 2020 21:47:31 +0000 [thread overview]
Message-ID: <20200201214731.GA11168@ACM> (raw)
Hello, Emacs.
On master, with emacs -Q.
Create the following file, bad-eval-when-compile.el:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro c-safe (&rest body)
;; safely execute BODY, return nil if an error occurred
`(condition-case nil
(progn ,@body)
(error nil)))
(defmacro foo ()
(error "This message should not be seen"))
(eval-when-compile
(c-safe (foo)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Now do M-x byte-compile-file <CR> bad-eval-when-compile.el <CR>. This
erroneously throws the error:
This message should not be seen
. This should have been caught by the condition-case generated by
(c-safe ...).
As a matter of interest, if eval-when-compile is replaced by
cc-eval-when-compile:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro cc-eval-when-compile (&rest body)
`(eval-when-compile
(eval '(progn ,@body))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
, then the compilation succeeds. So it would appear that there is a bug
in the byte compiler's handling of eval-when-compile.
--
Alan Mackenzie (Nuremberg, Germany).
next reply other threads:[~2020-02-01 21:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-01 21:47 Alan Mackenzie [this message]
2020-02-02 1:04 ` bug#39385: Erroneous interaction of eval-when-compile and condition-case Noam Postavsky
2020-02-02 13:20 ` Alan Mackenzie
2020-02-02 15:37 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200201214731.GA11168@ACM \
--to=acm@muc.de \
--cc=39385@debbugs.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.