* [PATCH v2] migration/ram: Fix compilation with -Wshadow=local
@ 2023-10-24 9:22 Thomas Huth
2023-10-24 10:32 ` Juan Quintela
2023-10-24 10:34 ` Markus Armbruster
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2023-10-24 9:22 UTC (permalink / raw)
To: qemu-devel, Juan Quintela, Peter Xu, Fabiano Rosas,
Markus Armbruster
Cc: Leonardo Bras
Rename the variable here to avoid that it shadows a variable from
the beginning of the function scope. With this change the code now
successfully compiles with -Wshadow=local.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
v2: Need the value for the qemu_file_set_error() line, too
migration/ram.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 92769902bb..212add4481 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3208,6 +3208,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
rs->last_stage = !migration_in_colo_state();
WITH_RCU_READ_LOCK_GUARD() {
+ int rdma_reg_ret;
+
if (!migration_in_postcopy()) {
migration_bitmap_sync_precopy(rs, true);
}
@@ -3238,9 +3240,9 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
ram_flush_compressed_data(rs);
- int ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
- if (ret < 0) {
- qemu_file_set_error(f, ret);
+ rdma_reg_ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
+ if (rdma_reg_ret < 0) {
+ qemu_file_set_error(f, rdma_reg_ret);
}
}
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] migration/ram: Fix compilation with -Wshadow=local
2023-10-24 9:22 [PATCH v2] migration/ram: Fix compilation with -Wshadow=local Thomas Huth
@ 2023-10-24 10:32 ` Juan Quintela
2023-10-24 10:57 ` Markus Armbruster
2023-10-24 10:34 ` Markus Armbruster
1 sibling, 1 reply; 4+ messages in thread
From: Juan Quintela @ 2023-10-24 10:32 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, Peter Xu, Fabiano Rosas, Markus Armbruster,
Leonardo Bras
Thomas Huth <thuth@redhat.com> wrote:
> Rename the variable here to avoid that it shadows a variable from
> the beginning of the function scope. With this change the code now
> successfully compiles with -Wshadow=local.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
queued.
> ---
> v2: Need the value for the qemu_file_set_error() line, too
I also hate qemu_file_set_error().
Direct translation of Spanish Saying:
Evil of many, consolation of fools
O:-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] migration/ram: Fix compilation with -Wshadow=local
2023-10-24 10:32 ` Juan Quintela
@ 2023-10-24 10:57 ` Markus Armbruster
0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2023-10-24 10:57 UTC (permalink / raw)
To: Juan Quintela
Cc: Thomas Huth, qemu-devel, Peter Xu, Fabiano Rosas, Leonardo Bras
Juan Quintela <quintela@redhat.com> writes:
> Thomas Huth <thuth@redhat.com> wrote:
>> Rename the variable here to avoid that it shadows a variable from
>> the beginning of the function scope. With this change the code now
>> successfully compiles with -Wshadow=local.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>
> Reviewed-by: Juan Quintela <quintela@redhat.com>
>
> queued.
I'm going to post a patch to enable -Wshadow=local, based on all the
outstanding shadow fixes, including this one. When I do the PR for the
enabling patch, I'll need to include any outstanding shadow fixes.
Should be fine no matter how it races with your PR.
>> ---
>> v2: Need the value for the qemu_file_set_error() line, too
>
> I also hate qemu_file_set_error().
>
> Direct translation of Spanish Saying:
>
> Evil of many, consolation of fools
>
> O:-)
Good one!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] migration/ram: Fix compilation with -Wshadow=local
2023-10-24 9:22 [PATCH v2] migration/ram: Fix compilation with -Wshadow=local Thomas Huth
2023-10-24 10:32 ` Juan Quintela
@ 2023-10-24 10:34 ` Markus Armbruster
1 sibling, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2023-10-24 10:34 UTC (permalink / raw)
To: Thomas Huth
Cc: qemu-devel, Juan Quintela, Peter Xu, Fabiano Rosas, Leonardo Bras
Thomas Huth <thuth@redhat.com> writes:
> Rename the variable here to avoid that it shadows a variable from
> the beginning of the function scope. With this change the code now
> successfully compiles with -Wshadow=local.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v2: Need the value for the qemu_file_set_error() line, too
>
> migration/ram.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 92769902bb..212add4481 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -3208,6 +3208,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
> rs->last_stage = !migration_in_colo_state();
>
> WITH_RCU_READ_LOCK_GUARD() {
> + int rdma_reg_ret;
> +
> if (!migration_in_postcopy()) {
> migration_bitmap_sync_precopy(rs, true);
> }
> @@ -3238,9 +3240,9 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
>
> ram_flush_compressed_data(rs);
>
> - int ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
> - if (ret < 0) {
> - qemu_file_set_error(f, ret);
> + rdma_reg_ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
> + if (rdma_reg_ret < 0) {
> + qemu_file_set_error(f, rdma_reg_ret);
> }
> }
Still ugly, but we want a minimally invasive fix now, and this is one.
Reviewed-by: Markus Armbruster <armbru@redhat.com>
and queued. Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-24 10:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24 9:22 [PATCH v2] migration/ram: Fix compilation with -Wshadow=local Thomas Huth
2023-10-24 10:32 ` Juan Quintela
2023-10-24 10:57 ` Markus Armbruster
2023-10-24 10:34 ` Markus Armbruster
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).