From: Niels Möller Date: Tue, 24 Jun 2025 18:41:41 +0000 (+0200) Subject: Fix non-prototype declarations in getopt files. X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=815865715ddf31ad5b5ff096b24a16925d961fae;p=thirdparty%2Fnettle.git Fix non-prototype declarations in getopt files. (cherry picked from commit 6d2d88588037edaf0f7795d90887f47b254c08d0) --- diff --git a/ChangeLog b/ChangeLog index 5b84b5f5..7781537d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-06-26 Niels Möller + + Cherry-picked from branch nettle-3.10-fixes: + 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-06-24 Niels Möller * sha-example.c (main): Update to use sha256 rather than sha1, 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