Subject: bug#21339: FYI: build: avoid -Wshift-negative-value warning

From: Jim Meyering <[email-masked]>
Date: Mon, 24 Aug 2015 09:44:43 -0700

FYI, I've just pushed this:
From 3e32a76f469635ccbbecd8f053e2b2053e2455c0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Mon, 24 Aug 2015 09:10:51 -0700
Subject: [PATCH] build: avoid -Wshift-negative-value warning

Configured with --enable-gcc-warnings, a gcc-6.x build would fail with this:

  gzip.c:118:32: error: left shift of negative value
   #define OFF_T_MIN (~ (off_t) 0 << (sizeof (off_t) * CHAR_BIT - 1))

* gzip.c [OFF_T_MAX]: Define in terms of TYPE_MAXIMUM, not OFF_T_MIN.
[OFF_T_MIN]: Remove now-unused definition.
Include "intprops.h" for definiton of TYPE_MAXIMUM.
* bootstrap.conf (gnulib_modules): Add intprops.
---
 bootstrap.conf | 1 +
 gzip.c         | 7 ++-----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index deb548f..1387106 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -39,6 +39,7 @@ gnu-web-doc-update
 gnumakefile
 gnupload
 ignore-value
+intprops
 largefile
 lib-ignore
 lstat
diff --git a/gzip.c b/gzip.c
index 8c40928..40fee35 100644
--- a/gzip.c
+++ b/gzip.c
@@ -65,6 +65,7 @@ static char const *const license_msg[] = {
 #include "closein.h"
 #include "tailor.h"
 #include "gzip.h"
+#include "intprops.h"
 #include "lzw.h"
 #include "revision.h"
 #include "timespec.h"
@@ -114,12 +115,8 @@ static char const *const license_msg[] = {
   off_t lseek (int fd, off_t offset, int whence);
 #endif

-#ifndef OFF_T_MIN
-#define OFF_T_MIN (~ (off_t) 0 << (sizeof (off_t) * CHAR_BIT - 1))
-#endif
-
 #ifndef OFF_T_MAX
-#define OFF_T_MAX (~ (off_t) 0 - OFF_T_MIN)
+# define OFF_T_MAX TYPE_MAXIMUM (off_t)
 #endif

 /* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is
-- 
2.3.7