]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid uniq.c warning from bleeding-edge gcc's -Wstrict-overflow
authorJim Meyering <meyering@fb.com>
Thu, 15 Oct 2015 16:09:18 +0000 (09:09 -0700)
committerJim Meyering <meyering@fb.com>
Fri, 16 Oct 2015 15:02:51 +0000 (08:02 -0700)
* src/uniq.c (main): Make the type of "nfiles" unsigned,
to avoid a brand new warning from a gcc I built from today's
sources (gcc version 6.0.0 20151015 (experimental) (GCC)):
src/uniq.c:523:14: error: assuming signed overflow does not occur \
  when simplifying conditional to constant [-Werror=strict-overflow]
           if (nfiles == 2)
              ^

src/uniq.c

index 8dfb7ea9722ea958b972b508d6033d9f2a8ed5ce..7b77dd3b02407f47de9e0825b1be192adf4fe5a0 100644 (file)
@@ -483,7 +483,7 @@ main (int argc, char **argv)
   int optc = 0;
   bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
   enum Skip_field_option_type skip_field_option_type = SFO_NONE;
-  int nfiles = 0;
+  unsigned int nfiles = 0;
   char const *file[2];
   char delimiter = '\n';       /* change with --zero-terminated, -z */
   bool output_option_used = false;   /* if true, one of -u/-d/-D/-c was used */