All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/libfutils: fix build with gcc >= 16
@ 2026-11-24 17:24 Giulio Benetti
  2026-11-24 17:45 ` Herve Codina via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Giulio Benetti @ 2026-11-24 17:24 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina, Giulio Benetti

ATOMIC_VAR_INIT() has been removed in C23, so with gcc >= 16 the build
fails with:

src/random.c:338:31: error: implicit declaration of function 'ATOMIC_VAR_INIT'; did you mean 'ATOMIC_FLAG_INIT'? [-Wimplicit-function-declaration]

So let's add a local patch that initializes the atomic variable
directly.

Fixes:
https://autobuild.buildroot.org/results/819/8195c40c826e1b85ced2aec5d1e8705542a82c93/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 ...01-random-drop-ATOMIC_VAR_INIT-usage.patch | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 package/libfutils/0001-random-drop-ATOMIC_VAR_INIT-usage.patch

diff --git a/package/libfutils/0001-random-drop-ATOMIC_VAR_INIT-usage.patch b/package/libfutils/0001-random-drop-ATOMIC_VAR_INIT-usage.patch
new file mode 100644
index 0000000000..17aa454b94
--- /dev/null
+++ b/package/libfutils/0001-random-drop-ATOMIC_VAR_INIT-usage.patch
@@ -0,0 +1,47 @@
+From d79dd390211e9509c769662b11fe0c2857d6d3f2 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Tue, 24 Nov 2026 17:08:31 +0100
+Subject: [PATCH] random: drop ATOMIC_VAR_INIT() usage
+
+ATOMIC_VAR_INIT() has been deprecated in C17 and removed in C23, so with
+gcc >= 16 (that defaults to -std=gnu23) <stdatomic.h> doesn't provide it
+anymore and the build fails with:
+
+src/random.c:338:31: error: implicit declaration of function 'ATOMIC_VAR_INIT'; did you mean 'ATOMIC_FLAG_INIT'? [-Wimplicit-function-declaration]
+src/random.c:338:31: error: initializer element is not constant
+
+Since C17 an atomic object with static storage duration can be
+initialized directly, so let's do that and drop the local fallback
+definition of ATOMIC_VAR_INIT() too.
+
+Upstream: https://github.com/Parrot-Developers/libfutils/pull/2
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ src/random.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/src/random.c b/src/random.c
+index 7c6a9a5..4236489 100644
+--- a/src/random.c
++++ b/src/random.c
+@@ -92,8 +92,6 @@ ULOG_DECLARE_TAG(futils_random);
+ 
+ #if !defined(HAVE_STDATOMIC) && defined(__GNUC__)
+ 
+-#define ATOMIC_VAR_INIT(v) (v)
+-
+ /* codecheck_ignore[NEW_TYPEDEFS] */
+ typedef unsigned int atomic_uint;
+ 
+@@ -335,7 +333,7 @@ struct pool {
+ 	uint8_t buffer[512];
+ };
+ 
+-static atomic_uint seed_era = ATOMIC_VAR_INIT(1); /* current seed era */
++static atomic_uint seed_era = 1; /* current seed era */
+ 
+ #ifdef HAVE_THREAD_LOCAL
+ 
+-- 
+2.47.3
+
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-25 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 17:24 [Buildroot] [PATCH] package/libfutils: fix build with gcc >= 16 Giulio Benetti
2026-11-24 17:45 ` Herve Codina via buildroot
2026-11-25  9:42 ` Yegor Yefremov
2026-11-25 19:49 ` Julien Olivain via buildroot

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.