summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-07-07 12:29:27 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-07-07 12:33:35 -0700
commit8f522efe9a963cd3523ea6863f9bd44881cdf6b7 (patch)
tree10ba28c937e142395bcc4d81580d24fa334e1227
parentbda8a57141e6cb5455e1246c6ab394791fd6c582 (diff)
downloademacs-8f522efe9a963cd3523ea6863f9bd44881cdf6b7.tar.gz
Remove printmax_t etc.
printmax_t etc. were needed only for platforms that lacked support for printing intmax_t. These platforms are now so obsolete that they are no longer practical porting targets. * src/image.c (gs_load): Fix unlikely buffer overrun discovered while making these changes. It was introduced in 2011-07-17T00:34:43!eggert@cs.ucla.edu. * src/lisp.h (printmax_t, uprintmax_t, pMd, pMu, pMx): Remove. All uses replaced by their standard counterparts intmax_t, uintmax_t, PRIdMAX, PRIuMAX, PRIxMAX.
-rw-r--r--doc/lispref/internals.texi7
-rw-r--r--src/dbusbind.c18
-rw-r--r--src/dispnew.c6
-rw-r--r--src/doprnt.c8
-rw-r--r--src/editfns.c14
-rw-r--r--src/emacs.c5
-rw-r--r--src/filelock.c8
-rw-r--r--src/font.c6
-rw-r--r--src/frame.c16
-rw-r--r--src/gnutls.c4
-rw-r--r--src/image.c10
-rw-r--r--src/lisp.h19
-rw-r--r--src/print.c22
-rw-r--r--src/process.c6
-rw-r--r--src/sysdep.c8
-rw-r--r--src/timefns.c4
-rw-r--r--src/unexelf.c3
-rw-r--r--src/xdisp.c7
-rw-r--r--src/xselect.c8
19 files changed, 79 insertions, 100 deletions
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index f1f2ea215a5..72066d34f44 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -2662,13 +2662,10 @@ signed, unless this assumption is known to be safe. For example,
although @code{off_t} is always signed, @code{time_t} need not be.
@item
-Prefer the Emacs-defined type @code{printmax_t} for representing
-values that might be any signed integer that can be printed,
-using a @code{printf}-family function.
-
-@item
Prefer @code{intmax_t} for representing values that might be any
signed integer value.
+A @code{printf}-family function can print such a value
+via a format like @code{"%"PRIdMAX}.
@item
Prefer @code{bool}, @code{false} and @code{true} for booleans.
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 850d176c08f..90ba461c6bc 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -661,8 +661,8 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
xd_extract_signed (object,
TYPE_MINIMUM (dbus_int64_t),
TYPE_MAXIMUM (dbus_int64_t));
- printmax_t pval = val;
- XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
+ intmax_t pval = val;
+ XD_DEBUG_MESSAGE ("%c %"PRIdMAX, dtype, pval);
if (!dbus_message_iter_append_basic (iter, dtype, &val))
XD_SIGNAL2 (build_string ("Unable to append argument"), object);
return;
@@ -673,8 +673,8 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
dbus_uint64_t val =
xd_extract_unsigned (object,
TYPE_MAXIMUM (dbus_uint64_t));
- uprintmax_t pval = val;
- XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval);
+ uintmax_t pval = val;
+ XD_DEBUG_MESSAGE ("%c %"PRIuMAX, dtype, pval);
if (!dbus_message_iter_append_basic (iter, dtype, &val))
XD_SIGNAL2 (build_string ("Unable to append argument"), object);
return;
@@ -867,20 +867,18 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter)
case DBUS_TYPE_INT64:
{
dbus_int64_t val;
- printmax_t pval;
dbus_message_iter_get_basic (iter, &val);
- pval = val;
- XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
+ intmax_t pval = val;
+ XD_DEBUG_MESSAGE ("%c %"PRIdMAX, dtype, pval);
return INT_TO_INTEGER (val);
}
case DBUS_TYPE_UINT64:
{
dbus_uint64_t val;
- uprintmax_t pval;
dbus_message_iter_get_basic (iter, &val);
- pval = val;
- XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval);
+ uintmax_t pval = val;
+ XD_DEBUG_MESSAGE ("%c %"PRIuMAX, dtype, pval);
return INT_TO_INTEGER (val);
}
diff --git a/src/dispnew.c b/src/dispnew.c
index 52a7b6d6ee0..5a6662e0f3b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -157,7 +157,7 @@ static int history_idx;
/* A tick that's incremented each time something is added to the
history. */
-static uprintmax_t history_tick;
+static uintmax_t history_tick;
/* Add to the redisplay history how window W has been displayed.
MSG is a trace containing the information how W's glyph matrix
@@ -176,7 +176,7 @@ add_window_display_history (struct window *w, const char *msg, bool paused_p)
++history_idx;
snprintf (buf, sizeof redisplay_history[0].trace,
- "%"pMu": window %p (%s)%s\n%s",
+ "%"PRIuMAX": window %p (%s)%s\n%s",
history_tick++,
ptr,
((BUFFERP (w->contents)
@@ -203,7 +203,7 @@ add_frame_display_history (struct frame *f, bool paused_p)
buf = redisplay_history[history_idx].trace;
++history_idx;
- sprintf (buf, "%"pMu": update frame %p%s",
+ sprintf (buf, "%"PRIuMAX": update frame %p%s",
history_tick++,
ptr, paused_p ? " ***paused***" : "");
}
diff --git a/src/doprnt.c b/src/doprnt.c
index 64bb368ee3e..819700f6798 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -71,7 +71,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
%<flags><width><precision><length>character
where flags is [+ -0], width is [0-9]+, precision is .[0-9]+, and length
- is empty or l or the value of the pD or pI or pMd (sans "d") macros.
+ is empty or l or the value of the pD or pI or PRIdMAX (sans "d") macros.
Also, %% in a format stands for a single % in the output. A % that
does not introduce a valid %-sequence causes undefined behavior.
@@ -88,7 +88,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
the respective argument is to be treated as `long int' or `unsigned long
int'. Similarly, the value of the pD macro means to use ptrdiff_t,
the value of the pI macro means to use EMACS_INT or EMACS_UINT, the
- value of the pMd etc. macros means to use intmax_t or uintmax_t,
+ value of the PRIdMAX etc. macros means to use intmax_t or uintmax_t,
and the empty length modifier means `int' or `unsigned int'.
The width specifier supplies a lower limit for the length of the printed
@@ -179,7 +179,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
enum {
pDlen = sizeof pD - 1,
pIlen = sizeof pI - 1,
- pMlen = sizeof pMd - 2
+ pMlen = sizeof PRIdMAX - 2
};
enum {
no_modifier, long_modifier, pD_modifier, pI_modifier, pM_modifier
@@ -234,7 +234,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
length_modifier = pD_modifier;
if (mlen == pIlen && memcmp (fmt, pI, pIlen) == 0)
length_modifier = pI_modifier;
- if (mlen == pMlen && memcmp (fmt, pMd, pMlen) == 0)
+ if (mlen == pMlen && memcmp (fmt, PRIdMAX, pMlen) == 0)
length_modifier = pM_modifier;
}
diff --git a/src/editfns.c b/src/editfns.c
index ee538e50e25..fd9fbaeaea2 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3477,8 +3477,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
error ("Format specifier doesn't match argument type");
else
{
- /* Length of pM (that is, of pMd without the trailing "d"). */
- enum { pMlen = sizeof pMd - 2 };
+ /* Length of PRIdMAX without the trailing "d". */
+ enum { pMlen = sizeof PRIdMAX - 2 };
/* Avoid undefined behavior in underlying sprintf. */
if (conversion == 'd' || conversion == 'i')
@@ -3487,7 +3487,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
/* Create the copy of the conversion specification, with
any width and precision removed, with ".*" inserted,
with "L" possibly inserted for floating-point formats,
- and with pM inserted for integer formats.
+ and with PRIdMAX (sans "d") inserted for integer formats.
At most two flags F can be specified at once. */
char convspec[sizeof "%FF.*d" + max (sizeof "L" - 1, pMlen)];
char *f = convspec;
@@ -3616,7 +3616,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
{
if (FIXNUMP (arg))
{
- printmax_t x = XFIXNUM (arg);
+ intmax_t x = XFIXNUM (arg);
sprintf_bytes = sprintf (p, convspec, prec, x);
}
else
@@ -3636,7 +3636,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
}
else
{
- uprintmax_t x;
+ uintmax_t x;
bool negative;
if (FIXNUMP (arg))
{
@@ -3655,8 +3655,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
else
{
double d = XFLOAT_DATA (arg);
- double uprintmax = TYPE_MAXIMUM (uprintmax_t);
- if (! (0 <= d && d < uprintmax + 1))
+ double uintmax = UINTMAX_MAX;
+ if (! (0 <= d && d < uintmax + 1))
xsignal1 (Qoverflow_error, arg);
x = d;
negative = false;
diff --git a/src/emacs.c b/src/emacs.c
index fc1a4beec50..0f03dd656d3 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -150,7 +150,7 @@ bool display_arg;
#if defined GNU_LINUX && defined HAVE_UNEXEC
/* The gap between BSS end and heap start as far as we can tell. */
-static uprintmax_t heap_bss_diff;
+static uintmax_t heap_bss_diff;
#endif
/* To run as a background daemon under Cocoa or Windows,
@@ -2548,7 +2548,8 @@ You must run Emacs in batch mode in order to dump it. */)
{
fprintf (stderr, "**************************************************\n");
fprintf (stderr, "Warning: Your system has a gap between BSS and the\n");
- fprintf (stderr, "heap (%"pMu" bytes). This usually means that exec-shield\n",
+ fprintf (stderr, ("heap (%"PRIuMAX" bytes). "
+ "This usually means that exec-shield\n"),
heap_bss_diff);
fprintf (stderr, "or something similar is in effect. The dump may\n");
fprintf (stderr, "fail because of this. See the section about\n");
diff --git a/src/filelock.c b/src/filelock.c
index b1f7d9dce61..46349a63e4a 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -429,26 +429,26 @@ static int
lock_file_1 (char *lfname, bool force)
{
/* Call this first because it can GC. */
- printmax_t boot = get_boot_time ();
+ intmax_t boot = get_boot_time ();
Lisp_Object luser_name = Fuser_login_name (Qnil);
char const *user_name = STRINGP (luser_name) ? SSDATA (luser_name) : "";
Lisp_Object lhost_name = Fsystem_name ();
char const *host_name = STRINGP (lhost_name) ? SSDATA (lhost_name) : "";
char lock_info_str[MAX_LFINFO + 1];
- printmax_t pid = getpid ();
+ intmax_t pid = getpid ();
if (boot)
{
if (sizeof lock_info_str
<= snprintf (lock_info_str, sizeof lock_info_str,
- "%s@%s.%"pMd":%"pMd,
+ "%s@%s.%"PRIdMAX":%"PRIdMAX,
user_name, host_name, pid, boot))
return ENAMETOOLONG;
}
else if (sizeof lock_info_str
<= snprintf (lock_info_str, sizeof lock_info_str,
- "%s@%s.%"pMd,
+ "%s@%s.%"PRIdMAX,
user_name, host_name, pid))
return ENAMETOOLONG;
diff --git a/src/font.c b/src/font.c
index 409ffa6ae0c..b4a85a1ca5a 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1295,14 +1295,12 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
if (INTEGERP (val))
{
intmax_t v;
- if (! (integer_to_intmax (val, &v)
- && 0 < v && v <= TYPE_MAXIMUM (uprintmax_t)))
+ if (! (integer_to_intmax (val, &v) && 0 < v))
v = pixel_size;
if (v > 0)
{
- uprintmax_t u = v;
f[XLFD_PIXEL_INDEX] = p = font_size_index_buf;
- sprintf (p, "%"pMu"-*", u);
+ sprintf (p, "%"PRIdMAX"-*", v);
}
else
f[XLFD_PIXEL_INDEX] = "*-*";
diff --git a/src/frame.c b/src/frame.c
index 03bbbfb4da2..6363a873684 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1048,7 +1048,7 @@ make_minibuffer_frame (void)
/* Construct a frame that refers to a terminal. */
-static printmax_t tty_frame_count;
+static intmax_t tty_frame_count;
struct frame *
make_initial_frame (void)
@@ -1108,7 +1108,7 @@ make_terminal_frame (struct terminal *terminal)
{
register struct frame *f;
Lisp_Object frame;
- char name[sizeof "F" + INT_STRLEN_BOUND (printmax_t)];
+ char name[sizeof "F" + INT_STRLEN_BOUND (tty_frame_count)];
if (!terminal->name)
error ("Terminal is not live, can't create new frames on it");
@@ -1118,7 +1118,7 @@ make_terminal_frame (struct terminal *terminal)
XSETFRAME (frame, f);
Vframe_list = Fcons (frame, Vframe_list);
- fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
+ fset_name (f, make_formatted_string (name, "F%"PRIdMAX, ++tty_frame_count));
SET_FRAME_VISIBLE (f, 1);
@@ -2920,14 +2920,14 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
/* If NAME is nil, set the name to F<num>. */
if (NILP (name))
{
- char namebuf[sizeof "F" + INT_STRLEN_BOUND (printmax_t)];
+ char namebuf[sizeof "F" + INT_STRLEN_BOUND (tty_frame_count)];
/* Check for no change needed in this very common case
before we do any consing. */
if (frame_name_fnn_p (SSDATA (f->name), SBYTES (f->name)))
return;
- name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count);
+ name = make_formatted_string (namebuf, "F%"PRIdMAX, ++tty_frame_count);
}
else
{
@@ -4201,7 +4201,7 @@ void
gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
{
Lisp_Object tem;
- uprintmax_t w;
+ uintmax_t w;
char buf[INT_BUFSIZE_BOUND (w)];
/* Represent negative positions (off the top or left screen edge)
@@ -4249,7 +4249,7 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
warnings. */
w = (uintptr_t) FRAME_NATIVE_WINDOW (f);
store_in_alist (alistptr, Qwindow_id,
- make_formatted_string (buf, "%"pMu, w));
+ make_formatted_string (buf, "%"PRIuMAX, w));
#ifdef HAVE_X_WINDOWS
#ifdef USE_X_TOOLKIT
/* Tooltip frame may not have this widget. */
@@ -4257,7 +4257,7 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
#endif
w = (uintptr_t) FRAME_OUTER_WINDOW (f);
store_in_alist (alistptr, Qouter_window_id,
- make_formatted_string (buf, "%"pMu, w));
+ make_formatted_string (buf, "%"PRIuMAX, w));
#endif
store_in_alist (alistptr, Qicon_name, f->icon_name);
store_in_alist (alistptr, Qvisibility,
diff --git a/src/gnutls.c b/src/gnutls.c
index 1afbb2bd4e5..267ba9aba35 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2098,8 +2098,8 @@ gnutls_symmetric_aead (bool encrypting, gnutls_cipher_algorithm_t gca,
SAFE_FREE ();
return list2 (output, actual_iv);
# else
- printmax_t print_gca = gca;
- error ("GnuTLS AEAD cipher %"pMd" is invalid or not found", print_gca);
+ intmax_t print_gca = gca;
+ error ("GnuTLS AEAD cipher %"PRIdMAX" is invalid or not found", print_gca);
# endif
}
diff --git a/src/image.c b/src/image.c
index 6ead12166b6..b4b6c1bac1c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9735,8 +9735,8 @@ gs_image_p (Lisp_Object object)
static bool
gs_load (struct frame *f, struct image *img)
{
- uprintmax_t printnum1, printnum2;
- char buffer[sizeof " " + INT_STRLEN_BOUND (printmax_t)];
+ uintmax_t printnum1, printnum2;
+ char buffer[sizeof " " + 2 * INT_STRLEN_BOUND (intmax_t)];
Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width;
Lisp_Object frame;
double in_width, in_height;
@@ -9788,12 +9788,14 @@ gs_load (struct frame *f, struct image *img)
printnum1 = FRAME_X_DRAWABLE (f);
printnum2 = img->pixmap;
window_and_pixmap_id
- = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
+ = make_formatted_string (buffer, "%"PRIuMAX" %"PRIuMAX,
+ printnum1, printnum2);
printnum1 = FRAME_FOREGROUND_PIXEL (f);
printnum2 = FRAME_BACKGROUND_PIXEL (f);
pixel_colors
- = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
+ = make_formatted_string (buffer, "%"PRIuMAX" %"PRIuMAX,
+ printnum1, printnum2);
XSETFRAME (frame, f);
loader = image_spec_value (img->spec, QCloader, NULL);
diff --git a/src/lisp.h b/src/lisp.h
index 1a1d8ee7e48..8acf63fe227 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -134,25 +134,6 @@ enum { BITS_PER_BITS_WORD = BOOL_VECTOR_BITS_PER_CHAR };
#endif
verify (BITS_WORD_MAX >> (BITS_PER_BITS_WORD - 1) == 1);
-/* printmax_t and uprintmax_t are types for printing large integers.
- These are the widest integers that are supported for printing.
- pMd etc. are conversions for printing them.
- On C99 hosts, there's no problem, as even the widest integers work.
- Fall back on EMACS_INT on pre-C99 hosts. */
-#ifdef PRIdMAX
-typedef intmax_t printmax_t;
-typedef uintmax_t uprintmax_t;
-# define pMd PRIdMAX
-# define pMu PRIuMAX
-# define pMx PRIxMAX
-#else
-typedef EMACS_INT printmax_t;
-typedef EMACS_UINT uprintmax_t;
-# define pMd pI"d"
-# define pMu pI"u"
-# define pMx pI"x"
-#endif
-
/* Use pD to format ptrdiff_t values, which suffice for indexes into
buffers and strings. Emacs never allocates objects larger than
PTRDIFF_MAX bytes, as they cause problems with pointer subtraction.
diff --git a/src/print.c b/src/print.c
index 406abbf4a3f..dc44b1e89e0 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1017,8 +1017,8 @@ float_to_string (char *buf, double data)
if (isnan (data))
{
union ieee754_double u = { .d = data };
- uprintmax_t hi = u.ieee_nan.mantissa0;
- return sprintf (buf, &"-%"pMu".0e+NaN"[!u.ieee_nan.negative],
+ uintmax_t hi = u.ieee_nan.mantissa0;
+ return sprintf (buf, &"-%"PRIuMAX".0e+NaN"[!u.ieee_nan.negative],
(hi << 31 << 1) + u.ieee_nan.mantissa1);
}
#endif
@@ -1811,9 +1811,9 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
/* In theory this assignment could lose info on pre-C99
hosts, but in practice it doesn't. */
- uprintmax_t up = ui;
+ uintmax_t up = ui;
- int len = sprintf (buf, "at 0x%"pMx, up);
+ int len = sprintf (buf, "at 0x%"PRIxMAX, up);
strout (buf, len, len, printcharfun);
}
else
@@ -1841,9 +1841,9 @@ static void
print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
{
char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT),
- max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t),
+ max (sizeof " . #" + INT_STRLEN_BOUND (intmax_t),
max ((sizeof "at 0x"
- + (sizeof (uprintmax_t) * CHAR_BIT + 4 - 1) / 4),
+ + (sizeof (uintmax_t) * CHAR_BIT + 4 - 1) / 4),
40)))];
current_thread->stack_top = buf;
maybe_quit ();
@@ -2096,11 +2096,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
/* Negative values of print-length are invalid in CL.
Treat them like nil, as CMUCL does. */
- printmax_t print_length = (FIXNATP (Vprint_length)
- ? XFIXNAT (Vprint_length)
- : TYPE_MAXIMUM (printmax_t));
+ intmax_t print_length = (FIXNATP (Vprint_length)
+ ? XFIXNAT (Vprint_length)
+ : INTMAX_MAX);
- printmax_t i = 0;
+ intmax_t i = 0;
while (CONSP (obj))
{
/* Detect circular list. */
@@ -2109,7 +2109,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
/* Simple but incomplete way. */
if (i != 0 && EQ (obj, halftail))
{
- int len = sprintf (buf, " . #%"pMd, i / 2);
+ int len = sprintf (buf, " . #%"PRIdMAX, i >> 1);
strout (buf, len, len, printcharfun);
goto end_of_list;
}
diff --git a/src/process.c b/src/process.c
index cab390c10c6..5f552675db6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -888,13 +888,13 @@ make_process (Lisp_Object name)
/* If name is already in use, modify it until it is unused. */
Lisp_Object name1 = name;
- for (printmax_t i = 1; ; i++)
+ for (intmax_t i = 1; ; i++)
{
Lisp_Object tem = Fget_process (name1);
if (NILP (tem))
break;
- char const suffix_fmt[] = "<%"pMd">";
- char suffix[sizeof suffix_fmt + INT_STRLEN_BOUND (printmax_t)];
+ char const suffix_fmt[] = "<%"PRIdMAX">";
+ char suffix[sizeof suffix_fmt + INT_STRLEN_BOUND (i)];
AUTO_STRING_WITH_LEN (lsuffix, suffix, sprintf (suffix, suffix_fmt, i));
name1 = concat2 (name, lsuffix);
}
diff --git a/src/sysdep.c b/src/sysdep.c
index 48eebb594f7..c7d7eefc2ab 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3269,7 +3269,7 @@ system_process_attributes (Lisp_Object pid)
char *cmdline = NULL;
ptrdiff_t cmdline_size;
char c;
- printmax_t proc_id;
+ intmax_t proc_id;
int ppid, pgrp, sess, tty, tpgid, thcount;
uid_t uid;
gid_t gid;
@@ -3284,7 +3284,7 @@ system_process_attributes (Lisp_Object pid)
CHECK_NUMBER (pid);
CONS_TO_INTEGER (pid, pid_t, proc_id);
- sprintf (procfn, "/proc/%"pMd, proc_id);
+ sprintf (procfn, "/proc/%"PRIdMAX, proc_id);
if (stat (procfn, &st) < 0)
return attrs;
@@ -3505,7 +3505,7 @@ system_process_attributes (Lisp_Object pid)
struct psinfo pinfo;
int fd;
ssize_t nread;
- printmax_t proc_id;
+ intmax_t proc_id;
uid_t uid;
gid_t gid;
Lisp_Object attrs = Qnil;
@@ -3514,7 +3514,7 @@ system_process_attributes (Lisp_Object pid)
CHECK_NUMBER (pid);
CONS_TO_INTEGER (pid, pid_t, proc_id);
- sprintf (procfn, "/proc/%"pMd, proc_id);
+ sprintf (procfn, "/proc/%"PRIdMAX, proc_id);
if (stat (procfn, &st) < 0)
return attrs;
diff --git a/src/timefns.c b/src/timefns.c
index 7b5af6a5d24..3b7ed460222 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1573,9 +1573,9 @@ without consideration for daylight saving time. */)
static char const mon_name[][4] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
- printmax_t year_base = TM_YEAR_BASE;
+ intmax_t year_base = TM_YEAR_BASE;
char buf[sizeof "Mon Apr 30 12:49:17 " + INT_STRLEN_BOUND (int) + 1];
- int len = sprintf (buf, "%s %s%3d %02d:%02d:%02d %"pMd,
+ int len = sprintf (buf, "%s %s%3d %02d:%02d:%02d %"PRIdMAX,
wday_name[tm.tm_wday], mon_name[tm.tm_mon], tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec,
tm.tm_year + year_base);
diff --git a/src/unexelf.c b/src/unexelf.c
index 6d19bf1fb9f..79b3d444639 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -187,7 +187,8 @@ verify ((! TYPE_SIGNED (ElfW (Half))
&& TYPE_MAXIMUM (ElfW (Half)) <= PTRDIFF_MAX);
#ifdef UNEXELF_DEBUG
-# define DEBUG_LOG(expr) fprintf (stderr, #expr " 0x%jx\n", (uintmax_t) (expr))
+# define DEBUG_LOG(expr) fprintf (stderr, #expr " 0x%"PRIxMAX"\n", \
+ (uintmax_t) (expr))
#endif
/* Get the address of a particular section or program header entry,
diff --git a/src/xdisp.c b/src/xdisp.c
index 5fb690e746d..75cc97df1c0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10540,7 +10540,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
if (nlflag)
{
ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte;
- printmax_t dups;
+ intmax_t dups;
/* Since we call del_range_both passing false for PREPARE,
we aren't prepared to run modification hooks (we could
@@ -10572,11 +10572,12 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
if (dups > 1)
{
char dupstr[sizeof " [ times]"
- + INT_STRLEN_BOUND (printmax_t)];
+ + INT_STRLEN_BOUND (dups)];
/* If you change this format, don't forget to also
change message_log_check_duplicate. */
- int duplen = sprintf (dupstr, " [%"pMd" times]", dups);
+ int duplen = sprintf (dupstr, " [%"PRIdMAX" times]",
+ dups);
TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
insert_1_both (dupstr, duplen, duplen,
true, false, true);
diff --git a/src/xselect.c b/src/xselect.c
index 5f0bb44cc9a..c5085f7e7b4 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -63,13 +63,13 @@ static void lisp_data_to_selection_data (struct x_display_info *, Lisp_Object,
#ifdef TRACE_SELECTION
#define TRACE0(fmt) \
- fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid ())
+ fprintf (stderr, "%"PRIdMAX": " fmt "\n", (intmax_t) getpid ())
#define TRACE1(fmt, a0) \
- fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0)
+ fprintf (stderr, "%"PRIdMAX": " fmt "\n", (intmax_t) getpid (), a0)
#define TRACE2(fmt, a0, a1) \
- fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0, a1)
+ fprintf (stderr, "%"PRIdMAX": " fmt "\n", (intmax_t) getpid (), a0, a1)
#define TRACE3(fmt, a0, a1, a2) \
- fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0, a1, a2)
+ fprintf (stderr, "%"PRIdMAX": " fmt "\n", (intmax_t) getpid (), a0, a1, a2)
#else
#define TRACE0(fmt) (void) 0
#define TRACE1(fmt, a0) (void) 0