From: Collin Funk Date: Sun, 28 Sep 2025 22:10:52 +0000 (-0700) Subject: manual: Allow getsubopt example to compile with GCC 15. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d98af2e1d7ead573776549ecb8b7045685fd47f;p=thirdparty%2Fglibc.git manual: Allow getsubopt example to compile with GCC 15. GCC 15 turned -Wincompatible-pointer-types into a compiler error instead of a warning by default. This patch prevents the following error: $ gcc manual/examples/subopt.c manual/examples/subopt.c: In function ‘main’: manual/examples/subopt.c:64:40: error: passing argument 2 of ‘getsubopt’ from incompatible pointer type [-Wincompatible-pointer-types] 64 | switch (getsubopt (&subopts, mount_opts, &value)) | ^~~~~~~~~~ | | | const char ** In file included from manual/examples/subopt.c:19: /usr/include/stdlib.h:1100:47: note: expected ‘char * const* restrict’ but argument is of type ‘const char **’ 1100 | char *const *__restrict __tokens, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ Reviewed-by: Adhemerval Zanella --- diff --git a/manual/examples/subopt.c b/manual/examples/subopt.c index e7a073099a..63b5271483 100644 --- a/manual/examples/subopt.c +++ b/manual/examples/subopt.c @@ -61,7 +61,7 @@ main (int argc, char **argv) case 'o': subopts = optarg; while (*subopts != '\0') - switch (getsubopt (&subopts, mount_opts, &value)) + switch (getsubopt (&subopts, (char * const *) mount_opts, &value)) { case RO_OPTION: read_only = 1;