From: Andrea Corallo <acorallo@gnu.org>
To: Sean Devlin <spd@toadstyle.org>
Cc: 74368@debbugs.gnu.org
Subject: bug#74368: 31.0.50; Different warnings between native-compile and native-compile-async
Date: Sat, 16 Nov 2024 16:26:49 -0500 [thread overview]
Message-ID: <yp1wmh2na3q.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <39041F0A-3CD1-4665-9FE0-851334B3B37F@toadstyle.org> (Sean Devlin's message of "Fri, 15 Nov 2024 12:04:42 -0500")
Sean Devlin <spd@toadstyle.org> writes:
> Hi folks,
>
> I'm not sure if this is a bug, but I noticed a difference in behavior
> when compiling with native-compile and native-compile-async.
>
> Recipe:
>
> 1. mkdir /tmp/emacs-test
> 2. printf ";; -*- lexical-binding: t; -*-\n\n(vertico-mode)\n" > /tmp/emacs-test/test.el
> 2. HOME=/tmp/emacs-test emacs
> 3. M-x package-install RET vertico RET
> 4. M-: (native-compile "/tmp/emacs-test/test.el") RET
> 5. M-! touch /tmp/emacs-test/test.el RET
> 6. M-: (native-compile-async "/tmp/emacs-test/test.el") RET
>
> There is no warning when compiling synchronously, but there is a warning
> during asynchronous compilation:
>
> test.el:3:2: Warning: the function ‘vertico-mode’ is not known to be
> defined.
>
> I guess maybe the asynchronous compiler has not processed the autoloads
> from installed packages, whereas the synchronous compiler has.
>
> Is this difference in behavior expected? Or is one of the compilers
> behaving incorrectly?
>
> Thanks!
Hi Devlin,
yes this difference is expected, 'native-compile' runs the compilation
in the loaded Emacs so that all the definitions of loaded packages are
known to the compiler. 'native-compile-async' runs in a new fresh Emacs
so all requires need to be there in the compilation unit in order to let
the compiler be able to load the definitions.
We have also some doc in (info "(elisp) Native-Compilation Variables")
which goes like this:
A common cause for asynchronous native-compilation to produce
warnings is compiling a file that is missing some ‘require’ of a
necessary feature. The feature may be loaded into the main emacs,
but because native compilation always starts from a subprocess with
a pristine environment, that may not be true for the subprocess.
Regards
Andrea
next prev parent reply other threads:[~2024-11-16 21:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 17:04 bug#74368: 31.0.50; Different warnings between native-compile and native-compile-async Sean Devlin
2024-11-16 7:38 ` Eli Zaretskii
2024-11-16 19:38 ` Sean Devlin
2024-11-16 21:26 ` Andrea Corallo [this message]
2024-11-22 16:32 ` Sean Devlin
2024-11-23 12:37 ` Eli Zaretskii
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=yp1wmh2na3q.fsf@fencepost.gnu.org \
--to=acorallo@gnu.org \
--cc=74368@debbugs.gnu.org \
--cc=spd@toadstyle.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.