From: Claudio Fontana <cfontana@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>
Cc: "QEMU Developers" <qemu-devel@nongnu.org>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: Wshadow: Better name for 'optarg'?
Date: Thu, 5 Oct 2023 10:50:05 +0200 [thread overview]
Message-ID: <00006dc3-f2bc-e539-99cd-137d69a95dfe@suse.de> (raw)
In-Reply-To: <14cd0201-1507-bfa8-fe9e-f482c35d21ca@linaro.org>
On 10/4/23 12:05, Philippe Mathieu-Daudé wrote:
> Hi,
>
> I'm getting a bunch of errors for 'optarg' declared in <unistd.h>:
>
> NAME
> getopt – get option character from command line argument list
>
> LIBRARY
> Standard C Library (libc, -lc)
>
> SYNOPSIS
> #include <unistd.h>
>
> extern char *optarg;
>
>
> 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)
> ^
> util/guest-random.c:90:45: error: declaration shadows a variable in the
> global scope [-Werror,-Wshadow]
> int qemu_guest_random_seed_main(const char *optarg, Error **errp)
> ^
> trace/control.c:288:34: error: declaration shadows a variable in the
> global scope [-Werror,-Wshadow]
> void trace_opt_parse(const char *optarg)
> ^
> /Users/philmd/source/qemu/include/qemu/plugin.h:245:54: error:
> declaration shadows a variable in the global scope [-Werror,-Wshadow]
> static inline void qemu_plugin_opt_parse(const char *optarg,
> ^
> os-posix.c:103:31: error: declaration shadows a variable in the global
> scope [-Werror,-Wshadow]
> bool os_set_runas(const char *optarg)
> ^
> os-posix.c:176:32: error: declaration shadows a variable in the global
> scope [-Werror,-Wshadow]
> void os_set_chroot(const char *optarg)
> ^
> softmmu/tpm.c:178:59: error: declaration shadows a variable in the
> global scope [-Werror,-Wshadow]
> int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
> ^
> /Users/philmd/source/qemu/include/qemu/plugin.h:245:54: error:
> declaration shadows a variable in the global scope [-Werror,-Wshadow]
> static inline void qemu_plugin_opt_parse(const char *optarg,
> ^
> 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:1598:17: error: declaration shadows a variable in the
> global scope [-Werror,-Wshadow]
> const char *optarg;
> ^
> 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)
> ^
> softmmu/vl.c:2710:17: error: declaration shadows a variable in the
> global scope [-Werror,-Wshadow]
> const char *optarg;
> ^
> net/net.c:1680:35: error: declaration shadows a variable in the global
> scope [-Werror,-Wshadow]
> bool netdev_is_modern(const char *optarg)
> ^
> net/net.c:1714:38: error: declaration shadows a variable in the global
> scope [-Werror,-Wshadow]
> void netdev_parse_modern(const char *optarg)
> ^
> net/net.c:1728:60: error: declaration shadows a variable in the global
> scope [-Werror,-Wshadow]
> void net_client_parse(QemuOptsList *opts_list, const char *optarg)
> ^
> semihosting/config.c:134:49: error: declaration shadows a variable in
> the global scope [-Werror,-Wshadow]
> int qemu_semihosting_config_options(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 */
> ^
>
> Do we want to clean those? Any good name suggestion?
I would suggest "arg".
>
> Thanks,
>
> Phil.
>
prev parent reply other threads:[~2023-10-05 8:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 10:05 Wshadow: Better name for 'optarg'? Philippe Mathieu-Daudé
2023-10-04 10:15 ` Daniel P. Berrangé
2023-10-04 13:14 ` Warner Losh
2023-10-04 17:23 ` Richard Henderson
2023-10-04 17:35 ` Thomas Huth
2023-10-04 17:43 ` Philippe Mathieu-Daudé
2023-10-04 17:47 ` Warner Losh
2023-10-04 17:56 ` Thomas Huth
2023-10-04 18:02 ` Daniel P. Berrangé
2023-10-05 6:56 ` Philippe Mathieu-Daudé
2023-10-05 5:17 ` Markus Armbruster
2023-10-05 6:52 ` Philippe Mathieu-Daudé
2023-10-05 8:44 ` Daniel P. Berrangé
2023-10-05 8:50 ` Claudio Fontana [this message]
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=00006dc3-f2bc-e539-99cd-137d69a95dfe@suse.de \
--to=cfontana@suse.de \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.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).