Subject: bug#58224: 29.0.50; "make bootstrap" spuriously warns: "comp.el newer than byte-compiled file"

From: Alan Mackenzie <[email-masked]>
Date: Sat, 1 Oct 2022 21:15:46 +0000

Hello again, Stefan.

I've hacked a quick fix together.  The idea is to give the variable
force-load-messages an extra possibility, 'never.  This suppresses the
messages we want to suppress.

No guarantees, but the patch is below, if you want to try it out.

On Sat, Oct 01, 2022 at 18:11:38 +0000, Alan Mackenzie wrote:
> Hello, Stefan.

> On Sat, Oct 01, 2022 at 18:10:19 +0200, Stefan Kangas wrote:
> > Eli Zaretskii <[email-masked]> writes:

> > > (This has nothing to do with what Lars did, it's due to changes by
> > > Alan to speedup the first stage of the bootstrap.)

> > Oh, right.  I forgot about that.

> > I'm copying in Alan, in case he has any comments.

> Well, my thoughts back when implementing that speedup were that the
> speedup was more important than a few irritating messages.  I suppose
> that's becomng less true as the long delays from the past fade from
> memory.

> The particular message about "<file> newer than byte-compile file; using
> older file" is hard-coded into Fload in src/lread.c.  It was considered
> important enough to supersede the flag variable force-load-messages.  It
> also supersedes the parameter NOMESSAGE to Fload.

> I don't know why this message is considered so important.  Maybe we
> might reconsider its importance.  But there are already two flag
> variables meant to control messages from Fload, so adding a third
> special one probably wouldn't be a good idea.

> This doesn't seem like an easy issue to resolve without nasty special
> case code.  Either that, or we reconsider the mechanism of making the
> ..elc files older to trigger make's recompiling of the .el files to .eln.
> Maybe there's a better way of doing that.

diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index bcf4a3146d..8065487f59 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -70,7 +70,8 @@ BYTE_COMPILE_FLAGS =
   --eval "(setq load-prefer-newer t byte-compile-warnings 'all)" \
 	$(BYTE_COMPILE_EXTRA_FLAGS)
 # ... but we must prefer .elc files for those in the early bootstrap.
-compile-first: BYTE_COMPILE_FLAGS = $(BYTE_COMPILE_EXTRA_FLAGS)
+compile-first: BYTE_COMPILE_FLAGS = \
+  --eval "(setq force-load-messages 'never)" $(BYTE_COMPILE_EXTRA_FLAGS)
 
 # Files to compile before others during a bootstrap.  This is done to
 # speed up the bootstrap process.  They're ordered by size, so we use
diff --git a/src/lread.c b/src/lread.c
index 51cbf811ba..1ae0f9c0cc 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1451,7 +1451,9 @@ 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) &&
+		      (NILP (Vforce_load_messages)
+		       || !EQ (Vforce_load_messages, Qnever)))
                     {
                       Lisp_Object msg_file;
                       msg_file = Fsubstring (found, make_fixnum (0), make_fixnum (-1));
@@ -1476,7 +1478,9 @@ Return t if the file exists and loads successfully.  */)
 	    }
 	  val = call4 (Vload_source_file_function, found, hist_file_name,
 		       NILP (noerror) ? Qnil : Qt,
-		       (NILP (nomessage) || force_load_messages) ? Qnil : Qt);
+		       (NILP (nomessage) ||
+			(!NILP (Vforce_load_messages) && !EQ (Vforce_load_messages, Qnever)))
+		       ? Qnil : Qt);
 	  return unbind_to (count, val);
 	}
     }
@@ -1529,7 +1533,8 @@ Return t if the file exists and loads successfully.  */)
   if (! NILP (Vpurify_flag))
     Vpreloaded_file_list = Fcons (Fpurecopy (file), Vpreloaded_file_list);
 
-  if (NILP (nomessage) || force_load_messages)
+  if (NILP (nomessage)
+      || (!NILP (Vforce_load_messages) && !EQ (Vforce_load_messages, Qnever)))
     {
       if (is_module)
         message_with_string ("Loading %s (module)...", file, 1);
@@ -1602,7 +1607,9 @@ Return t if the file exists and loads successfully.  */)
       saved_strings[i].size = 0;
     }
 
-  if (!noninteractive && (NILP (nomessage) || force_load_messages))
+  if (!noninteractive && (NILP (nomessage)
+			  || (!NILP (Vforce_load_messages)
+			      && !EQ (Vforce_load_messages, Qnever))))
     {
       if (is_module)
         message_with_string ("Loading %s (module)...done", file, 1);
@@ -5601,10 +5608,13 @@ incompatible byte codes can make Emacs crash when it tries to execute
 them.  */);
   load_dangerous_libraries = 0;
 
-  DEFVAR_BOOL ("force-load-messages", force_load_messages,
-	       doc: /* Non-nil means force printing messages when loading Lisp files.
+  DEFVAR_LISP ("force-load-messages", Vforce_load_messages,
+	       doc: /* t means force printing messages when loading Lisp files.
+`never' means suppress all messages when loading Lisp files.  nil means just print
+certain "important" messages.
+
 This overrides the value of the NOMESSAGE argument to `load'.  */);
-  force_load_messages = 0;
+  Vforce_load_messages = Qnil;
 
   DEFVAR_LISP ("bytecomp-version-regexp", Vbytecomp_version_regexp,
 	       doc: /* Regular expression matching safe to load compiled Lisp files.
@@ -5685,6 +5695,8 @@ that are loaded before your customizations are read!  */);
   DEFSYM (Qdir_ok, "dir-ok");
   DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation");
 
+  DEFSYM (Qnever, "never");
+
   staticpro (&read_objects_map);
   read_objects_map = Qnil;
   staticpro (&read_objects_completed);

-- 
Alan Mackenzie (Nuremberg, Germany).