diff mbox series

[scarthgap] gawk-native: fix gcc-15/C23 compilation issues

Message ID 20260624132927.1614585-1-yoann.congal@smile.fr
State New
Headers show
Series [scarthgap] gawk-native: fix gcc-15/C23 compilation issues | expand

Commit Message

Yoann Congal June 24, 2026, 1:29 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

On Ubuntu 26.04, GCC 15 defaults to std=c23 and that results in build
failure:
| ../gawk-5.3.0/io.c: In function ‘iop_alloc’:
| ../gawk-5.3.0/io.c:3389:31: error: assignment to ‘ssize_t (*)(int,  void *, size_t)’ {aka ‘long int (*)(int,  void *, long unsigned int)’} from incompatible pointer type ‘ssize_t (*)(void)’ {aka ‘long int (*)(void)’} [-Wincompatible-pointer-types]
|  3389 |         iop->public.read_func = ( ssize_t(*)() ) read;
|       |                               ^

Fix this by (partially) backporting an upstream patch.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 .../0001-Fix-some-C23-compilatio-issues.patch | 35 +++++++++++++++++++
 meta/recipes-extended/gawk/gawk_5.3.0.bb      |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 meta/recipes-extended/gawk/gawk/0001-Fix-some-C23-compilatio-issues.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/gawk/gawk/0001-Fix-some-C23-compilatio-issues.patch b/meta/recipes-extended/gawk/gawk/0001-Fix-some-C23-compilatio-issues.patch
new file mode 100644
index 00000000000..7082e62beb6
--- /dev/null
+++ b/meta/recipes-extended/gawk/gawk/0001-Fix-some-C23-compilatio-issues.patch
@@ -0,0 +1,35 @@ 
+From e4015d209ddc31bd1256fa568612372407e0b9c5 Mon Sep 17 00:00:00 2001
+From: Arnold D. Robbins <arnold@skeeve.com>
+Date: Mon, 12 Aug 2024 06:33:28 +0300
+Subject: [PATCH] Fix some C23 compilatio issues.
+
+
+Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=7a521fe4b37f8554ca53ef3236f0352e391aaa1d (in v5.3.1)]
+Backport: Only kept the code change, dropped comment changes
+Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
+---
+ io.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/io.c b/io.c
+index c595c009e..44671ebd1 100644
+--- a/io.c
++++ b/io.c
+@@ -3386,7 +3386,7 @@ iop_alloc(int fd, const char *name, int errno_val)
+ 
+ 	iop->public.fd = fd;
+ 	iop->public.name = name;
+-	iop->public.read_func = ( ssize_t(*)() ) read;
++	iop->public.read_func = ( ssize_t(*)(int, void *, size_t) ) read;
+ 	iop->valid = false;
+ 	iop->errcode = errno_val;
+ 
+@@ -4446,7 +4446,7 @@ get_read_timeout(IOBUF *iop)
+ 		tmout = read_default_timeout;	/* initialized from env. variable in init_io() */
+ 
+ 	/* overwrite read routine only if an extension has not done so */
+-	if ((iop->public.read_func == ( ssize_t(*)() ) read) && tmout > 0)
++	if ((iop->public.read_func == ( ssize_t(*)(int, void *, size_t) ) read) && tmout > 0)
+ 		iop->public.read_func = read_with_timeout;
+ 
+ 	return tmout;
diff --git a/meta/recipes-extended/gawk/gawk_5.3.0.bb b/meta/recipes-extended/gawk/gawk_5.3.0.bb
index e38c1f84366..b1d1fe7ae47 100644
--- a/meta/recipes-extended/gawk/gawk_5.3.0.bb
+++ b/meta/recipes-extended/gawk/gawk_5.3.0.bb
@@ -21,6 +21,7 @@  PACKAGECONFIG[mpfr] = "--with-mpfr,--without-mpfr, mpfr"
 SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
            file://0001-m4-readline-add-missing-includes.patch \
            file://run-ptest \
+           file://0001-Fix-some-C23-compilatio-issues.patch \
            "
 
 SRC_URI[sha256sum] = "378f8864ec21cfceaa048f7e1869ac9b4597b449087caf1eb55e440d30273336"