From: Adam Porter <adam@alphapapa.net>
To: 50569@debbugs.gnu.org
Subject: bug#50569: 28.0.50; [native-comp] emacs-lisp-native-compile-and-load does not load require'd files before compiling
Date: Mon, 13 Sep 2021 08:41:13 -0500 [thread overview]
Message-ID: <CAO_b3FVuLfcoZV0VqV3UPpvdHEUVTkYZs9ea2AcKVyr8u-Gpiw@mail.gmail.com> (raw)
#+TITLE: Native-comp macro-defining macro bug
Hi Andrea, et al,
This provides a way to reproduce a bug I seem to have found in the
native-comp feature in this Emacs version:
: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.5, cairo version 1.16.0) of 2021-09-06
* Summary
The function ~emacs-lisp-native-compile-and-load~ does not seem to
ensure that macros defined in a ~require~'d file are defined before
compiling the current buffer.
* Steps to reproduce
1. In an empty directory:
a. Make file =foo.el= with these contents:
#+begin_src elisp
(defmacro foo-define-definer (name prefix)
`(defmacro ,name (name args &rest body)
(let ((function-name (intern (concat ,prefix "-" (symbol-name name)))))
`(defun ,function-name ,args ,@body))))
(provide 'foo)
#+end_src
b. Make file =bar.el= with these contents:
#+begin_src elisp
(require 'foo)
(foo-define-definer bar-define-key "bar-key")
(bar-define-key baz (&rest args)
(message "%S" args))
(bar-key-baz 'ARG)
#+end_src
2. ~(push default-directory load-path)~.
3. ~(find-file "bar.el")~.
4. =M-x emacs-lisp-native-compile-and-load RET=.
*Expected results:*
+ Compilation succeeds without errors or warnings.
+ Macro ~bar-define-key~ is defined.
+ Function ~bar-key-baz~ is defined.
*Actual results:* Neither the macro nor the function are defined, and
these warnings are displayed in =*Compile-Log*=:
#+begin_example
Compiling file /home/me/src/emacs/misc/ecms/native-comp-macro-defining-macro-bug/bar.el
at Mon Sep 13 13:16:46 2021
bar.el:3:21: Warning: reference to free variable ‘bar-define-key’
bar.el:5:17: Warning: reference to free variable ‘baz’
bar.el:5:28: Warning: reference to free variable ‘args’
In end of data:
bar.el:8:2: Warning: the function ‘bar-key-baz’ is not known to be defined.
bar.el:5:22: Warning: the function ‘&rest’ is not known to be defined.
bar.el:5:2: Warning: the function ‘bar-define-key’ is not known to be defined.
bar.el:3:2: Warning: the function ‘foo-define-definer’ is not known to be
defined.
#+end_example
* Additional notes
+ If ~emacs-lisp-byte-compile-and-load~ is called before
~emacs-lisp-native-compile-and-load~, the native compilation succeeds
without errors or warnings, and the macro and function are defined.
--
Thanks,
Adam
next reply other threads:[~2021-09-13 13:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 13:41 Adam Porter [this message]
2022-08-25 15:16 ` bug#50569: 28.0.50; [native-comp] emacs-lisp-native-compile-and-load does not load require'd files before compiling Lars Ingebrigtsen
2022-08-25 22:05 ` Adam Porter
2022-08-26 10:59 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAO_b3FVuLfcoZV0VqV3UPpvdHEUVTkYZs9ea2AcKVyr8u-Gpiw@mail.gmail.com \
--to=adam@alphapapa.net \
--cc=50569@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).