]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid warning on older GCC compilers
authorPádraig Brady <P@draigBrady.com>
Sun, 4 Aug 2024 10:45:34 +0000 (11:45 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 4 Aug 2024 11:14:25 +0000 (12:14 +0100)
* src/shuf.c: Avoid -Werror=maybe-uninitialized on GCC 10.2.1 at least.
This issue does seem to be addressed on GCC 12.

src/shuf.c

index 3bc8b3ced2651e3537e513b3c17ae7bacbd1b111..63c26f31eee17f2602e8edada5783ceffc14e19b 100644 (file)
@@ -509,7 +509,10 @@ main (int argc, char **argv)
       line = operand;
     }
   else if (input_range)
-    line = nullptr;
+    {
+      IF_LINT (n_lines = hi_input - lo_input + 1); /* Avoid GCC 10 warning.  */
+      line = nullptr;
+    }
   else
     {
       /* If an input file is specified, re-open it as stdin.  */