[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/32] qom/object_interfaces: Clean up global variable shadowing
From: |
Markus Armbruster |
Subject: |
[PULL 17/32] qom/object_interfaces: Clean up global variable shadowing |
Date: |
Fri, 6 Oct 2023 13:36:42 +0200 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Fix:
qom/object_interfaces.c:262:53: error: declaration shadows a variable in the
global scope [-Werror,-Wshadow]
ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp)
^
qom/object_interfaces.c:298:46: error: declaration shadows a variable in the
global scope [-Werror,-Wshadow]
bool user_creatable_add_from_str(const char *optarg, Error **errp)
^
qom/object_interfaces.c:313:49: error: declaration shadows a variable in the
global scope [-Werror,-Wshadow]
void user_creatable_process_cmdline(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-9-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/qom/object_interfaces.h | 16 ++++++++--------
qom/object_interfaces.c | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index 81541e2080..02b11a7ef0 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -99,7 +99,7 @@ void user_creatable_add_qapi(ObjectOptions *options, Error
**errp);
/**
* user_creatable_parse_str:
- * @optarg: the object definition string as passed on the command line
+ * @str: the object definition string as passed on the command line
* @errp: if an error occurs, a pointer to an area to store the error
*
* Parses the option for the user creatable object with a keyval parser and
@@ -110,14 +110,14 @@ void user_creatable_add_qapi(ObjectOptions *options,
Error **errp);
* Returns: ObjectOptions on success, NULL when an error occurred (*errp is set
* then) or help was printed (*errp is not set).
*/
-ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp);
+ObjectOptions *user_creatable_parse_str(const char *str, Error **errp);
/**
* user_creatable_add_from_str:
- * @optarg: the object definition string as passed on the command line
+ * @str: the object definition string as passed on the command line
* @errp: if an error occurs, a pointer to an area to store the error
*
- * Create an instance of the user creatable object by parsing optarg
+ * Create an instance of the user creatable object by parsing @str
* with a keyval parser and implicit key 'qom-type', converting the
* result to ObjectOptions and calling into qmp_object_add().
*
@@ -126,13 +126,13 @@ ObjectOptions *user_creatable_parse_str(const char
*optarg, Error **errp);
* Returns: true when an object was successfully created, false when an error
* occurred (*errp is set then) or help was printed (*errp is not set).
*/
-bool user_creatable_add_from_str(const char *optarg, Error **errp);
+bool user_creatable_add_from_str(const char *str, Error **errp);
/**
* user_creatable_process_cmdline:
- * @optarg: the object definition string as passed on the command line
+ * @cmdline: the object definition string as passed on the command line
*
- * Create an instance of the user creatable object by parsing optarg
+ * Create an instance of the user creatable object by parsing @cmdline
* with a keyval parser and implicit key 'qom-type', converting the
* result to ObjectOptions and calling into qmp_object_add().
*
@@ -141,7 +141,7 @@ bool user_creatable_add_from_str(const char *optarg, Error
**errp);
* This function is only meant to be called during command line parsing.
* It exits the process on failure or after printing help.
*/
-void user_creatable_process_cmdline(const char *optarg);
+void user_creatable_process_cmdline(const char *cmdline);
/**
* user_creatable_print_help:
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 7d31589b04..e0833c8bfe 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -259,7 +259,7 @@ static void user_creatable_print_help_from_qdict(QDict
*args)
}
}
-ObjectOptions *user_creatable_parse_str(const char *optarg, Error **errp)
+ObjectOptions *user_creatable_parse_str(const char *str, Error **errp)
{
ERRP_GUARD();
QObject *obj;
@@ -267,14 +267,14 @@ ObjectOptions *user_creatable_parse_str(const char
*optarg, Error **errp)
Visitor *v;
ObjectOptions *options;
- if (optarg[0] == '{') {
- obj = qobject_from_json(optarg, errp);
+ if (str[0] == '{') {
+ obj = qobject_from_json(str, errp);
if (!obj) {
return NULL;
}
v = qobject_input_visitor_new(obj);
} else {
- QDict *args = keyval_parse(optarg, "qom-type", &help, errp);
+ QDict *args = keyval_parse(str, "qom-type", &help, errp);
if (*errp) {
return NULL;
}
@@ -295,12 +295,12 @@ ObjectOptions *user_creatable_parse_str(const char
*optarg, Error **errp)
return options;
}
-bool user_creatable_add_from_str(const char *optarg, Error **errp)
+bool user_creatable_add_from_str(const char *str, Error **errp)
{
ERRP_GUARD();
ObjectOptions *options;
- options = user_creatable_parse_str(optarg, errp);
+ options = user_creatable_parse_str(str, errp);
if (!options) {
return false;
}
@@ -310,9 +310,9 @@ bool user_creatable_add_from_str(const char *optarg, Error
**errp)
return !*errp;
}
-void user_creatable_process_cmdline(const char *optarg)
+void user_creatable_process_cmdline(const char *cmdline)
{
- if (!user_creatable_add_from_str(optarg, &error_fatal)) {
+ if (!user_creatable_add_from_str(cmdline, &error_fatal)) {
/* Help was printed */
exit(EXIT_SUCCESS);
}
--
2.41.0
- [PULL 29/32] linux-user/mmap.c: clean up local variable shadowing, (continued)
- [PULL 29/32] linux-user/mmap.c: clean up local variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 12/32] net/net: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 14/32] plugins/loader: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 16/32] qemu-io: Clean up global variable shadowing, Markus Armbruster, 2023/10/06
- [PULL 03/32] target/ppc: Rename variables to avoid local variable shadowing in VUPKPX, Markus Armbruster, 2023/10/06
- [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 <=
- [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, 2023/10/06
- [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