[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wshadow: Better name for 'optarg'?
From: |
Claudio Fontana |
Subject: |
Re: Wshadow: Better name for 'optarg'? |
Date: |
Thu, 5 Oct 2023 10:50:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 |
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.
>
- Re: Wshadow: Better name for 'optarg'?, (continued)
- Re: Wshadow: Better name for 'optarg'?, Richard Henderson, 2023/10/04
- Re: Wshadow: Better name for 'optarg'?, Thomas Huth, 2023/10/04
- Re: Wshadow: Better name for 'optarg'?, Philippe Mathieu-Daudé, 2023/10/04
- Re: Wshadow: Better name for 'optarg'?, Warner Losh, 2023/10/04
- Re: Wshadow: Better name for 'optarg'?, Thomas Huth, 2023/10/04
- Re: Wshadow: Better name for 'optarg'?, Daniel P . Berrangé, 2023/10/04
- Re: Wshadow: Better name for 'optarg'?, Philippe Mathieu-Daudé, 2023/10/05
- Re: Wshadow: Better name for 'optarg'?, Markus Armbruster, 2023/10/05
- Re: Wshadow: Better name for 'optarg'?, Philippe Mathieu-Daudé, 2023/10/05
- Re: Wshadow: Better name for 'optarg'?, Daniel P . Berrangé, 2023/10/05
Re: Wshadow: Better name for 'optarg'?,
Claudio Fontana <=