patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 21.11] examples/performance-thread: fix build with GCC 12
@ 2022-08-24  9:58 Kevin Traynor
  2022-08-24 13:55 ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Traynor @ 2022-08-24  9:58 UTC (permalink / raw)
  To: stable; +Cc: bluca, david.marchand, Kevin Traynor

[1/2] Compiling C object examples/dpdk-pthrea...
formance-thread_pthread_shim_pthread_shim.c.o
../examples/performance-thread/pthread_shim/pthread_shim.c:
In function ‘pthread_setspecific’:
../examples/performance-thread/pthread_shim/pthread_shim.c:592:27:
warning: ‘data’ may be used uninitialized [-Wmaybe-uninitialized]
592 |    int rv =  lthread_setspecific((unsigned int)key, data);
    |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../examples/performance-thread/pthread_shim/pthread_shim.c:589:56:
note: accessing argument 2 of a function declared with attribute
‘access (none, 2)’
589 | int pthread_setspecific(pthread_key_t key, const void *data)
    |                                            ~~~~~~~~~~~~^~~~

This is a false positive as pthread_setspecific() does not read from
the (const void *) so we can squash the warning.

performance-thread example is already removed from DPDK main branch.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 examples/performance-thread/pthread_shim/pthread_shim.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/examples/performance-thread/pthread_shim/pthread_shim.c b/examples/performance-thread/pthread_shim/pthread_shim.c
index bbc076584b..a44cb8244d 100644
--- a/examples/performance-thread/pthread_shim/pthread_shim.c
+++ b/examples/performance-thread/pthread_shim/pthread_shim.c
@@ -587,4 +587,9 @@ pthread_t pthread_self(void)
 }
 
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+
 int pthread_setspecific(pthread_key_t key, const void *data)
 {
@@ -596,4 +601,8 @@ int pthread_setspecific(pthread_key_t key, const void *data)
 }
 
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic pop
+#endif
+
 int pthread_spin_init(pthread_spinlock_t *a, int b)
 {
-- 
2.37.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-25  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24  9:58 [PATCH 21.11] examples/performance-thread: fix build with GCC 12 Kevin Traynor
2022-08-24 13:55 ` David Marchand
2022-08-25  9:55   ` Kevin Traynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).