mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-02-11 10:51:38 +01:00
Fix getenv/getopt and other function prototypes with gcc 15.
```
getopt.c:366:21: error: too many arguments to function 'getenv'; expected 0, have 1
366 | posixly_correct = getenv ("POSIXLY_CORRECT");
| ^~~~~~ ~~~~~~~~~~~~~~~~~
getopt.c:214:7: note: declared here
214 | char *getenv ();
| ^~~~~~
```
```
getopt.c:922:1: error: number of arguments doesn't match prototype
922 | {
| ^
In file included from getopt.c:113:
getopt.h:108:12: error: prototype declaration
108 | extern int getopt ();
| ^~~~~~
```
```
regex.c:3565:13: error: too many arguments to function 're_match_2_internal'; expected 0, have 8
3565 | val = re_match_2_internal (bufp, string1, size1, string2, size2,
| ^~~~~~~~~~~~~~~~~~~ ~~~~
regex.c:339:12: note: declared here
339 | static int re_match_2_internal ();
| ^~~~~~~~~~~~~~~~~~~
```
25 lines
950 B
Diff
25 lines
950 B
Diff
diff -ruN a/compat/getopt.c b/compat/getopt.c
|
|
--- a/compat/getopt.c 2025-09-10 00:44:17.560000000 +0000
|
|
+++ b/compat/getopt.c 2025-09-10 01:22:33.360000000 +0000
|
|
@@ -211,7 +211,7 @@
|
|
/* Avoid depending on library functions or files
|
|
whose names are inconsistent. */
|
|
|
|
-char *getenv ();
|
|
+char *getenv (const char *);
|
|
|
|
static char *
|
|
my_index (str, chr)
|
|
diff -ruN a/compat/getopt.h b/compat/getopt.h
|
|
--- a/compat/getopt.h 2011-10-30 16:48:42.000000000 +0000
|
|
+++ b/compat/getopt.h 2025-09-10 01:21:26.450000000 +0000
|
|
@@ -105,7 +105,7 @@
|
|
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, char * const [], const char *);
|
|
#endif /* __GNU_LIBRARY__ */
|
|
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
|
const struct option *longopts, int *longind);
|