From 5e4c88782f7d0d293bc9e3251bd25c5e5f794736 Mon Sep 17 00:00:00 2001 From: vxtls <187420201+vxtls@users.noreply.github.com> Date: Sun, 1 Mar 2026 21:21:42 -0500 Subject: [PATCH] fix(gawk-4.2.1): add C23-compatible readfunc prototype patch --- .../patches/fix-readfunc-prototype-c23.patch | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 steps-guix/gawk-4.2.1/patches/fix-readfunc-prototype-c23.patch diff --git a/steps-guix/gawk-4.2.1/patches/fix-readfunc-prototype-c23.patch b/steps-guix/gawk-4.2.1/patches/fix-readfunc-prototype-c23.patch new file mode 100644 index 00000000..acaec1d9 --- /dev/null +++ b/steps-guix/gawk-4.2.1/patches/fix-readfunc-prototype-c23.patch @@ -0,0 +1,64 @@ +SPDX-License-Identifier: GPL-3.0-or-later + +Use an explicit function pointer prototype for readfunc so gawk 4.2.1 +builds with modern C compilers where an empty parameter list is treated +as a no-argument function. + +--- gawk-4.2.1/awkgram.y ++++ gawk-4.2.1/awkgram.y +@@ -2870,22 +2870,17 @@ + struct stat sbuf; + + /* +- * No argument prototype on readfunc on purpose, +- * avoids problems with some ancient systems where +- * the types of arguments to read() aren't up to date. ++ * Use an explicit prototype so modern C compilers (C23 and newer) ++ * do not treat an empty parameter list as a no-argument function. + */ +- static ssize_t (*readfunc)() = 0; ++ static ssize_t (*readfunc)(int, void *, size_t) = NULL; + + if (readfunc == NULL) { + char *cp = getenv("AWKREADFUNC"); + + /* If necessary, one day, test value for different functions. */ + if (cp == NULL) +- /* +- * cast is to remove warnings on systems with +- * different return types for read. +- */ +- readfunc = ( ssize_t(*)() ) read; ++ readfunc = read; + else + readfunc = read_one_line; + } +--- gawk-4.2.1/awkgram.c ++++ gawk-4.2.1/awkgram.c +@@ -5290,22 +5290,17 @@ + struct stat sbuf; + + /* +- * No argument prototype on readfunc on purpose, +- * avoids problems with some ancient systems where +- * the types of arguments to read() aren't up to date. ++ * Use an explicit prototype so modern C compilers (C23 and newer) ++ * do not treat an empty parameter list as a no-argument function. + */ +- static ssize_t (*readfunc)() = 0; ++ static ssize_t (*readfunc)(int, void *, size_t) = NULL; + + if (readfunc == NULL) { + char *cp = getenv("AWKREADFUNC"); + + /* If necessary, one day, test value for different functions. */ + if (cp == NULL) +- /* +- * cast is to remove warnings on systems with +- * different return types for read. +- */ +- readfunc = ( ssize_t(*)() ) read; ++ readfunc = read; + else + readfunc = read_one_line; + }