Khem Raj submitted this fix over a year ago: https://lists.gnu.org/archive/html/bug-make/2025-03/msg00033.html but it missed lib/fnmatch.c and used generic parameter lists.
GCC 15 defaults to C23, rejecting K&R empty parameter declarations that conflict with musl's strict prototypes in <stdlib.h>/<unistd.h>. This complete fix covers all three declaration sites. Tested with GCC 15 + musl libc (Buildroot). References: https://lists.gnu.org/archive/html/bug-make/2025-03/msg00033.html Signed-off-by: Shubham Chakraborty <[email protected]> --- gl/lib/fnmatch.c | 2 +- src/getopt.c | 2 +- src/getopt.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gl/lib/fnmatch.c b/gl/lib/fnmatch.c index 528962f8..1799e865 100644 --- a/gl/lib/fnmatch.c +++ b/gl/lib/fnmatch.c @@ -120,7 +120,7 @@ If not, see <https://www.gnu.org/licenses/>. */ whose names are inconsistent. */ # if !defined _LIBC && !defined getenv -extern char *getenv (); +extern char *getenv (const char *__name); # endif # ifndef errno diff --git a/src/getopt.c b/src/getopt.c index 8d23be12..3efe7d44 100644 --- a/src/getopt.c +++ b/src/getopt.c @@ -202,7 +202,7 @@ static char *posixly_correct; whose names are inconsistent. */ #ifndef getenv -extern char *getenv (); +extern char *getenv (const char *__name); #endif static char * diff --git a/src/getopt.h b/src/getopt.h index f06ff515..c0449dae 100644 --- a/src/getopt.h +++ b/src/getopt.h @@ -102,7 +102,7 @@ struct option errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ -extern int getopt (); +extern int getopt (int argc, char *const *argv, const char *shortopts); #endif /* __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); @@ -116,7 +116,7 @@ extern int _getopt_internal (int argc, char *const *argv, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ -extern int getopt (); +extern int getopt (int argc, char *const *argv, const char *shortopts); extern int getopt_long (); extern int getopt_long_only (); -- 2.53.0
