bug-gnulib
[Top][All Lists]
Advanced

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

pipe-filter-gi, pipe-filter-ii tests: Fix some gcc -Wshadow warnings


From: Bruno Haible
Subject: pipe-filter-gi, pipe-filter-ii tests: Fix some gcc -Wshadow warnings
Date: Mon, 04 Sep 2023 17:26:45 +0200

These two gcc warnings:

test-pipe-filter-gi1.c:88:17: warning: declaration of 'argv' shadows a 
parameter [-Wshadow=local]
test-pipe-filter-ii1.c:110:17: warning: declaration of 'argv' shadows a 
parameter [-Wshadow=local]

can be fixed in a way that does not decrease maintainability:


2023-09-04  Bruno Haible  <bruno@clisp.org>

        pipe-filter-gi, pipe-filter-ii tests: Fix some gcc -Wshadow warnings.
        * tests/test-pipe-filter-gi1.c (main): Rename local variable 'argv' to
        'tr_argv'.
        * tests/test-pipe-filter-ii1.c (main): Likewise.

diff --git a/tests/test-pipe-filter-gi1.c b/tests/test-pipe-filter-gi1.c
index 05bcc08ae9..6e70de5597 100644
--- a/tests/test-pipe-filter-gi1.c
+++ b/tests/test-pipe-filter-gi1.c
@@ -85,7 +85,7 @@ main (int argc, char *argv[])
 
   /* Convert it to uppercase, line by line.  */
   {
-    const char *argv[4];
+    const char *tr_argv[4];
     struct locals l;
     struct pipe_filter_gi *f;
     int result;
@@ -93,12 +93,12 @@ main (int argc, char *argv[])
     l.input = input;
     l.nread = 0;
 
-    argv[0] = tr_program;
-    argv[1] = "abcdefghijklmnopqrstuvwxyz";
-    argv[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-    argv[3] = NULL;
+    tr_argv[0] = tr_program;
+    tr_argv[1] = "abcdefghijklmnopqrstuvwxyz";
+    tr_argv[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+    tr_argv[3] = NULL;
 
-    f = pipe_filter_gi_create ("tr", tr_program, argv, false, true,
+    f = pipe_filter_gi_create ("tr", tr_program, tr_argv, false, true,
                                prepare_read, done_read, &l);
     ASSERT (f != NULL);
     result = pipe_filter_gi_write (f, input, input_size);
diff --git a/tests/test-pipe-filter-ii1.c b/tests/test-pipe-filter-ii1.c
index 89c4014969..03d49b7dcf 100644
--- a/tests/test-pipe-filter-ii1.c
+++ b/tests/test-pipe-filter-ii1.c
@@ -107,7 +107,7 @@ main (int argc, char *argv[])
 
   /* Convert it to uppercase, line by line.  */
   {
-    const char *argv[4];
+    const char *tr_argv[4];
     struct locals l;
     int result;
 
@@ -116,12 +116,12 @@ main (int argc, char *argv[])
     l.nwritten = 0;
     l.nread = 0;
 
-    argv[0] = tr_program;
-    argv[1] = "abcdefghijklmnopqrstuvwxyz";
-    argv[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-    argv[3] = NULL;
+    tr_argv[0] = tr_program;
+    tr_argv[1] = "abcdefghijklmnopqrstuvwxyz";
+    tr_argv[2] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+    tr_argv[3] = NULL;
 
-    result = pipe_filter_ii_execute ("tr", tr_program, argv, false, true,
+    result = pipe_filter_ii_execute ("tr", tr_program, tr_argv, false, true,
                                      prepare_write, done_write,
                                      prepare_read, done_read,
                                      &l);






reply via email to

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