From: Yoann Congal <[email protected]>

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 <[email protected]>
---
 .../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 --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 <[email protected]>
+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 <[email protected]>
+---
+ 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"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#239506): 
https://lists.openembedded.org/g/openembedded-core/message/239506
Mute This Topic: https://lists.openembedded.org/mt/119956601/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to