From b937e0bd302d75722056eb1e815cba1f01b8c834 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 23 Jan 2022 21:07:39 -0800 Subject: [PATCH] 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. --- ChangeLog | 11 +++++++++++ lib/xstrtoimax.c | 1 + lib/xstrtol.c | 4 ++++ lib/xstrtoumax.c | 1 + modules/xstrtoimax | 1 + modules/xstrtoumax | 1 + 6 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0b85270dd0..c08b6fd43e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2022-01-23 Paul Eggert + + 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. + 2022-01-15 Bruno Haible log tests: Avoid test failure with nvc 22.1. diff --git a/lib/xstrtoimax.c b/lib/xstrtoimax.c index 786be8c210..469d669c36 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 5b8890edce..207f9339fe 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -40,6 +40,10 @@ #include #include +#if XSTRTOL_INCLUDE_INTTYPES_H +# include +#endif + #include "assure.h" #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) diff --git a/lib/xstrtoumax.c b/lib/xstrtoumax.c index 1f4f04c324..88beca1086 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.39.5