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

Wodkowski, PawelX pawelx.wodkowski at intel.com
Mon Dec 8 12:00:41 CET 2014


> lib/librte_pmd_enic/enic_main.c: In function 'enic_set_rsskey':
> lib/librte_pmd_enic/enic_main.c:862:2: error: value computed is not used
> 
> I dig out that, it was ome issue of  the macros rte_memcpy()
> #define rte_memcpy(dst, src, n)              \
>         ((__builtin_constant_p(n)) ?          \
>         memcpy((dst), (src), (n)) :          \
>         rte_memcpy_func((dst), (src), (n)))
> 
> When I use only (n) instead of (__builtin_constant_p(n), it will pass( I
> know that it was incorrect, just a experiment).
> 
> But I try to use inline function instead of macros:
> static inline void * rte_memcpy(void *dst, const void *src, size_t n)
> {
>         return __builtin_constant_p(n) ? memcpy(dst, src, n) :
>                                          rte_memcpy_func(dst, src, n);
> }
> 
> It will pass:), and works, this could be one potential workaround fix.
> 
> Who knows why? The root cause is what?
> 
> I've no idea about this.
> 

I got the same issue while ago. I don't remember exactly everything
but my conclusion was that there was some bug in compiler. I think,
when 'n' I constant and/or small compiler is inlining memcpy and throwing
everything else (including returned value). In that case error is not
produced (I think this is a bug in compiler). In other case it is computing
some value calling memcpy or rte_ memcpy and you should at least
explicitly throw it away by casting to void. I like solution with static
inline but someone else should spoke about possible side effects.

Pawel



More information about the dev mailing list