]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Fix non-prototype declarations in getopt files.
authorNiels Möller <nisse@lysator.liu.se>
Tue, 24 Jun 2025 18:41:41 +0000 (20:41 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 26 Jun 2025 19:48:09 +0000 (21:48 +0200)
(cherry picked from commit 6d2d88588037edaf0f7795d90887f47b254c08d0)

ChangeLog
getopt.c
getopt.h

index 5b84b5f5847ee32c381bd76027ffebbf169548e2..7781537d1cde035b0c8d3148a7f13e53b96d4f99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-06-26  Niels Möller  <nisse@lysator.liu.se>
+
+       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  <nisse@lysator.liu.se>
 
        * sha-example.c (main): Update to use sha256 rather than sha1, and
index 9d29de7c5ab1060864e94f5d7f447b0c25672d3d..6d1c9218d722bbceb431f0b576ef6bf2caeedcb4 100644 (file)
--- a/getopt.c
+++ b/getopt.c
@@ -129,17 +129,6 @@ int optopt = '?';
 
 static struct _getopt_data getopt_data;
 
-\f
-#ifndef __GNU_LIBRARY__
-
-/* Avoid depending on library functions or files
-   whose names are inconsistent.  */
-
-#ifndef getenv
-extern char *getenv ();
-#endif
-
-#endif /* not __GNU_LIBRARY__ */
 \f
 #ifdef _LIBC
 /* Stored original parameters.
index da1a01ffa86b2764b2352f7c941da0d5cb03e408..da812bc974dfb1d12a2ba2ef3ccd349c7b938187 100644 (file)
--- 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