From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 9C1E38059 for ; Tue, 16 Dec 2014 01:50:04 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 15 Dec 2014 16:49:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="429383919" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by FMSMGA003.fm.intel.com with ESMTP; 15 Dec 2014 16:38:37 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 16 Dec 2014 08:49:39 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0195.001; Tue, 16 Dec 2014 08:49:38 +0800 From: "Qiu, Michael" To: Thomas Monjalon , "Wodkowski, PawelX" Thread-Topic: [dpdk-dev] error: value computed is not used Thread-Index: AdASxiisLi704rCnRgagZfyMuDIXlQ== Date: Tue, 16 Dec 2014 00:49:37 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CA0138@SHSMSX101.ccr.corp.intel.com> References: <533710CFB86FA344BFBF2D6802E60286C9D989@SHSMSX101.ccr.corp.intel.com> <533710CFB86FA344BFBF2D6802E60286C9DB8B@SHSMSX101.ccr.corp.intel.com> <19703944.gAxOdpYSXo@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] error: value computed is not used X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2014 00:50:05 -0000 On 12/15/2014 6:55 PM, Thomas Monjalon wrote:=0A= > 2014-12-08 15:26, Wodkowski, PawelX:=0A= >> From: Qiu, Michael=0A= >>> On 2014/12/8 19:00, Wodkowski, PawelX wrote:=0A= >>>>> lib/librte_pmd_enic/enic_main.c: In function 'enic_set_rsskey':=0A= >>>>> lib/librte_pmd_enic/enic_main.c:862:2: error: value computed is not u= sed=0A= >>>>>=0A= >>>>> I dig out that, it was ome issue of the macros rte_memcpy()=0A= >>>>> #define rte_memcpy(dst, src, n) \=0A= >>>>> ((__builtin_constant_p(n)) ? \=0A= >>>>> memcpy((dst), (src), (n)) : \=0A= >>>>> rte_memcpy_func((dst), (src), (n)))=0A= >>>>>=0A= >>>>> When I use only (n) instead of (__builtin_constant_p(n), it will pass= ( I=0A= >>>>> know that it was incorrect, just a experiment).=0A= >>>>>=0A= >>>>> But I try to use inline function instead of macros:=0A= >>>>> static inline void * rte_memcpy(void *dst, const void *src, size_t n)= =0A= >>>>> {=0A= >>>>> return __builtin_constant_p(n) ? memcpy(dst, src, n) :=0A= >>>>> rte_memcpy_func(dst, src, n)= ;=0A= >>>>> }=0A= >>>>>=0A= >>>>> It will pass:), and works, this could be one potential workaround fix= .=0A= >>>>>=0A= >>>>> Who knows why? The root cause is what?=0A= >>>>>=0A= >>>>> I've no idea about this.=0A= >>>>>=0A= >>>> I got the same issue while ago. I don't remember exactly everything=0A= >>>> but my conclusion was that there was some bug in compiler. I think,=0A= >>>> when 'n' I constant and/or small compiler is inlining memcpy and throw= ing=0A= >>>> everything else (including returned value). In that case error is not= =0A= >>>> produced (I think this is a bug in compiler). In other case it is comp= uting=0A= >>>> some value calling memcpy or rte_ memcpy and you should at least=0A= >>>> explicitly throw it away by casting to void. I like solution with stat= ic=0A= >>> Actually, I try to pass "n" as a Int value like 4, it still report this= =0A= >>> error :)=0A= >> My workaround was:=0A= >> (void) rte_memcpy(...);=0A= >>=0A= >> But this is only a workaround.=0A= > It's not so bad.=0A= >=0A= >>>> inline but someone else should spoke about possible side effects.=0A= >>> Yes, but as I know inline is better than macros.=0A= > From the GCC manual:=0A= > "=0A= > You may use this built-in function in either a macro or an inline functio= n.=0A= > However, if you use it in an inlined function and pass an argument of the= =0A= > function as the argument to the built-in, GCC never returns 1 when you ca= ll=0A= > the inline function with a string constant or compound literal and does n= ot=0A= > return 1 when you pass a constant numeric value to the inline function un= less=0A= > you specify the -O option.=0A= > "=0A= >=0A= > It seems the "inline fix" cannot be used.=0A= =0A= Actually, it can be used and work, as -O option is always specified(I've=0A= test before).=0A= =0A= But it should be a issue and not safe.=0A= =0A= Thanks,=0A= Michael=0A= > I'm going to send a patch with Pawel's workaround.=0A= >=0A= =0A=