On Thu, 24 Sept 2026 at 16:13, Bruce Richardson
<[email protected]> wrote:
>
> When the DPDK build is configured to use stdatomics rather than compiler
> builtin atomics, the C++ chkincs builds were failing
>
> In file included from buildtools/chkincs/staging/generic/rte_atomic.h:18,
> from
> /home/morten/upstreaming/dpdk-stack-std/lib/eal/x86/include/rte_atomic.h:12,
> from buildtools/chkincs/chkincs-cpp.p/rte_atomic.cpp:1:
> buildtools/chkincs/staging/rte_stdatomic.h:30:9: error: ‘memory_order’ does
> not name a type
> 30 | typedef memory_order rte_memory_order;
> | ^~~~~~~~~~~~
>
> The cause is differences in atomics in C (C11) and C++ (e.g. C++17 as
> supported by current GCC). As explained by AI analysis:
>
> " _Atomic(T) is a C11 feature. In C++ mode, GCC 15 does not support it as
> a type specifier, and <stdatomic.h> in C++17 doesn't expose
> memory_order in the global namespace (that's only in C++23). DPDK
> headers also use _Atomic in anonymous unions and under extern "C",
> which are incompatible with C++'s std::atomic<T> mapping."
>
> To fix this in a resilient manner we need to go from two blocks in
> rte_atomic.h to three. We have the existing non-standard/builtin
> atomics path, but the standard atomic path now needs to be split into C
> compatible and C++ compatible blocks. This fixes the build issues with
> C++ while keeping existing C builds unchanged.
>
> Bugzilla ID: 1985
> Fixes: 5c381a3587d1 ("eal: provide stdatomic API")
> Cc: [email protected]
>
> Signed-off-by: Bruce Richardson <[email protected]>
Probably worth squashing this in (I tested in GHA):
$ git diff
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index e0b914a142..b09d72dd87 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -111,13 +111,12 @@ OPTS="$OPTS -Dplatform=generic"
OPTS="$OPTS -Ddefault_library=$DEF_LIB"
if [ "$STDATOMIC" = "true" ]; then
OPTS="$OPTS -Denable_stdatomic=true"
+fi
+OPTS="$OPTS -Dcheck_includes=true"
+if [ "${CC%%clang}" != "$CC" ]; then
+ export CXX=clang++
else
- OPTS="$OPTS -Dcheck_includes=true"
- if [ "${CC%%clang}" != "$CC" ]; then
- export CXX=clang++
- else
- export CXX=g++
- fi
+ export CXX=g++
fi
if [ "$MINI" = "true" ]; then
OPTS="$OPTS -Denable_drivers=net/null"
Compilation passes fine in my env and GHA.
--
David Marchand