spsc_q: fix use of stdatomic.h

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 <robert.schmidt@openairinterface.org>
This commit is contained in:
Robert Schmidt
2026-04-23 14:31:51 +02:00
parent b0f63bf83c
commit 74bc9bf0cc
+3 -1
View File
@@ -7,11 +7,13 @@
#include <stdint.h>
#include <stdbool.h>
#include <stdatomic.h>
#if defined(__cplusplus)
#include <atomic>
// use atomic_size_t to help interworking with C++
using std::atomic_size_t;
#else
#include <stdatomic.h>
#endif
typedef struct spsc_q {