[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/32] softmmu/vl: Clean up global variable shadowing
|
From: |
Markus Armbruster |
|
Subject: |
[PULL 23/32] softmmu/vl: Clean up global variable shadowing |
|
Date: |
Fri, 6 Oct 2023 13:36:48 +0200 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Fix:
softmmu/vl.c:1069:44: error: declaration shadows a variable in the global
scope [-Werror,-Wshadow]
static void parse_display_qapi(const char *optarg)
^
softmmu/vl.c:1224:39: error: declaration shadows a variable in the global
scope [-Werror,-Wshadow]
static void monitor_parse(const char *optarg, const char *mode, bool pretty)
^
softmmu/vl.c:1634:17: error: declaration shadows a variable in the global
scope [-Werror,-Wshadow]
const char *optarg = qdict_get_try_str(qdict, "type");
^
softmmu/vl.c:1784:45: error: declaration shadows a variable in the global
scope [-Werror,-Wshadow]
static void object_option_parse(const char *optarg)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/getopt.h:77:14:
note: previous declaration is here
extern char *optarg; /* getopt(3) external variables */
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231004120019.93101-15-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Tweak two parameter names]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
softmmu/vl.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 98e071e63b..13c1b24706 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1066,12 +1066,12 @@ static void select_vgahw(const MachineClass
*machine_class, const char *p)
}
}
-static void parse_display_qapi(const char *optarg)
+static void parse_display_qapi(const char *str)
{
DisplayOptions *opts;
Visitor *v;
- v = qobject_input_visitor_new_str(optarg, "type", &error_fatal);
+ v = qobject_input_visitor_new_str(str, "type", &error_fatal);
visit_type_DisplayOptions(v, NULL, &opts, &error_fatal);
QAPI_CLONE_MEMBERS(DisplayOptions, &dpy, opts);
@@ -1221,21 +1221,21 @@ static int mon_init_func(void *opaque, QemuOpts *opts,
Error **errp)
return monitor_init_opts(opts, errp);
}
-static void monitor_parse(const char *optarg, const char *mode, bool pretty)
+static void monitor_parse(const char *str, const char *mode, bool pretty)
{
static int monitor_device_index = 0;
QemuOpts *opts;
const char *p;
char label[32];
- if (strstart(optarg, "chardev:", &p)) {
+ if (strstart(str, "chardev:", &p)) {
snprintf(label, sizeof(label), "%s", p);
} else {
snprintf(label, sizeof(label), "compat_monitor%d",
monitor_device_index);
- opts = qemu_chr_parse_compat(label, optarg, true);
+ opts = qemu_chr_parse_compat(label, str, true);
if (!opts) {
- error_report("parse error: %s", optarg);
+ error_report("parse error: %s", str);
exit(1);
}
}
@@ -1631,13 +1631,13 @@ static const QEMUOption *lookup_opt(int argc, char
**argv,
static MachineClass *select_machine(QDict *qdict, Error **errp)
{
- const char *optarg = qdict_get_try_str(qdict, "type");
+ const char *machine_type = qdict_get_try_str(qdict, "type");
GSList *machines = object_class_get_list(TYPE_MACHINE, false);
MachineClass *machine_class;
Error *local_err = NULL;
- if (optarg) {
- machine_class = find_machine(optarg, machines);
+ if (machine_type) {
+ machine_class = find_machine(machine_type, machines);
qdict_del(qdict, "type");
if (!machine_class) {
error_setg(&local_err, "unsupported machine type");
@@ -1781,20 +1781,20 @@ static void object_option_add_visitor(Visitor *v)
QTAILQ_INSERT_TAIL(&object_opts, opt, next);
}
-static void object_option_parse(const char *optarg)
+static void object_option_parse(const char *str)
{
QemuOpts *opts;
const char *type;
Visitor *v;
- if (optarg[0] == '{') {
- QObject *obj = qobject_from_json(optarg, &error_fatal);
+ if (str[0] == '{') {
+ QObject *obj = qobject_from_json(str, &error_fatal);
v = qobject_input_visitor_new(obj);
qobject_unref(obj);
} else {
opts = qemu_opts_parse_noisily(qemu_find_opts("object"),
- optarg, true);
+ str, true);
if (!opts) {
exit(1);
}
--
2.41.0
- [PULL 19/32] ui/cocoa: Clean up global variable shadowing, (continued)
- [PULL 19/32] ui/cocoa: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 22/32] semihosting/arm-compat: Clean up local variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 20/32] util/cutils: Clean up global variable shadowing in get_relocated_path(), Markus Armbruster, 2023/10/06
- [PULL 25/32] trace/control: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 28/32] linux-user/flatload: clean up local variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 17/32] qom/object_interfaces: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 24/32] sysemu/tpm: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 30/32] linux-user/syscall.c: clean up local variable shadowing in do_ioctl_dm(), Markus Armbruster, 2023/10/06
- [PULL 02/32] target/loongarch: Clean up local variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 11/32] hw/ide/ahci: Clean up local variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 23/32] softmmu/vl: Clean up global variable shadowing,
Markus Armbruster <=
- [PULL 08/32] hw/virtio/vhost: Silence compiler warnings in vhost code when using -Wshadow, Markus Armbruster, 2023/10/06
- [PULL 04/32] hw/i386: changes towards enabling -Wshadow=local for x86 machines, Markus Armbruster, 2023/10/06
- [PULL 15/32] qemu-img: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- Re: [PULL 00/32] -Wshadow=local patches patches for 2023-10-06, Stefan Hajnoczi, 2023/10/09