]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ptx: avoid new warning/error from upcoming gcc-7.x
authorJim Meyering <meyering@fb.com>
Mon, 29 Aug 2016 05:53:50 +0000 (22:53 -0700)
committerJim Meyering <meyering@fb.com>
Mon, 29 Aug 2016 15:37:08 +0000 (08:37 -0700)
* src/ptx.c (fix_output_parameters): Switch to an unsigned type that
matches the OCCURS.file_index type. This avoids the following error
from gcc-7.0.0 20160829 (experimental):
  src/ptx.c:1220:14: error: assuming signed overflow does not occur \
    when simplifying conditional to constant [-Werror=strict-overflow]
          if (file_index > 0)

src/ptx.c

index d19c66e402c0b35b050046d26b69bcc07cfc670c..1f0e9c921a799a9dfa5480ad0371bed0fa0c469f 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -1200,7 +1200,7 @@ print_field (BLOCK field)
 static void
 fix_output_parameters (void)
 {
-  int file_index;              /* index in text input file arrays */
+  size_t file_index;           /* index in text input file arrays */
   int line_ordinal;            /* line ordinal value for reference */
   char ordinal_string[12];     /* edited line ordinal for reference */
   int reference_width;         /* width for the whole reference */