[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33842: [PATCH] build: avoid build failure with --enable-gcc-warnings
From: |
Jim Meyering |
Subject: |
bug#33842: [PATCH] build: avoid build failure with --enable-gcc-warnings and latest gcc |
Date: |
Sat, 22 Dec 2018 23:07:13 -0800 |
FYI, I noticed a build failure and fixed it with the change below.
I've also pushed three more patches:
build: make the autoconf-2.63 requirement explicit
maint: update gnulib to latest; also update bootstrap and init.sh
maint: improve a comment
* gzip.c (do_list): There was a loop to compute the maximum width
of a decimal positive off_t value. Replace it with assignment to a
constant. Noticed because gcc 9.0.0 20181219 warned about its use
as a printf format-width value.
(OFF_T_MAX): Remove now-unused definition.
---
gzip.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/gzip.c b/gzip.c
index e6a7761..bef6bc6 100644
--- a/gzip.c
+++ b/gzip.c
@@ -115,10 +115,6 @@ static char const *const license_msg[] = {
off_t lseek (int fd, off_t offset, int whence);
#endif
-#ifndef OFF_T_MAX
-# define OFF_T_MAX TYPE_MAXIMUM (off_t)
-#endif
-
#ifndef HAVE_WORKING_O_NOFOLLOW
# define HAVE_WORKING_O_NOFOLLOW 0
#endif
@@ -1737,12 +1733,7 @@ local void do_list(ifd, method)
"lzh ", /* 3 */
"", "", "", "", /* 4 to 7 reserved */
"defla"}; /* 8 */
- int positive_off_t_width = 1;
- off_t o;
-
- for (o = OFF_T_MAX; 9 < o; o /= 10) {
- positive_off_t_width++;
- }
+ int positive_off_t_width = INT_BUFSIZE_BOUND (off_t) - 2;
if (first_time && method >= 0) {
first_time = 0;
- bug#33842: [PATCH] build: avoid build failure with --enable-gcc-warnings and latest gcc,
Jim Meyering <=