Re: useless cast warning
Collin Funk <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
Thomas Klausner <[email protected]> writes: > When compiling emacs git head on NetBSD, I see: > > getopt1.c: In function 'rpl_getopt_long': > getopt1.c:31:34: warning: useless cast to type 'char **' [-Wuseless-cast] > 31 | return _getopt_internal (argc, (char **) argv, options, long_options, > | ^ > getopt1.c: In function 'rpl_getopt_long_only': > getopt1.c:54:34: warning: useless cast to type 'char **' [-Wuseless-cast] > 54 | return _getopt_internal (argc, (char **) argv, options, long_options, > | ^ Does this patch fix it? If so, I can push it to Gnulib. I would test it myself, but for some reason my NetBSD VM cannot connect to the NetBSD CDN to install a recent version of GCC which supports that option. diff --git a/lib/getopt1.c b/lib/getopt1.c index a5f9988828..3d7d827050 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -28,7 +28,7 @@ int getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { - return _getopt_internal (argc, (char **) argv, options, long_options, + return _getopt_internal (argc, (char **) { argv }, options, long_options, opt_index, 0, 0); } Collin