From 74bc9bf0ccefd96dad7a2e12de20581a6227894e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 23 Apr 2026 14:31:51 +0200 Subject: [PATCH] spsc_q: fix use of stdatomic.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stdatomic.h is a C++23 feature [1]. Thus, "older" compilers such as gcc-11 (default in Ubuntu 22) do not know this, and can therefore not correctly compile spsc_q. Fix this by alternatively including atomic for C++. Fixes errors such as stdatomic.h:40:9: error: ‘_Atomic’ does not name a type [1] https://en.cppreference.com/cpp/header/stdatomic.h Signed-off-by: Robert Schmidt --- common/utils/ds/spsc_q.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/utils/ds/spsc_q.h b/common/utils/ds/spsc_q.h index 7fd968b2f0..1149a80f7d 100644 --- a/common/utils/ds/spsc_q.h +++ b/common/utils/ds/spsc_q.h @@ -7,11 +7,13 @@ #include #include -#include #if defined(__cplusplus) +#include // use atomic_size_t to help interworking with C++ using std::atomic_size_t; +#else +#include #endif typedef struct spsc_q {