Re: useless cast warning

Thomas Klausner <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
On Fri, Jul 17, 2026 at 12:29:31AM +0100, Collin Funk wrote:
> 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.

Yes, but it needs to be changed in both places.

(Btw, NetBSD does provide getopt_long, just not getopt_long_only.)

Thanks for the quick fix!
 Thomas
patch-lib_getopt1.c (text/x-c, 807 B)
--- lib/getopt1.c.orig	2026-07-14 17:23:34.000000000 +0000
+++ lib/getopt1.c
@@ -28,7 +28,7 @@ getopt_long (int argc, char *__getopt_argv_const *argv
 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);
 }
 
@@ -51,7 +51,7 @@ getopt_long_only (int argc, char *__getopt_argv_const 
 		  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, 1, 0);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.