From 3cc1706c63fde2e5a6313537817db2d32e829b6a Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sun, 2 Oct 2022 20:31:12 +0000 Subject: [PATCH] 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. --- lisp/Makefile.in | 16 +++++++++------- src/lread.c | 8 +++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index bcf4a3146d4..e66d80f8144 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -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) \ diff --git a/src/lread.c b/src/lread.c index 51cbf811bab..dfa4d9afb51 100644 --- a/src/lread.c +++ b/src/lread.c @@ -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)); -- 2.39.2