qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>
Subject: [PATCH v3 08/16] qom/object_interfaces: Clean up global variable shadowing
Date: Wed,  4 Oct 2023 14:00:11 +0200	[thread overview]
Message-ID: <20231004120019.93101-9-philmd@linaro.org> (raw)
In-Reply-To: <20231004120019.93101-1-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>
---
 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



  parent reply	other threads:[~2023-10-04 12:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 12:00 [PATCH v3 00/16] (few more) Steps towards enabling -Wshadow Philippe Mathieu-Daudé
2023-10-04 12:00 ` [PATCH v3 01/16] hw/audio/soundhw: Clean up global variable shadowing Philippe Mathieu-Daudé
2023-10-06  9:27   ` Thomas Huth
2023-10-04 12:00 ` [PATCH v3 02/16] hw/ide/ahci: Clean up local " Philippe Mathieu-Daudé
2023-10-05 15:48   ` John Snow
2023-10-04 12:00 ` [PATCH v3 03/16] net/net: Clean up global " Philippe Mathieu-Daudé
2023-10-06 11:10   ` Thomas Huth
2023-10-04 12:00 ` [PATCH v3 04/16] os-posix: " Philippe Mathieu-Daudé
2023-10-04 18:47   ` Eric Blake
2023-10-04 12:00 ` [PATCH v3 05/16] plugins/loader: " Philippe Mathieu-Daudé
2023-10-04 12:21   ` Alex Bennée
2023-10-04 12:00 ` [PATCH v3 06/16] qemu-img: " Philippe Mathieu-Daudé
2023-10-04 18:49   ` Eric Blake
2023-10-04 12:00 ` [PATCH v3 07/16] qemu-io: " Philippe Mathieu-Daudé
2023-10-04 18:49   ` Eric Blake
2023-10-04 12:00 ` Philippe Mathieu-Daudé [this message]
2023-10-04 12:00 ` [PATCH v3 09/16] semihosting: " Philippe Mathieu-Daudé
2023-10-04 12:16   ` Alex Bennée
2023-10-04 12:33     ` Thomas Huth
2023-10-04 12:34     ` Markus Armbruster
2023-10-04 12:00 ` [PATCH v3 10/16] ui/cocoa: " Philippe Mathieu-Daudé
2023-10-05  5:15   ` Akihiko Odaki
2023-10-04 12:00 ` [PATCH v3 11/16] util/cutils: Clean up global variable shadowing in get_relocated_path() Philippe Mathieu-Daudé
2023-10-04 18:52   ` Eric Blake
2023-10-04 12:00 ` [PATCH v3 12/16] util/guest-random: Clean up global variable shadowing Philippe Mathieu-Daudé
2023-10-04 12:00 ` [PATCH v3 13/16] semihosting/arm-compat: Clean up local " Philippe Mathieu-Daudé
2023-10-04 12:19   ` Alex Bennée
2023-10-06  9:14     ` Markus Armbruster
2023-10-06  9:52       ` Philippe Mathieu-Daudé
2023-10-04 12:00 ` [PATCH v3 14/16] softmmu/vl: Clean up global " Philippe Mathieu-Daudé
2023-10-05  8:59   ` Markus Armbruster
2023-10-05 10:49     ` Philippe Mathieu-Daudé
2023-10-04 12:00 ` [PATCH v3 15/16] sysemu/tpm: " Philippe Mathieu-Daudé
2023-10-04 13:47   ` Stefan Berger
2023-10-04 12:00 ` [PATCH v3 16/16] trace/control: " Philippe Mathieu-Daudé
2023-10-04 18:41   ` Stefan Hajnoczi
2023-10-04 19:01 ` [PATCH v3 00/16] (few more) Steps towards enabling -Wshadow Richard Henderson
2023-10-06 11:03 ` Markus Armbruster
2023-10-06 11:37 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231004120019.93101-9-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).