bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xstrtoimax, xstrtoumax: depend on inttypes-incomplete


From: Paul Eggert
Subject: [PATCH] xstrtoimax, xstrtoumax: depend on inttypes-incomplete
Date: Sun, 23 Jan 2022 21:10:48 -0800

This fixes a call to strtoimax without declaring it,
and similarly for strtoumax.
* lib/xstrtoimax.c, lib/xstrtoumax.c (XSTRTOL_INCLUDE_INTTYPES_H):
Define, so that strtoimax and strtoumax are declared.
* lib/xstrtol.c [XSTRTOL_INCLUDE_INTTYPES_H]: Include inttypes.h.
* modules/xstrtoimax, modules/xstrtoumax (Depends-on):
Add inttypes-incomplete.
---
 ChangeLog          | 9 +++++++++
 lib/xstrtoimax.c   | 1 +
 lib/xstrtol.c      | 4 ++++
 lib/xstrtoumax.c   | 1 +
 modules/xstrtoimax | 1 +
 modules/xstrtoumax | 1 +
 6 files changed, 17 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 980d214b8b..fc4e46747b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2022-01-23  Paul Eggert  <eggert@cs.ucla.edu>
 
+       xstrtoimax, xstrtoumax: depend on inttypes-incomplete
+       This fixes a call to strtoimax without declaring it,
+       and similarly for strtoumax.
+       * lib/xstrtoimax.c, lib/xstrtoumax.c (XSTRTOL_INCLUDE_INTTYPES_H):
+       Define, so that strtoimax and strtoumax are declared.
+       * lib/xstrtol.c [XSTRTOL_INCLUDE_INTTYPES_H]: Include inttypes.h.
+       * modules/xstrtoimax, modules/xstrtoumax (Depends-on):
+       Add inttypes-incomplete.
+
        alignalloc, xalignalloc: new modules
        * lib/alignalloc.c, lib/alignalloc.h, lib/xalignalloc.c:
        * m4/alignalloc.m4, modules/alignalloc, modules/alignalloc-tests:
diff --git a/lib/xstrtoimax.c b/lib/xstrtoimax.c
index c7a8415b49..f01d2d746a 100644
--- a/lib/xstrtoimax.c
+++ b/lib/xstrtoimax.c
@@ -20,4 +20,5 @@
 #define __xstrtol xstrtoimax
 #define STRTOL_T_MINIMUM INTMAX_MIN
 #define STRTOL_T_MAXIMUM INTMAX_MAX
+#define XSTRTOL_INCLUDE_INTTYPES_H 1
 #include "xstrtol.c"
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index 3e2efb2a17..e0a692ff2c 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -40,6 +40,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#if XSTRTOL_INCLUDE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
 #include "assure.h"
 #include "intprops.h"
 
diff --git a/lib/xstrtoumax.c b/lib/xstrtoumax.c
index fa437b4ff7..8f4feb6044 100644
--- a/lib/xstrtoumax.c
+++ b/lib/xstrtoumax.c
@@ -20,4 +20,5 @@
 #define __xstrtol xstrtoumax
 #define STRTOL_T_MINIMUM 0
 #define STRTOL_T_MAXIMUM UINTMAX_MAX
+#define XSTRTOL_INCLUDE_INTTYPES_H 1
 #include "xstrtol.c"
diff --git a/modules/xstrtoimax b/modules/xstrtoimax
index 3ab6623027..42de8b00ab 100644
--- a/modules/xstrtoimax
+++ b/modules/xstrtoimax
@@ -6,6 +6,7 @@ lib/xstrtoimax.c
 
 Depends-on:
 xstrtol
+inttypes-incomplete
 strtoimax
 
 configure.ac:
diff --git a/modules/xstrtoumax b/modules/xstrtoumax
index 0d8ad36f64..a70dcd0d2f 100644
--- a/modules/xstrtoumax
+++ b/modules/xstrtoumax
@@ -6,6 +6,7 @@ lib/xstrtoumax.c
 
 Depends-on:
 xstrtol
+inttypes-incomplete
 strtoumax
 
 configure.ac:
-- 
2.32.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]