On 09/10/2023 12.02, Philippe Mathieu-Daudé wrote:
Rename the argument to avoid:

   tests/unit/test-aio-multithread.c:226:37: error: declaration shadows a 
variable in the global scope [-Werror,-Wshadow]
   static void test_multi_co_mutex(int threads, int seconds)
                                       ^
   tests/unit/test-aio-multithread.c:401:34: error: declaration shadows a 
variable in the global scope [-Werror,-Wshadow]
   static void test_multi_mutex(int threads, int seconds)
                                    ^
   tests/unit/test-aio-multithread.c:24:18: note: previous declaration is here
   static IOThread *threads[NUM_CONTEXTS];
                    ^

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  tests/unit/test-aio-multithread.c | 16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/unit/test-aio-multithread.c 
b/tests/unit/test-aio-multithread.c
index 08d4570ccb..d587f20667 100644
--- a/tests/unit/test-aio-multithread.c
+++ b/tests/unit/test-aio-multithread.c
@@ -223,7 +223,7 @@ static void coroutine_fn test_multi_co_mutex_entry(void 
*opaque)
      qatomic_dec(&running);
  }
-static void test_multi_co_mutex(int threads, int seconds)
+static void test_multi_co_mutex(unsigned ctx_num, int seconds)

Why did you change the type of the variable? ... you should at least mention this in the commit description.

  {
      int i;
@@ -233,9 +233,9 @@ static void test_multi_co_mutex(int threads, int seconds)
      now_stopping = false;
create_aio_contexts();
-    assert(threads <= NUM_CONTEXTS);
-    running = threads;
-    for (i = 0; i < threads; i++) {
+    assert(ctx_num <= NUM_CONTEXTS);
+    running = ctx_num;
+    for (i = 0; i < ctx_num; i++) {
          Coroutine *co1 = qemu_coroutine_create(test_multi_co_mutex_entry, 
NULL);
          aio_co_schedule(ctx[i], co1);
      }
@@ -398,7 +398,7 @@ static void test_multi_mutex_entry(void *opaque)
      qatomic_dec(&running);
  }
-static void test_multi_mutex(int threads, int seconds)
+static void test_multi_mutex(unsigned ctx_num, int seconds)

dito.

 Thomas

  {
      int i;
@@ -408,9 +408,9 @@ static void test_multi_mutex(int threads, int seconds)
      now_stopping = false;
create_aio_contexts();
-    assert(threads <= NUM_CONTEXTS);
-    running = threads;
-    for (i = 0; i < threads; i++) {
+    assert(ctx_num <= NUM_CONTEXTS);
+    running = ctx_num;
+    for (i = 0; i < ctx_num; i++) {
          Coroutine *co1 = qemu_coroutine_create(test_multi_mutex_entry, NULL);
          aio_co_schedule(ctx[i], co1);
      }


Reply via email to