DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org,
	"Konstantin Ananyev" <konstantin.ananyev@huawei.com>,
	"Wathsala Vithanage" <wathsala.vithanage@arm.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"Morten Brørup" <mb@smartsharesystems.com>
Cc: stable@dpdk.org
Subject: [PATCH dpdk v3] ring: suppress unoptimized GCC string warnings locally
Date: Tue,  1 Dec 2026 10:01:20 +0100	[thread overview]
Message-ID: <20261201090119.387607-2-rjarry@redhat.com> (raw)
In-Reply-To: <20261130122929.246502-2-rjarry@redhat.com>

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: stable@dpdk.org
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---

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


  parent reply	other threads:[~2026-12-01  9:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 12:29 [PATCH dpdk] ring: split 128-bit pair copies for unoptimized GCC Robin Jarry
2026-11-30 14:04 ` [PATCH dpdk v2] " Robin Jarry
2026-11-30 14:04 ` [PATCH dpdk] " Morten Brørup
2026-11-30 14:14 ` Bruce Richardson
2026-11-30 15:57   ` Robin Jarry
2026-11-30 14:33 ` Morten Brørup
2026-12-01  9:01 ` Robin Jarry [this message]
2026-12-01  9:08   ` [PATCH dpdk v3] ring: suppress unoptimized GCC string warnings locally Morten Brørup

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=20261201090119.387607-2-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=mb@smartsharesystems.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=wathsala.vithanage@arm.com \
    /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