From: Bruce Richardson <bruce.richardson@intel.com>
To: David Marchand <david.marchand@redhat.com>
Cc: <dev@dpdk.org>, <mb@smartsharesystems.com>, <stable@dpdk.org>
Subject: Re: [PATCH] eal: fix C++ builds when stdatomics is set
Date: Fri, 25 Sep 2026 11:54:38 +0100 [thread overview]
Message-ID: <arZS7u1zo5ES3SCZ@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <CAJFAV8x2qg7x_g=fQq3odv8cmrP_a=Ax4_HYZVpg-jwXVAujJA@mail.gmail.com>
On Fri, Sep 25, 2026 at 12:13:41PM +0200, David Marchand wrote:
> On Thu, 24 Sept 2026 at 16:13, Bruce Richardson
> <bruce.richardson@intel.com> 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: stable@dpdk.org
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>
> 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.
>
Sure. Shall I do a respin to include that?
/Bruce
next prev parent reply other threads:[~2026-09-25 10:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 14:12 [PATCH] eal: fix C++ builds when stdatomics is set Bruce Richardson
2026-09-25 10:13 ` David Marchand
2026-09-25 10:54 ` Bruce Richardson [this message]
2026-09-25 11:57 ` David Marchand
2026-09-25 12:49 ` [PATCH v2] " Bruce Richardson
2026-09-29 7:23 ` Thomas Monjalon
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=arZS7u1zo5ES3SCZ@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=stable@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox