From: Aurelien DESBRIERES <aurelien@hackers.camp>
To: openembedded-core@lists.openembedded.org
Cc: aurelien.desbrieres@gmail.com
Subject: [PATCH v2] flex: backport the upstream malloc prototype fix
Date: Mon, 14 Sep 2026 10:53:18 +0200 [thread overview]
Message-ID: <20260914085318.67139-1-aurelien@hackers.camp> (raw)
In-Reply-To: <3d12110d88ce771519ccedb12e7b6d0d24d7d17a.camel@linuxfoundation.org>
lib/malloc.c declares "void *malloc ();" with an empty parameter list
and calls it with one argument. That meant "unspecified" in C89 and
means "none" in C23, so a host compiler defaulting to C23 -- GCC 15 and
later -- rejects the call:
lib/malloc.c:16:15: error: too many arguments to function 'malloc';
expected 0, have 1
The file is built by stage1flex with the build host's compiler before
flex can build itself, so neither CFLAGS nor BUILD_CFLAGS reaches that
command line and no flag in the recipe can silence it.
Upstream fixed it in bf254c75b1e0 and the patch falls out when flex
next releases. Gentoo carries the same backport as
flex-2.6.4-fix-malloc-prototype.patch.
Signed-off-by: Aurelien DESBRIERES <aurelien@hackers.camp>
---
....c-match-malloc-signature-to-its-use.patch | 37 +++++++++++++++++++
meta/recipes-devtools/flex/flex_2.6.4.bb | 1 +
2 files changed, 38 insertions(+)
create mode 100644 meta/recipes-devtools/flex/flex/0001-lib-malloc.c-match-malloc-signature-to-its-use.patch
diff --git a/meta/recipes-devtools/flex/flex/0001-lib-malloc.c-match-malloc-signature-to-its-use.patch b/meta/recipes-devtools/flex/flex/0001-lib-malloc.c-match-malloc-signature-to-its-use.patch
new file mode 100644
index 0000000000..7adeedcaa6
--- /dev/null
+++ b/meta/recipes-devtools/flex/flex/0001-lib-malloc.c-match-malloc-signature-to-its-use.patch
@@ -0,0 +1,37 @@
+From bf254c75b1e0d2641ebbd7fc85fb183f36a62ea7 Mon Sep 17 00:00:00 2001
+From: Richard Barnes <rbarnes@umn.edu>
+Date: Wed, 2 Oct 2024 10:35:09 -0700
+Subject: [PATCH] Match `malloc` signature to its use
+
+The gnulib fallback declares "void *malloc ();" with an empty parameter
+list and calls it with one argument. That meant "unspecified" in C89 and
+means "none" in C23, so a compiler defaulting to C23 -- GCC 15 and later
+-- rejects the call:
+
+ lib/malloc.c:16:15: error: too many arguments to function 'malloc';
+ expected 0, have 1
+
+The file is built by stage1flex with the build host's compiler before
+flex can build itself, so neither CFLAGS nor BUILD_CFLAGS reaches that
+command line and no flag in the recipe can silence it.
+
+Upstream-Status: Backport [https://github.com/westes/flex/commit/bf254c75b1e0d2641ebbd7fc85fb183f36a62ea7]
+
+Signed-off-by: Aurelien DESBRIERES <aurelien@hackers.camp>
+---
+ lib/malloc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/malloc.c b/lib/malloc.c
+index 75e8ef97c..701b9b39d 100755
+--- a/lib/malloc.c
++++ b/lib/malloc.c
+@@ -3,7 +3,7 @@
+
+ #include <sys/types.h>
+
+- void *malloc ();
++ void *malloc (size_t n);
+
+ /* Allocate an N-byte block of memory from the heap.
+ If N is zero, allocate a 1-byte block. */
diff --git a/meta/recipes-devtools/flex/flex_2.6.4.bb b/meta/recipes-devtools/flex/flex_2.6.4.bb
index 793a935962..3b652bda80 100644
--- a/meta/recipes-devtools/flex/flex_2.6.4.bb
+++ b/meta/recipes-devtools/flex/flex_2.6.4.bb
@@ -19,6 +19,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/flex-${PV}.tar.gz \
file://check-funcs.patch \
file://0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch \
file://0001-build-tests-add-missing-parser-scanner-dependencies.patch \
+ file://0001-lib-malloc.c-match-malloc-signature-to-its-use.patch \
"
SRC_URI[md5sum] = "2882e3179748cc9f9c23ec593d6adc8d"
--
2.55.0
next prev parent reply other threads:[~2026-09-14 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 16:05 [PATCH] flex: fix stage1flex build under a C23 default Aurelien DESBRIERES
2026-09-13 20:21 ` [OE-core] " Richard Purdie
2026-09-14 8:53 ` Aurelien DESBRIERES [this message]
2026-09-15 7:37 ` [OE-core] [PATCH v2] flex: backport the upstream malloc prototype fix Antonin Godard
2026-09-15 7:49 ` Aurelien DESBRIERES
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914085318.67139-1-aurelien@hackers.camp \
--to=aurelien@hackers.camp \
--cc=aurelien.desbrieres@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.