* [PATCH] tests/qtest/m48t59-test: Silence compiler warning with -Wshadow
@ 2023-09-22 16:37 Thomas Huth
2023-09-22 17:44 ` Daniel P. Berrangé
2023-09-22 18:13 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2023-09-22 16:37 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Laurent Vivier, Markus Armbruster,
Philippe Mathieu-Daudé
When compiling this file with -Wshadow=local , we get:
../tests/qtest/m48t59-test.c: In function ‘bcd_check_time’:
../tests/qtest/m48t59-test.c:195:17: warning: declaration of ‘s’
shadows a previous local [-Wshadow=local]
195 | long t, s;
| ^
../tests/qtest/m48t59-test.c:158:17: note: shadowed declaration is here
158 | QTestState *s = m48t59_qtest_start();
| ^
Rename the QTestState variable to "qts" which is the common
naming for such a variable in other tests.
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/m48t59-test.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/qtest/m48t59-test.c b/tests/qtest/m48t59-test.c
index 843d2ced8e..9487faff1a 100644
--- a/tests/qtest/m48t59-test.c
+++ b/tests/qtest/m48t59-test.c
@@ -155,7 +155,7 @@ static void bcd_check_time(void)
struct tm *datep;
time_t ts;
const int wiggle = 2;
- QTestState *s = m48t59_qtest_start();
+ QTestState *qts = m48t59_qtest_start();
/*
* This check assumes a few things. First, we cannot guarantee that we get
@@ -173,10 +173,10 @@ static void bcd_check_time(void)
ts = time(NULL);
gmtime_r(&ts, &start);
- cmos_get_date_time(s, &date[0]);
- cmos_get_date_time(s, &date[1]);
- cmos_get_date_time(s, &date[2]);
- cmos_get_date_time(s, &date[3]);
+ cmos_get_date_time(qts, &date[0]);
+ cmos_get_date_time(qts, &date[1]);
+ cmos_get_date_time(qts, &date[2]);
+ cmos_get_date_time(qts, &date[3]);
ts = time(NULL);
gmtime_r(&ts, &end);
@@ -207,7 +207,7 @@ static void bcd_check_time(void)
g_assert_cmpint(ABS(t - s), <=, wiggle);
}
- qtest_quit(s);
+ qtest_quit(qts);
}
/* success if no crash or abort */
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tests/qtest/m48t59-test: Silence compiler warning with -Wshadow
2023-09-22 16:37 [PATCH] tests/qtest/m48t59-test: Silence compiler warning with -Wshadow Thomas Huth
@ 2023-09-22 17:44 ` Daniel P. Berrangé
2023-09-22 18:13 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2023-09-22 17:44 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, Paolo Bonzini, Laurent Vivier, Markus Armbruster,
Philippe Mathieu-Daudé
On Fri, Sep 22, 2023 at 06:37:42PM +0200, Thomas Huth wrote:
> When compiling this file with -Wshadow=local , we get:
>
> ../tests/qtest/m48t59-test.c: In function ‘bcd_check_time’:
> ../tests/qtest/m48t59-test.c:195:17: warning: declaration of ‘s’
> shadows a previous local [-Wshadow=local]
> 195 | long t, s;
> | ^
> ../tests/qtest/m48t59-test.c:158:17: note: shadowed declaration is here
> 158 | QTestState *s = m48t59_qtest_start();
> | ^
>
> Rename the QTestState variable to "qts" which is the common
> naming for such a variable in other tests.
>
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/qtest/m48t59-test.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tests/qtest/m48t59-test: Silence compiler warning with -Wshadow
2023-09-22 16:37 [PATCH] tests/qtest/m48t59-test: Silence compiler warning with -Wshadow Thomas Huth
2023-09-22 17:44 ` Daniel P. Berrangé
@ 2023-09-22 18:13 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-22 18:13 UTC (permalink / raw)
To: Thomas Huth, qemu-devel; +Cc: Paolo Bonzini, Laurent Vivier, Markus Armbruster
On 22/9/23 18:37, Thomas Huth wrote:
> When compiling this file with -Wshadow=local , we get:
>
> ../tests/qtest/m48t59-test.c: In function ‘bcd_check_time’:
> ../tests/qtest/m48t59-test.c:195:17: warning: declaration of ‘s’
> shadows a previous local [-Wshadow=local]
> 195 | long t, s;
> | ^
> ../tests/qtest/m48t59-test.c:158:17: note: shadowed declaration is here
> 158 | QTestState *s = m48t59_qtest_start();
> | ^
>
> Rename the QTestState variable to "qts" which is the common
> naming for such a variable in other tests.
>
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/qtest/m48t59-test.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-22 18:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22 16:37 [PATCH] tests/qtest/m48t59-test: Silence compiler warning with -Wshadow Thomas Huth
2023-09-22 17:44 ` Daniel P. Berrangé
2023-09-22 18:13 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).