qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wshadow: Better name for 'optarg'?


From: Philippe Mathieu-Daudé
Subject: Wshadow: Better name for 'optarg'?
Date: Wed, 4 Oct 2023 12:05:04 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

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?

Thanks,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]