* [PATCH] system/vl: Use global &bdo_queue in configure_blockdev()
@ 2023-10-09 9:31 Philippe Mathieu-Daudé
2023-10-09 10:26 ` Markus Armbruster
0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-09 9:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Markus Armbruster, Paolo Bonzini, Philippe Mathieu-Daudé
Commit d11bf9bf0f ("vl: Factor configure_blockdev() out of main()")
passed &bdo_queue as argument, but this isn't really necessary since
there is only one call, so we still use the global variable.
Dropping the &bdo_queue argument allows to silence this global shadow
warning:
softmmu/vl.c:678:54: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
^
softmmu/vl.c:172:29: note: previous declaration is here
static BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
^
Remove a spurious empty line.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
softmmu/vl.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 98e071e63b..bc283b9fd4 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -674,8 +674,7 @@ static void default_drive(int enable, int snapshot, BlockInterfaceType type,
}
-static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
- MachineClass *machine_class, int snapshot)
+static void configure_blockdev(MachineClass *machine_class, int snapshot)
{
/*
* If the currently selected machine wishes to override the
@@ -688,10 +687,10 @@ static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
}
/* open the virtual block devices */
- while (!QSIMPLEQ_EMPTY(bdo_queue)) {
- BlockdevOptionsQueueEntry *bdo = QSIMPLEQ_FIRST(bdo_queue);
+ while (!QSIMPLEQ_EMPTY(&bdo_queue)) {
+ BlockdevOptionsQueueEntry *bdo = QSIMPLEQ_FIRST(&bdo_queue);
- QSIMPLEQ_REMOVE_HEAD(bdo_queue, entry);
+ QSIMPLEQ_REMOVE_HEAD(&bdo_queue, entry);
loc_push_restore(&bdo->loc);
qmp_blockdev_add(bdo->bdo, &error_fatal);
loc_pop(&bdo->loc);
@@ -712,7 +711,6 @@ static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
CDROM_OPTS);
default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
-
}
static QemuOptsList qemu_smp_opts = {
@@ -1961,7 +1959,7 @@ static void qemu_create_early_backends(void)
* Note: we need to create audio and block backends before
* setting machine properties, so they can be referred to.
*/
- configure_blockdev(&bdo_queue, machine_class, snapshot);
+ configure_blockdev(machine_class, snapshot);
audio_init_audiodevs();
}
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] system/vl: Use global &bdo_queue in configure_blockdev()
2023-10-09 9:31 [PATCH] system/vl: Use global &bdo_queue in configure_blockdev() Philippe Mathieu-Daudé
@ 2023-10-09 10:26 ` Markus Armbruster
2023-10-09 11:54 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2023-10-09 10:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Paolo Bonzini
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Commit d11bf9bf0f ("vl: Factor configure_blockdev() out of main()")
> passed &bdo_queue as argument, but this isn't really necessary since
> there is only one call, so we still use the global variable.
>
> Dropping the &bdo_queue argument allows to silence this global shadow
> warning:
>
> softmmu/vl.c:678:54: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
> static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
> ^
> softmmu/vl.c:172:29: note: previous declaration is here
> static BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
Not sure this is an improvement. Up to Paolo, I guess.
> Remove a spurious empty line.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] system/vl: Use global &bdo_queue in configure_blockdev()
2023-10-09 10:26 ` Markus Armbruster
@ 2023-10-09 11:54 ` Philippe Mathieu-Daudé
2023-10-09 12:41 ` Markus Armbruster
0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-09 11:54 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel, Paolo Bonzini
On 9/10/23 12:26, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>
>> Commit d11bf9bf0f ("vl: Factor configure_blockdev() out of main()")
>> passed &bdo_queue as argument, but this isn't really necessary since
>> there is only one call, so we still use the global variable.
>>
>> Dropping the &bdo_queue argument allows to silence this global shadow
>> warning:
>>
>> softmmu/vl.c:678:54: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>> static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
>> ^
>> softmmu/vl.c:172:29: note: previous declaration is here
>> static BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
>
> Not sure this is an improvement. Up to Paolo, I guess.
Any alternative suggestion? I'm looking at enabling -Wshadow with Clang
to avoid Clang users not getting the -Wshadow=local warnings until a
maintainer test their patches on CI.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] system/vl: Use global &bdo_queue in configure_blockdev()
2023-10-09 11:54 ` Philippe Mathieu-Daudé
@ 2023-10-09 12:41 ` Markus Armbruster
0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2023-10-09 12:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Paolo Bonzini
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> On 9/10/23 12:26, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>>
>>> Commit d11bf9bf0f ("vl: Factor configure_blockdev() out of main()")
>>> passed &bdo_queue as argument, but this isn't really necessary since
>>> there is only one call, so we still use the global variable.
>>>
>>> Dropping the &bdo_queue argument allows to silence this global shadow
>>> warning:
>>>
>>> softmmu/vl.c:678:54: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>>> static void configure_blockdev(BlockdevOptionsQueue *bdo_queue,
>>> ^
>>> softmmu/vl.c:172:29: note: previous declaration is here
>>> static BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
>> Not sure this is an improvement. Up to Paolo, I guess.
>
> Any alternative suggestion? I'm looking at enabling -Wshadow with Clang
> to avoid Clang users not getting the -Wshadow=local warnings until a
> maintainer test their patches on CI.
Rename to @bdos?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-09 12:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-09 9:31 [PATCH] system/vl: Use global &bdo_queue in configure_blockdev() Philippe Mathieu-Daudé
2023-10-09 10:26 ` Markus Armbruster
2023-10-09 11:54 ` Philippe Mathieu-Daudé
2023-10-09 12:41 ` Markus Armbruster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.