This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix warning in posix/tst-getopt_long1.c
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Tue, 2 Dec 2014 21:46:46 +0000
- Subject: Re: Fix warning in posix/tst-getopt_long1.c
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1411252352150 dot 17237 at digraph dot polyomino dot org dot uk> <20141202192109 dot 1E0A42C39FE at topped-with-meat dot com>
On Tue, 2 Dec 2014, Roland McGrath wrote:
> The strings won't be modified. So why not just add (char *) casts?
Here is a patch version using casts. Tested for x86_64.
2014-12-02 Joseph Myers <joseph@codesourcery.com>
* posix/tst-getopt_long1.c (do_test): Cast elements of argv array
to char *.
diff --git a/posix/tst-getopt_long1.c b/posix/tst-getopt_long1.c
index e0ecd12..3895ebd 100644
--- a/posix/tst-getopt_long1.c
+++ b/posix/tst-getopt_long1.c
@@ -39,7 +39,7 @@ do_test (void)
return 1;
}
- char *argv[] = { "program", "--on" };
+ char *argv[] = { (char *) "program", (char *) "--on" };
int argc = 2;
int c = getopt_long (argc, argv, "12345", opts, NULL);
--
Joseph S. Myers
joseph@codesourcery.com