[PATCH] tests/qtest: Fix build error

Cédric Le Goater posted 1 patch 3 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260112123146.1010621-1-clg@redhat.com
Maintainers: Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
tests/qtest/libqtest.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] tests/qtest: Fix build error
Posted by Cédric Le Goater 3 weeks, 4 days ago
Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC))
detects an unused variable error:

  ../tests/qtest/libqtest.c: In function ‘qtest_qom_has_concrete_type’:
  ../tests/qtest/libqtest.c:1044:9: error: variable ‘idx’ set but not used [-Werror=unused-but-set-variable=]

Remove idx.

Cc: Fabiano Rosas <farosas@suse.de>
Cc: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 tests/qtest/libqtest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 622464e3656e2c0138c4cf1cbf98733f84dce876..61f05be5caeaff1c466395234078a37a5d1c4398 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1041,7 +1041,6 @@ static bool qtest_qom_has_concrete_type(const char *parent_typename,
     QObject *qobj;
     QString *qstr;
     QDict *devinfo;
-    int idx;
 
     if (!list) {
         QDict *resp;
@@ -1066,7 +1065,7 @@ static bool qtest_qom_has_concrete_type(const char *parent_typename,
         }
     }
 
-    for (p = qlist_first(list), idx = 0; p; p = qlist_next(p), idx++) {
+    for (p = qlist_first(list); p; p = qlist_next(p)) {
         devinfo = qobject_to(QDict, qlist_entry_obj(p));
         g_assert(devinfo);
 
-- 
2.52.0


Re: [PATCH] tests/qtest: Fix build error
Posted by Cédric Le Goater 3 weeks, 4 days ago
On 1/12/26 13:31, Cédric Le Goater wrote:
> Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC))
> detects an unused variable error:
> 
>    ../tests/qtest/libqtest.c: In function ‘qtest_qom_has_concrete_type’:
>    ../tests/qtest/libqtest.c:1044:9: error: variable ‘idx’ set but not used [-Werror=unused-but-set-variable=]
> 
> Remove idx.
> 
> Cc: Fabiano Rosas <farosas@suse.de>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
>   tests/qtest/libqtest.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index 622464e3656e2c0138c4cf1cbf98733f84dce876..61f05be5caeaff1c466395234078a37a5d1c4398 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -1041,7 +1041,6 @@ static bool qtest_qom_has_concrete_type(const char *parent_typename,
>       QObject *qobj;
>       QString *qstr;
>       QDict *devinfo;
> -    int idx;
>   
>       if (!list) {
>           QDict *resp;
> @@ -1066,7 +1065,7 @@ static bool qtest_qom_has_concrete_type(const char *parent_typename,
>           }
>       }
>   
> -    for (p = qlist_first(list), idx = 0; p; p = qlist_next(p), idx++) {
> +    for (p = qlist_first(list); p; p = qlist_next(p)) {
>           devinfo = qobject_to(QDict, qlist_entry_obj(p));
>           g_assert(devinfo);
>   

Applied to vfio-next.

Thanks,

C.


Re: [PATCH] tests/qtest: Fix build error
Posted by Philippe Mathieu-Daudé 3 weeks, 4 days ago
On 12/1/26 13:31, Cédric Le Goater wrote:
> Newer gcc compiler (version 16.0.0 20260103 (Red Hat 16.0.0-0) (GCC))
> detects an unused variable error:
> 
>    ../tests/qtest/libqtest.c: In function ‘qtest_qom_has_concrete_type’:
>    ../tests/qtest/libqtest.c:1044:9: error: variable ‘idx’ set but not used [-Werror=unused-but-set-variable=]
> 
> Remove idx.
> 
> Cc: Fabiano Rosas <farosas@suse.de>
> Cc: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
>   tests/qtest/libqtest.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>