Suppress irritating/misleading message in make bootstrap about old .elc files

These are the "compile-first" .elc files, artificially given an old timestamp
to cause them later to be native compiled.  This fixes bug #58224.

* lisp/Makefile.in (compile-first .el.elc): Give these .elc's the UTC epoch.
Amend the comment.

* src/lread.c (Fload): New variable, epoch_timestamp, initialized to binary
zero.  Compare with this the timestamp of .elc's being loaded, and if they
match, don't output the message about the source file being newer than the
file being loaded.
This commit is contained in:
Alan Mackenzie 2022-10-02 20:31:12 +00:00
parent ffce59b3ad
commit 3cc1706c63
2 changed files with 16 additions and 8 deletions

View file

@ -304,16 +304,18 @@ endif
ifeq ($(HAVE_NATIVE_COMP),yes)
ifeq ($(ANCIENT),yes)
# The first compilation of compile-first, using an interpreted compiler:
# The resulting .elc files get given a date of 1971-01-01 so that their
# date stamp is earlier than the source files, causing these to be compiled
# into native code at the second recursive invocation of this $(MAKE),
# using these .elc's. This is faster than just compiling the native code
# directly using the interpreted compile-first files. (Note: 1970-01-01
# fails on some systems.)
# The resulting .elc files get given a timestamp of the Unix epoch,
# 1970-01-01, so that their timestamps are earlier than the source files,
# causing these to be compiled into native code at the second recursive
# invocation of this $(MAKE), using these .elc's. This is faster than just
# compiling the native code directly using the interpreted compile-first
# files. Note that the epoch date is hard-coded into Fload in src/lread.c
# which uses it to avoid displaying certain messages which might be
# irritating/misleading during a bootstrap.
.el.elc:
$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
-l comp -f batch-byte-compile $<
touch -t 197101010000 $@
TZ=UTC touch -t 197001010000 $@
else
.el.elc:
$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \

View file

@ -1423,6 +1423,7 @@ Return t if the file exists and loads successfully. */)
struct stat s1, s2;
int result;
struct timespec epoch_timespec = {(time_t)0, 0}; /* 1970-01-01T00:00 UTC */
if (version < 0 && !(version = safe_to_load_version (file, fd)))
error ("File `%s' was not compiled in Emacs", SDATA (found));
@ -1451,7 +1452,12 @@ Return t if the file exists and loads successfully. */)
newer = 1;
/* If we won't print another message, mention this anyway. */
if (!NILP (nomessage) && !force_load_messages)
if (!NILP (nomessage) && !force_load_messages
/* We don't want this message during
bootstrapping for the "compile-first" .elc
files, which have had their timestamps set to
the epoch. See bug #58224. */
&& timespec_cmp (get_stat_mtime (&s1), epoch_timespec))
{
Lisp_Object msg_file;
msg_file = Fsubstring (found, make_fixnum (0), make_fixnum (-1));