qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Wshadow: Better name for 'optarg'?
@ 2023-10-04 10:05 Philippe Mathieu-Daudé
  2023-10-04 10:15 ` Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-04 10:05 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: QEMU Developers, Daniel P. Berrangé, Thomas Huth,
	Paolo Bonzini

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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-10-05  8:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).