patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: stable@dpdk.org
Cc: bluca@debian.org, david.marchand@redhat.com,
	Kevin Traynor <ktraynor@redhat.com>
Subject: [PATCH 21.11] examples/performance-thread: fix build with GCC 12
Date: Wed, 24 Aug 2022 10:58:16 +0100	[thread overview]
Message-ID: <20220824095816.1449620-1-ktraynor@redhat.com> (raw)

[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


             reply	other threads:[~2022-08-24  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24  9:58 Kevin Traynor [this message]
2022-08-24 13:55 ` David Marchand
2022-08-25  9:55   ` Kevin Traynor

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=20220824095816.1449620-1-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=bluca@debian.org \
    --cc=david.marchand@redhat.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;
as well as URLs for NNTP newsgroup(s).