diff mbox series

[06/21] gawk: Fix build with gcc-15 on musl

Message ID 20250324-b4-musl-gcc15-v1-6-ca68c03c5b01@gmail.com
State Accepted, archived
Commit 1ec77b42d83c5059b581c0adeb2d816105411230
Headers show
Series musl/gcc-15: Fix packages to build with gcc15 on musl platforms | expand

Commit Message

Khem Raj March 24, 2025, 4:33 p.m. UTC
getopt signature needs to include parameters or else gcc-15 complains

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...arameter-signatures-for-getenv-and-getopt.patch | 54 ++++++++++++++++++++++
 meta/recipes-extended/gawk/gawk_5.3.1.bb           |  1 +
 2 files changed, 55 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-extended/gawk/gawk/0001-Add-parameter-signatures-for-getenv-and-getopt.patch b/meta/recipes-extended/gawk/gawk/0001-Add-parameter-signatures-for-getenv-and-getopt.patch
new file mode 100644
index 0000000000000000000000000000000000000000..7ed615a8812d6d6fe1a2782e148c4672696b4d92
--- /dev/null
+++ b/meta/recipes-extended/gawk/gawk/0001-Add-parameter-signatures-for-getenv-and-getopt.patch
@@ -0,0 +1,54 @@ 
+From 4a8352eeaa99bbea3461696855c973447e87abdd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 22 Mar 2025 15:14:16 -0700
+Subject: [PATCH] Add parameter signatures for getenv() and getopt()
+
+GCC-15 complains about it when building for musl C library
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-gawk/2025-03/msg00027.html]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ missing_d/fnmatch.c | 2 +-
+ support/getopt.c    | 2 +-
+ support/getopt.h    | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/missing_d/fnmatch.c b/missing_d/fnmatch.c
+index ccb7e34..7f97fbf 100644
+--- a/missing_d/fnmatch.c
++++ b/missing_d/fnmatch.c
+@@ -121,7 +121,7 @@ USA.  */
+    whose names are inconsistent.  */
+ 
+ # if !defined _LIBC && !defined getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ # endif
+ 
+ # ifndef errno
+diff --git a/support/getopt.c b/support/getopt.c
+index eeb71ba..e7ebd19 100644
+--- a/support/getopt.c
++++ b/support/getopt.c
+@@ -152,7 +152,7 @@ static struct _getopt_data getopt_data;
+    whose names are inconsistent.  */
+ 
+ #ifndef getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ #endif
+ 
+ #endif /* not __GNU_LIBRARY__ */
+diff --git a/support/getopt.h b/support/getopt.h
+index 8393569..06482cf 100644
+--- a/support/getopt.h
++++ b/support/getopt.h
+@@ -181,7 +181,7 @@ extern int __posix_getopt (int ___argc, char *const *___argv,
+ #  endif
+ # endif
+ #else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
++extern int getopt (int,  char * const*, const char *);
+ #endif /* __GNU_LIBRARY__ */
+ 
+ #ifndef __need_getopt
diff --git a/meta/recipes-extended/gawk/gawk_5.3.1.bb b/meta/recipes-extended/gawk/gawk_5.3.1.bb
index 724b561c93f38e1dc4f50a9dc706e9c06ed685de..1fe2f2b2a79422c45cf746836e5a135695474cfb 100644
--- a/meta/recipes-extended/gawk/gawk_5.3.1.bb
+++ b/meta/recipes-extended/gawk/gawk_5.3.1.bb
@@ -18,6 +18,7 @@  PACKAGECONFIG[mpfr] = "--with-mpfr,--without-mpfr, mpfr"
 SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
            file://run-ptest \
            file://0001-configure.ac-re-enable-disabled-printf-features.patch \
+           file://0001-Add-parameter-signatures-for-getenv-and-getopt.patch \
            "
 
 SRC_URI[sha256sum] = "fa41b3a85413af87fb5e3a7d9c8fa8d4a20728c67651185bb49c38a7f9382b1e"