DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] error: value computed is not used
Date: Mon, 15 Dec 2014 17:40:04 +0100	[thread overview]
Message-ID: <3419060.OKF5rOINLD@xps13> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB977258213C0D6A@IRSMSX105.ger.corp.intel.com>

2014-12-15 16:00, Ananyev, Konstantin:
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> > 2014-12-15 13:47, Wodkowski, PawelX:
> > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > > 2014-12-15 11:27, Wodkowski, PawelX:
> > > > > Thomas, can you check build with EXTRA_CFLAG='-Wunused-value'.
> > > >
> > > > You mean EXTRA_CFLAGS (with a S).
> > > > It fails in many locations.
> > > > What's your point?
> > >
> > > I am just asking if this is an typo, error or intend to do statements with no effects like bellow.
> > >
> > > ixgbe_common.c:4429:3: error: statement with no effect [-Werror=unused-value]
> > >
> > > 4426:	/* first pull in the header so we know the buffer length */
> > > 4427:	for (bi = 0; bi < dword_len; bi++) {
> > > 4428:		buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
> > > 4429:		IXGBE_LE32_TO_CPUS(&buffer[bi]); // <------ here
> > > 4430	}
> > 
> > It's an intent. On big endian CPU, this has an effect.
> 
> Hmm, I think there is a bug in lib/librte_pmd_ixgbe/ixgbe/ixgbe_osdep.h:
> #define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
> 
> It probably should be:
> #define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(*(_i))
> 
> Not much point to do byte swapping for the pointer.
> And that what ixgbe BSD driver is doing.
> 
> Though I still not sure why it is needed here, as the computed value is not used anyway.
> What the author probably meant to do:
> buffer[bi] = rte_le_to_cpu_32 (buffer[bi]);
> To achieve that we need:
> #define IXGBE_LE32_TO_CPUS(x) (*(x) = rte_le_to_cpu_32(*(x)))
> Correct?

Oh yes, you and Pawel are probably right.
I was focusing on definition of IXGBE_LE32_TO_CPUS and have not seen the bug.

> > > > Do you to support -Wunused-value?
> > >
> > > No, I just turned this on to check above change and was surprised what happened.
> > 
> > Honestly, I don't know if there is a good fix for this warning.

-- 
Thomas

  reply	other threads:[~2014-12-15 16:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-08  9:05 Qiu, Michael
2014-12-08 11:00 ` Wodkowski, PawelX
2014-12-08 15:23   ` Qiu, Michael
2014-12-08 15:26     ` Wodkowski, PawelX
2014-12-15 10:54       ` Thomas Monjalon
2014-12-15 11:07         ` [dpdk-dev] [PATCH] enic: fix build on SUSE 11 Thomas Monjalon
2014-12-15 11:27         ` [dpdk-dev] error: value computed is not used Wodkowski, PawelX
2014-12-15 13:26           ` Thomas Monjalon
2014-12-15 13:47             ` Wodkowski, PawelX
2014-12-15 14:16               ` Thomas Monjalon
2014-12-15 15:44                 ` Wodkowski, PawelX
2014-12-15 16:35                   ` Ananyev, Konstantin
2014-12-15 16:00                 ` Ananyev, Konstantin
2014-12-15 16:40                   ` Thomas Monjalon [this message]
2014-12-15 17:03                 ` Jastrzebski, MichalX K
2014-12-16  0:49         ` Qiu, Michael
2014-12-09  9:19 ` Qiu, Michael
2014-12-10  9:26 ` Qiu, Michael

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=3419060.OKF5rOINLD@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.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;
as well as URLs for NNTP newsgroup(s).