bug-gzip
[Top][All Lists]
Advanced

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

several small patches


From: Jim Meyering
Subject: several small patches
Date: Wed, 30 Dec 2009 17:32:51 +0100

I'm going to push the following shortly:

    build: update gnulib submodule to latest
    build: avoid warning about ignored chown/fchown return value
    build: avoid warning about possibly-no-return functions
    build: quiet warnings from util.c
    build: with --enable-gcc-warnings, use -Werror
    build: add a syntax-check
    maint: remove lots of obsolete #if...HAVE_* checks
    build: update gnulib submodule to latest


>From 6d0c62882285fd49af329bdfb594ea3fc851e912 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 11 Dec 2009 21:45:26 +0100
Subject: [PATCH 1/8] build: update gnulib submodule to latest

---
 gnulib |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gnulib b/gnulib
index 481f709..a3255b1 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 481f709ceba803288289da8e11a52d309d0fc9a1
+Subproject commit a3255b1b9848874572e0df9d0609e263da50de4b
--
1.6.6.325.g6f5f


>From cd27a0fd2b28f5f2a43c46f9d638c94a23b8c27e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 17 Dec 2009 16:48:59 +0100
Subject: [PATCH 2/8] build: avoid warning about ignored chown/fchown return 
value

* bootstrap.conf (gnulib_modules): Add ignore-value.
* gzip.c: Include "ignore-value.h".
(copy_stat): Explicitly ignore chown and fchown failure
---
 bootstrap.conf |    1 +
 gzip.c         |    6 ++++--
 lib/.gitignore |    1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index f0afe13..ce9a9f7 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -38,6 +38,7 @@ gnu-make
 gnu-web-doc-update
 gnumakefile
 gnupload
+ignore-value
 lstat
 maintainer-makefile
 malloc
