]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: avoid a signed overflow warning in ptx
authorPádraig Brady <P@draigBrady.com>
Sat, 16 Dec 2017 21:07:43 +0000 (13:07 -0800)
committerPádraig Brady <P@draigBrady.com>
Sat, 16 Dec 2017 21:08:43 +0000 (13:08 -0800)
* src/ptx.c (fix_output_parameters): GCC 6.3.1 with
./configure --enable-single-binary would give:
  error: assuming signed overflow does not occur
  when simplifying conditional to constant [-Werror=strict-overflow]
    if (file_index > 0)
So change the type of file_index to signed (size_t).

src/ptx.c

index 58e6c57c8a8c916ba199853231569fe0cc5cf583..02bf8ebb04b1e1e1252d78edb80a74376f293f87 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -1194,7 +1194,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 */
   intmax_t line_ordinal;       /* line ordinal value for reference */
   ptrdiff_t reference_width;   /* width for the whole reference */
   int character;               /* character ordinal */