Subject: bug#36597: 27.0.50; rehash hash tables eagerly in pdumper

From: Eli Zaretskii <[email-masked]>
Date: Tue, 11 Aug 2020 17:52:44 +0300

> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> From: Paul Eggert <[email-masked]>
> Date: Tue, 11 Aug 2020 02:33:34 -0700
> 
> It also simplifies the code a bit, so I took the liberty of installing it

It doesn't compile here:

  pdumper.c: In function 'dump_queue_enqueue':
  pdumper.c:1012:19: warning: unknown conversion type character 'l' in format [-Wformat=]
   1012 |       dump_trace ("new object %0*"pI"x weight=%d\n", EMACS_INT_XDIGITS, uobj,
	|                   ^~~~~~~~~~~~~~~~
  In file included from character.h:27,
		   from buffer.h:27,
		   from pdumper.c:34:
  lisp.h:108:17: note: format string is defined here
    108 | #   define pI "ll"
	|                 ^
  pdumper.c:1012:19: warning: format '%d' expects argument of type 'int', but argument 3 has type 'EMACS_UINT' {aka 'long long unsigned int'} [-Wformat=]
   1012 |       dump_trace ("new object %0*"pI"x weight=%d\n", EMACS_INT_XDIGITS, uobj,
	|                   ^~~~~~~~~~~~~~~~                                      ~~~~
	|                                                                         |
	|
  EMACS_UINT {aka long long unsigned int}
  pdumper.c:1012:48: note: format string is defined here
   1012 |       dump_trace ("new object %0*"pI"x weight=%d\n", EMACS_INT_XDIGITS, uobj,
	|                                               ~^
	|                                                |
	|                                                int
	|                                               %I64d
  pdumper.c:1012:19: warning: too many arguments for format [-Wformat-extra-args]
   1012 |       dump_trace ("new object %0*"pI"x weight=%d\n", EMACS_INT_XDIGITS, uobj,
	|                   ^~~~~~~~~~~~~~~~
  pdumper.c: In function 'dump_queue_dequeue':
  pdumper.c:1229:6: warning: format '%d' expects argument of type 'int', but argument 3 has type 'gl_intptr_t' {aka 'long int'} [-Wformat=]
   1229 |     (("dump_queue_dequeue basis=%"PRIdDUMP_OFF" fancy=%"PRIdPTR
	|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1230 |       " zero=%"PRIdPTR" normal=%"PRIdPTR" strong=%"PRIdPTR" hash=%td\n"),
	|       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   1231 |      basis,
   1232 |      dump_tailq_length (&dump_queue->fancy_weight_objects),
	|      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	|      |
	|      gl_intptr_t {aka long int}
  pdumper.c:1229:6: warning: format '%d' expects argument of type 'int', but argument 4 has type 'gl_intptr_t' {aka 'long int'} [-Wformat=]
  pdumper.c:1229:6: warning: format '%d' expects argument of type 'int', but argument 5 has type 'gl_intptr_t' {aka 'long int'} [-Wformat=]
  pdumper.c:1229:6: warning: format '%d' expects argument of type 'int', but argument 6 has type 'gl_intptr_t' {aka 'long int'} [-Wformat=]
  pdumper.c:1229:6: warning: unknown conversion type character 't' in format [-Wformat=]
  pdumper.c:1229:6: warning: too many arguments for format [-Wformat-extra-args]
  pdumper.c:1310:15: warning: unknown conversion type character 'l' in format [-Wformat=]
   1310 |   dump_trace ("  result score=%f src=%s object=%0*"pI"x\n",
	|               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from character.h:27,
		   from buffer.h:27,
		   from pdumper.c:34:
  lisp.h:108:17: note: format string is defined here
    108 | #   define pI "ll"
	|                 ^
  pdumper.c:1310:15: warning: too many arguments for format [-Wformat-extra-args]
   1310 |   dump_trace ("  result score=%f src=%s object=%0*"pI"x\n",
	|               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  pdumper.c: In function 'hash_table_thaw':
  pdumper.c:2667:30: error: conversion from 'EMACS_INT' {aka 'long long int'} to 'ptrdiff_t' {aka 'int'} may change value [-Werror=conversion]
   2667 |   h->hash = make_nil_vector (XFIXNUM (h->hash));
	|                              ^~~~~~~~~~~~~~~~~
  cc1.exe: some warnings being treated as errors
  Makefile:401: recipe for target `pdumper.o' failed
  make[1]: *** [pdumper.o] Error 1