diff --git a/gzip.c b/gzip.c
index 07bebc3..cdaaab3 100644
--- a/gzip.c
+++ b/gzip.c
@@ -69,6 +69,7 @@ static char const *const license_msg[] = {

 #include "fcntl-safer.h"
 #include "getopt.h"
+#include "ignore-value.h"
 #include "stat-time.h"

                /* configuration */
@@ -1677,10 +1678,11 @@ local void copy_stat(ifstat)
 #endif

 #ifndef NO_CHOWN
+    /* Copy ownership */
 # if HAVE_FCHOWN
-    fchown (ofd, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
+    ignore_value (fchown (ofd, ifstat->st_uid, ifstat->st_gid));
 # elif HAVE_CHOWN
-    chown(ofname, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
+    ignore_value (chown (ofname, ifstat->st_uid, ifstat->st_gid));
 # endif
 #endif

diff --git a/lib/.gitignore b/lib/.gitignore
index e7eba30..7b4f467 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -82,6 +82,7 @@ gettext.h
 gettime.c
 gettimeofday.c
 gnulib.mk
+ignore-value.h
 intprops.h
 isnan.c
 isnand-nolibm.h
--
1.6.6.325.g6f5f


>From 7292f474c44fb5f14a4475ca0a87e2ea566afbaf Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 17 Dec 2009 16:51:29 +0100
Subject: [PATCH 3/8] build: avoid warning about possibly-no-return functions

* gzip.h (read_error, write_error): Mark these functions as "no-return".
---
 gzip.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gzip.h b/gzip.h
index 1ab89e6..7addad9 100644
--- a/gzip.h
+++ b/gzip.h
@@ -333,8 +333,8 @@ extern char *add_envopt   OF((int *argcp, char ***argvp, 
char const *env));
 extern void gzip_error    OF((char const *m)) ATTRIBUTE_NORETURN;
 extern void xalloc_die    OF((void)) ATTRIBUTE_NORETURN;
 extern void warning       OF((char const *m));
-extern void read_error    OF((void));
-extern void write_error   OF((void));
+extern void read_error    OF((void)) ATTRIBUTE_NORETURN;
+extern void write_error   OF((void)) ATTRIBUTE_NORETURN;
 extern void display_ratio OF((off_t num, off_t den, FILE *file));
 extern void fprint_off    OF((FILE *, off_t, int));

--
1.6.6.325.g6f5f


>From 5115038ff447583f1a500292835ae56a0e5373a2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 20 Dec 2009 17:40:15 +0100
Subject: [PATCH 4/8] build: quiet warnings from util.c

* configure.ac (warnings): Add -Wno-overflow and -Wno-type-limits.
---
 configure.ac |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6442ab6..7c9cda3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,6 +102,8 @@ if test "$gl_gcc_warnings" = yes; then
   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
+  gl_WARN_ADD([-Wno-overflow])         # util.c
+  gl_WARN_ADD([-Wno-type-limits])      # util.c

   # In spite of excluding -Wlogical-op above, it is enabled, as of
   # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
--
1.6.6.325.g6f5f


>From bfe0afa24f141d2d4d4ded688b0d954601224228 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 17 Dec 2009 16:59:59 +0100
Subject: [PATCH 5/8] build: with --enable-gcc-warnings, use -Werror

* Makefile.am (AM_CFLAGS): Enable $(WERROR_CFLAGS).
* lib/Makefile.am (AM_CFLAGS): Enable both $(WARN_CFLAGS) and
$(WERROR_CFLAGS).
---
 Makefile.am     |    2 +-
 lib/Makefile.am |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index cfde8e0..406e344 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
 SUBDIRS = lib doc
 ACLOCAL_AMFLAGS = -I m4
 AM_CPPFLAGS = -I$(top_srcdir)/lib
-AM_CFLAGS = $(WARN_CFLAGS) # $(WERROR_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

 man_MANS = gunzip.1 gzexe.1 gzip.1 \
   zcat.1 zcmp.1 zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 22e4c80..f149ac6 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,6 +21,7 @@ include gnulib.mk

 libgzip_a_LIBADD += $(LIBOBJS)
 libgzip_a_DEPENDENCIES += $(LIBOBJS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)

 match.$(OBJEXT): match.c
        cp $(srcdir)/match.c _match.S
--
1.6.6.325.g6f5f


>From 6c2b17cc1985c9b7174bf35d1280cd69ecfaa86f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 20 Dec 2009 17:41:12 +0100
Subject: [PATCH 6/8] build: add a syntax-check

* cfg.mk (sc_prohibit_obsolete_HAVE_HEADER_H): New rule.
---
 cfg.mk |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index d6197e8..ce02851 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -41,3 +41,10 @@ bootstrap-tools = autoconf,automake,gnulib
 export VERBOSE = yes

 old_NEWS_hash = 22b19691660f1870cec5f64b2c0e4641
+
+sc_obs_header_regex = \
+  \<(STDC_HEADERS|HAVE_(LIMITS|STRING|UNISTD|STDLIB)_H)\>
+sc_prohibit_obsolete_HAVE_HEADER_H:
+       @re='^[  ]*#[    ]*(el)?if.*$(sc_obs_header_regex)' \
+       msg='remove the above obsolete #if...HAVE_HEADER_H test(s)' \
+         $(_prohibit_regexp)
--
1.6.6.325.g6f5f


>From 15f44b83812b739c5f17d36f0680550824e0b6c4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 20 Dec 2009 19:41:39 +0100
Subject: [PATCH 7/8] maint: remove lots of obsolete #if...HAVE_* checks

Remove many always-true cpp tests like #ifdef HAVE_UNISTD_H,
 #ifdef HAVE_FCNTL_H and #ifdef SSIZE_MAX.
* gzip.c: As above.
* gzip.h: Likewise.
* inflate.c: Likewise.
* tailor.h: Likewise.
* unlzw.c: Likewise.
* util.c: Likewise.
* zip.c: Likewise.
---
 gzip.c    |   22 +++------------
 gzip.h    |   16 +----------
 inflate.c |    4 +--
 tailor.h  |    5 ---
 unlzw.c   |    8 +----
 util.c    |   85 ++++++------------------------------------------------------
 zip.c     |    8 +----
 7 files changed, 21 insertions(+), 127 deletions(-)

diff --git a/gzip.c b/gzip.c
index cdaaab3..4ecfdaf 100644
--- a/gzip.c
+++ b/gzip.c
@@ -74,23 +74,11 @@ static char const *const license_msg[] = {

                /* configuration */

-#ifdef HAVE_FCNTL_H
-#  include <fcntl.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
-#  include <limits.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-
-#if defined STDC_HEADERS || defined HAVE_STDLIB_H
-#  include <stdlib.h>
-#else
-   extern int errno;
-#endif
+#include <fcntl.h>
+#include <limits.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>

 #ifndef NO_DIR
 # define NO_DIR 0
diff --git a/gzip.h b/gzip.h
index 7addad9..92b4087 100644
--- a/gzip.h
+++ b/gzip.h
@@ -47,20 +47,8 @@
 #include <stdio.h>
 #include <sys/types.h> /* for off_t */
 #include <time.h>
-#if defined HAVE_STRING_H || defined STDC_HEADERS
-#  include <string.h>
-#  if !defined STDC_HEADERS && defined HAVE_MEMORY_H && !defined __GNUC__
-#    include <memory.h>
-#  endif
-#  define memzero(s, n)     memset ((voidp)(s), 0, (n))
-#else
-#  include <strings.h>
-#  define strchr            index
-#  define strrchr           rindex
-#  define memcpy(d, s, n)   bcopy((s), (d), (n))
-#  define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
-#  define memzero(s, n)     bzero((s), (n))
-#endif
+#include <string.h>
+#define memzero(s, n) memset ((voidp)(s), 0, (n))

 #ifndef RETSIGTYPE
 #  define RETSIGTYPE void
diff --git a/inflate.c b/inflate.c
index b72c187..8167f20 100644
--- a/inflate.c
+++ b/inflate.c
@@ -117,9 +117,7 @@
 #include <config.h>
 #include "tailor.h"

-#if defined STDC_HEADERS || defined HAVE_STDLIB_H
-#  include <stdlib.h>
-#endif
+#include <stdlib.h>

 #include "gzip.h"
 #define slide window
diff --git a/tailor.h b/tailor.h
index 3cb16ee..cd3be11 100644
--- a/tailor.h
+++ b/tailor.h
@@ -200,11 +200,6 @@
 #endif

 #if defined(ATARI) || defined(atarist)
-#  ifndef STDC_HEADERS
-#    define STDC_HEADERS
-#    define HAVE_UNISTD_H
-#    define HAVE_DIRENT_H
-#  endif
 #  define ASMV
 #  define OS_CODE  0x05
 #  ifdef TOSFS
diff --git a/unlzw.c b/unlzw.c
index 5cf95b5..fb9ff76 100644
--- a/unlzw.c
+++ b/unlzw.c
@@ -10,12 +10,8 @@
 #include <config.h>
 #include "tailor.h"

-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#  include <fcntl.h>
-#endif
+#include <unistd.h>
+#include <fcntl.h>

 #include "gzip.h"
 #include "lzw.h"
diff --git a/util.c b/util.c
index d0d7774..83ddac2 100644
--- a/util.c
+++ b/util.c
@@ -24,21 +24,11 @@

 #include "tailor.h"

-#ifdef HAVE_LIMITS_H
-#  include <limits.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#  include <fcntl.h>
-#endif
-
-#if defined STDC_HEADERS || defined HAVE_STDLIB_H
-#  include <stdlib.h>
-#else
-   extern int errno;
-#endif
+#include <limits.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <errno.h>

 #include "gzip.h"
 #include "crypt.h"
@@ -146,10 +136,8 @@ read_buffer (fd, buf, cnt)
      voidp buf;
      unsigned int cnt;
 {
-#ifdef SSIZE_MAX
-  if (SSIZE_MAX < cnt)
-    cnt = SSIZE_MAX;
-#endif
+  if (INT_MAX < cnt)
+    cnt = INT_MAX;
   return read (fd, buf, cnt);
 }

@@ -160,10 +148,8 @@ write_buffer (fd, buf, cnt)
      voidp buf;
      unsigned int cnt;
 {
-#ifdef SSIZE_MAX
-  if (SSIZE_MAX < cnt)
-    cnt = SSIZE_MAX;
-#endif
+  if (INT_MAX < cnt)
+    cnt = INT_MAX;
   return write (fd, buf, cnt);
 }

@@ -297,59 +283,6 @@ void make_simple_name(name)
     } while (p != name);
 }

-
-#if !defined HAVE_STRING_H && !defined STDC_HEADERS
-
-/* Provide missing strspn and strcspn functions. */
-
-#  ifndef __STDC__
-#    define const
-#  endif
-
-int strspn  OF((const char *s, const char *accept));
-int strcspn OF((const char *s, const char *reject));
-
-/* ========================================================================
- * Return the length of the maximum initial segment
- * of s which contains only characters in accept.
- */
-int strspn(s, accept)
-    const char *s;
-    const char *accept;
-{
-    register const char *p;
-    register const char *a;
-    register int count = 0;
-
-    for (p = s; *p != '\0'; ++p) {
-       for (a = accept; *a != '\0'; ++a) {
-           if (*p == *a) break;
-       }
-       if (*a == '\0') return count;
-       ++count;
-    }
-    return count;
-}
-
-/* ========================================================================
- * Return the length of the maximum inital segment of s
- * which contains no characters from reject.
- */
-int strcspn(s, reject)
-    const char *s;
-    const char *reject;
-{
-    register int count = 0;
-
-    while (*s != '\0') {
-       if (strchr(reject, *s++) != NULL) return count;
-       ++count;
-    }
-    return count;
-}
-
-#endif
-
 /* ========================================================================
  * Add an environment variable (if any) before argv, and update argc.
  * Return the expanded environment variable to be freed later, or NULL
diff --git a/zip.c b/zip.c
index 9dd167b..c0d96ae 100644
--- a/zip.c
+++ b/zip.c
@@ -24,12 +24,8 @@
 #include "gzip.h"
 #include "crypt.h"

-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#  include <fcntl.h>
-#endif
+#include <unistd.h>
+#include <fcntl.h>

 local ulg crc;       /* crc on uncompressed file data */
 off_t header_bytes;   /* number of bytes in gzip header */
--
1.6.6.325.g6f5f


>From ace532fa2cc5327db94afd07572509808c213d54 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 30 Dec 2009 17:12:08 +0100
Subject: [PATCH 8/8] build: update gnulib submodule to latest

---
 gnulib         |    2 +-
 lib/.gitignore |    1 +
 m4/.gitignore  |    2 ++
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gnulib b/gnulib
index a3255b1..0e3e69f 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit a3255b1b9848874572e0df9d0609e263da50de4b
+Subproject commit 0e3e69f9f9b31a7d8516bb9699471db6a43bd3c8
diff --git a/lib/.gitignore b/lib/.gitignore
index 7b4f467..461e93b 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -45,6 +45,7 @@ fchownat.c
 fclose.c
 fcntl--.h
 fcntl-safer.h
+fcntl.c
 fcntl.h
 fcntl.in.h
 fcntl_.h
diff --git a/m4/.gitignore b/m4/.gitignore
index 701b2ad..5ef04eb 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -26,7 +26,9 @@ exponentl.m4
 extensions.m4
 fchdir.m4
 fclose.m4
+fcntl-o.m4
 fcntl-safer.m4
+fcntl.m4
 fcntl_h.m4
 fdopendir.m4
 fflush.m4
--
1.6.6.325.g6f5f




reply via email to

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