> From: Robin Jarry [mailto:[email protected]] > Sent: Tuesday, 1 December 2026 10.01 > > The global_cflags change in 812a18c167f4 ("build: disable GCC string > op warnings when unoptimized") only applies to DPDK's own build. It is > not propagated through pkg-config or as subproject exported flags, so > applications that pull in rte_ring_elem_pvt.h and build at -O0 with > GCC 14 or GCC 16 still hit the stringop-overflow/stringop-overread > false positives, and treating warnings as errors turns that into a > compile error. > > Pragmas are generally discouraged in DPDK, but there is no other way > to suppress a warning for code included by an external application > build. Restrict the pragmas to the 128-bit copy helpers so application > diagnostics stay enabled everywhere else. > > Unlike the pragmas these replace, which disabled the warnings > unconditionally from GCC 12 onward, these only apply with GCC *and* > -O0, matching the condition in config/meson.build. The version check > is dropped because it is unclear which GCC versions are actually > affected. > > Fixes: 812a18c167f4 ("build: disable GCC string op warnings when > unoptimized") > Cc: [email protected] > Signed-off-by: Robin Jarry <[email protected]> > --- > > Notes: > v3: replaced nonsense hack with local warnings suppressions > > v2: also fix the dequeue path > > lib/ring/rte_ring_elem_pvt.h | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/lib/ring/rte_ring_elem_pvt.h > b/lib/ring/rte_ring_elem_pvt.h > index 77a2efafe119..185c26281005 100644 > --- a/lib/ring/rte_ring_elem_pvt.h > +++ b/lib/ring/rte_ring_elem_pvt.h > @@ -90,6 +90,13 @@ __rte_ring_enqueue_elems_64(void *ring_table, const > void *obj_table, > } > } > > +/* DPDK's -O0 warning flags do not apply to applications including > this header. */ > +#if defined(RTE_TOOLCHAIN_GCC) && !defined(__OPTIMIZE__) > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Wstringop-overflow" > +#pragma GCC diagnostic ignored "-Wstringop-overread" > +#endif > + > static __rte_always_inline void > __rte_ring_enqueue_elems_128(void *ring_table, const void *obj_table, > uint32_t size, uint32_t idx, uint32_t n) > @@ -119,6 +126,10 @@ __rte_ring_enqueue_elems_128(void *ring_table, > const void *obj_table, > } > } > > +#if defined(RTE_TOOLCHAIN_GCC) && !defined(__OPTIMIZE__) > +#pragma GCC diagnostic pop > +#endif > + > /* the actual enqueue of elements on the ring. > * Placed here since identical code needed in both > * single and multi producer enqueue functions. > @@ -233,6 +244,12 @@ __rte_ring_dequeue_elems_64(void *obj_table, const > void *ring_table, > } > } > > +#if defined(RTE_TOOLCHAIN_GCC) && !defined(__OPTIMIZE__) > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Wstringop-overflow" > +#pragma GCC diagnostic ignored "-Wstringop-overread" > +#endif > + > static __rte_always_inline void > __rte_ring_dequeue_elems_128(void *obj_table, const void *ring_table, > uint32_t size, uint32_t idx, uint32_t n) > @@ -257,6 +274,10 @@ __rte_ring_dequeue_elems_128(void *obj_table, > const void *ring_table, > } > } > > +#if defined(RTE_TOOLCHAIN_GCC) && !defined(__OPTIMIZE__) > +#pragma GCC diagnostic pop > +#endif > + > /* the actual dequeue of elements from the ring. > * Placed here since identical code needed in both > * single and multi producer enqueue functions. > -- > 2.56.1
Reviewed-by: Morten Brørup <[email protected]>

