Subject: bug#33842: closed (Re: bug#33842: [PATCH] build: avoid build failure with --enable-gcc-warnings and latest gcc)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 23 Dec 2018 07:27:02 +0000

Your bug report

#33842: [PATCH] build: avoid build failure with --enable-gcc-warnings and latest gcc

which was filed against the gzip package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
33842: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33842
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#33842: [PATCH] build: avoid build failure with --enable-gcc-warnings and latest gcc
From: Jim Meyering <[email-masked]>
To: [email-masked]
Date: Sat, 22 Dec 2018 23:26:27 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Subject: [PATCH] build: avoid build failure with --enable-gcc-warnings and latest gcc
From: Jim Meyering <[email-masked]>
To: [email-masked]
Date: Sat, 22 Dec 2018 23:07:13 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

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;