From 6d2d88588037edaf0f7795d90887f47b254c08d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niels=20M=C3=B6ller?= Date: Tue, 24 Jun 2025 20:41:41 +0200 Subject: [PATCH] Fix non-prototype declarations in getopt files. --- ChangeLog | 7 +++++++ getopt.c | 11 ----------- getopt.h | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1ab73ea..b57e153b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-06-24 Niels Möller + + Minimal patch for compilers that require prototypes, e.g., gcc-15. + * getopt.c (getenv): Delete non-prototype declaration. + * getopt.h (getopt): Declare getopt with a prototype, also for + non-glibc systems. + 2025-04-02 Niels Möller * configure.ac: For ppc64, check if __VSX__ is defined, and diff --git a/getopt.c b/getopt.c index 9d29de7c..6d1c9218 100644 --- a/getopt.c +++ b/getopt.c @@ -129,17 +129,6 @@ int optopt = '?'; static struct _getopt_data getopt_data; - -#ifndef __GNU_LIBRARY__ - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -#endif /* not __GNU_LIBRARY__ */ #ifdef _LIBC /* Stored original parameters. diff --git a/getopt.h b/getopt.h index da1a01ff..da812bc9 100644 --- a/getopt.h +++ b/getopt.h @@ -166,7 +166,7 @@ extern int __posix_getopt (int ___argc, char *const *___argv, # endif # endif #else /* not __GNU_LIBRARY__ */ -extern int getopt (); +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); #endif /* __GNU_LIBRARY__ */ #ifndef __need_getopt -- 2.47.2