gawk-native: fix gcc-15/C23 compilation issues

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.

(From OE-Core rev: 790bccfd8b82809e87311b24f71cf9f8e6a02b5e)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
Yoann Congal
2026-06-24 15:02:44 +02:00
committed by Paul Barker
parent 2bf810addd
commit e9dcaec506
2 changed files with 36 additions and 0 deletions

View File

@@ -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;

View File

@@ -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"