[dpdk-dev] error: value computed is not used

Ananyev, Konstantin konstantin.ananyev at intel.com
Mon Dec 15 17:35:24 CET 2014



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Wodkowski, PawelX
> Sent: Monday, December 15, 2014 3:44 PM
> To: Thomas Monjalon
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] error: value computed is not used
> 
> > > > > And something like this?
> > > > >
> > > > >  #define rte_memcpy(dst, src, n)              \
> > > > > -	((__builtin_constant_p(n)) ?          \
> > > > > +	({ (__builtin_constant_p(n)) ?          \
> > > > >  	memcpy((dst), (src), (n)) :          \
> > > > > -	rte_memcpy_func((dst), (src), (n)))
> > > > > +	rte_memcpy_func((dst), (src), (n)); })
> > > >
> > > > What happens to the returned value after this change?
> > > > ptr = rte_memcpy(dst, src, n) + offset:
> > > >
> > > https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html#Statement-Exprs
> > >
> > > Whole expression should be 'void *' type (like *memcpy()) and it should work
> > > as usual (see maxint() example in above link). It is GCC extension.
> >
> > OK nice.
> > I didn't test it on SUSE 11 SP3. I assume you did it?
> I did not tested this, as this was only proposal. I only run build process and it pass.
> Patch proposal will be sent in a while.
> 
> > Please Pawel, could you send a proper patch quickly?
> > If nobody disagree, it'll be merged in RC5 today.
> >
> > > > > 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.
> >
> 
> If you see something what I am not, please ignore this part but for me this looks like it should be:
> tmp = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
> buffer[bi] = IXGBE_LE32_TO_CPUS (tmp);

Yep, same thought here, see my other mail on that subject.
Konstantin

> 
> Pawel


More information about the dev mailing list