diff mbox series

[10/21] bc: Add missing params to getopt/getenv signatures

Message ID 20250324-b4-musl-gcc15-v1-10-ca68c03c5b01@gmail.com
State Accepted, archived
Commit 22418116d6dd7b3475d074ecb6a0b1d5c00b229b
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
Fix build with GCC 15 on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...missing-params-to-getopt-getenv-signature.patch | 40 ++++++++++++++++++++++
 meta/recipes-extended/bc/bc_1.08.1.bb              |  1 +
 2 files changed, 41 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-extended/bc/bc/0001-getopt-Add-missing-params-to-getopt-getenv-signature.patch b/meta/recipes-extended/bc/bc/0001-getopt-Add-missing-params-to-getopt-getenv-signature.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f43f3360757d33c5737da2e78618c1b348f41243
--- /dev/null
+++ b/meta/recipes-extended/bc/bc/0001-getopt-Add-missing-params-to-getopt-getenv-signature.patch
@@ -0,0 +1,40 @@ 
+From 493997b0d2c3dc6469f967d8f619ed934667c71e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 22 Mar 2025 18:33:08 -0700
+Subject: [PATCH] getopt: Add missing params to getopt/getenv signatures
+
+This ensures it can compile with GCC 15 on musl
+
+Upstream-Status: Submitted [sent to bug-bc@gnu.org]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ h/getopt.h   | 2 +-
+ lib/getopt.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/h/getopt.h b/h/getopt.h
+index cc45f46..5ea5eac 100644
+--- a/h/getopt.h
++++ b/h/getopt.h
+@@ -141,7 +141,7 @@ struct option
+    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__ */
+ 
+ #ifndef __need_getopt
+diff --git a/lib/getopt.c b/lib/getopt.c
+index b270074..3e6d071 100644
+--- a/lib/getopt.c
++++ b/lib/getopt.c
+@@ -197,7 +197,7 @@ static char *posixly_correct;
+    whose names are inconsistent.  */
+ 
+ #ifndef getenv
+-extern char *getenv ();
++extern char *getenv (const char*);
+ #endif
+ 
+ #endif /* not __GNU_LIBRARY__ */
diff --git a/meta/recipes-extended/bc/bc_1.08.1.bb b/meta/recipes-extended/bc/bc_1.08.1.bb
index 473d78d8a7741d25c08941c8d080eeecb16a87a6..5fbbe7ef6abaea27c28280641007677a3048636c 100644
--- a/meta/recipes-extended/bc/bc_1.08.1.bb
+++ b/meta/recipes-extended/bc/bc_1.08.1.bb
@@ -13,6 +13,7 @@  SECTION = "base"
 DEPENDS = "flex-native"
 
 SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
+           file://0001-getopt-Add-missing-params-to-getopt-getenv-signature.patch \
            file://run-ptest"
 SRC_URI[sha256sum] = "b71457ffeb210d7ea61825ff72b3e49dc8f2c1a04102bbe23591d783d1bfe996"