GNU bug report logs -
#39385
Erroneous interaction of eval-when-compile and condition-case
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Sat, 1 Feb 2020 21:48:02 UTC
Severity: normal
Tags: notabug
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39385 in the body.
You can then email your comments to 39385 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39385
; Package
emacs
.
(Sat, 01 Feb 2020 21:48:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alan Mackenzie <acm <at> muc.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 01 Feb 2020 21:48:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39385
; Package
emacs
.
(Sun, 02 Feb 2020 01:05:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 39385 <at> debbugs.gnu.org (full text, mbox):
Alan Mackenzie <acm <at> muc.de> writes:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (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
The same happens without eval-when-compile.
> . This should have been caught by the condition-case generated by
> (c-safe ...).
I don't think so, because the condition-case is in the code generated by
c-safe (because the condition-case is quoted), whereas the error is
signaled while generating the code (because the error call is not
quoted).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39385
; Package
emacs
.
(Sun, 02 Feb 2020 13:21:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 39385 <at> debbugs.gnu.org (full text, mbox):
Hello, Noam.
On Sat, Feb 01, 2020 at 20:04:11 -0500, Noam Postavsky wrote:
> Alan Mackenzie <acm <at> muc.de> writes:
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > (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
> The same happens without eval-when-compile.
> > . This should have been caught by the condition-case generated by
> > (c-safe ...).
> I don't think so, because the condition-case is in the code generated by
> c-safe (because the condition-case is quoted), whereas the error is
> signaled while generating the code (because the error call is not
> quoted).
Ah, I think I've got it. The macro is being expanded before the
condition-case is active, and this is when it throws the error.
Thanks for the help.
I'll close this as notabug.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#39385
; Package
emacs
.
(Sun, 02 Feb 2020 15:38:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 39385 <at> debbugs.gnu.org (full text, mbox):
tags 39385 notabug
close 39385
quit
--
Alan Mackenzie (Nuremberg, Germany).
Added tag(s) notabug.
Request was from
Alan Mackenzie <acm <at> muc.de>
to
control <at> debbugs.gnu.org
.
(Sun, 02 Feb 2020 15:38:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
39385 <at> debbugs.gnu.org and Alan Mackenzie <acm <at> muc.de>
Request was from
Alan Mackenzie <acm <at> muc.de>
to
control <at> debbugs.gnu.org
.
(Sun, 02 Feb 2020 15:38:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 02 Mar 2020 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 162 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.