From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 6CB8D3F9 for ; Mon, 8 Dec 2014 16:27:14 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 08 Dec 2014 07:24:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,539,1413270000"; d="scan'208";a="620451004" Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by orsmga001.jf.intel.com with ESMTP; 08 Dec 2014 07:26:45 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.93]) by IRSMSX108.ger.corp.intel.com ([169.254.11.150]) with mapi id 14.03.0195.001; Mon, 8 Dec 2014 15:26:44 +0000 From: "Wodkowski, PawelX" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: error: value computed is not used Thread-Index: AdASxiisLi704rCnRgagZfyMuDIXlQANP/TQ Date: Mon, 8 Dec 2014 15:26:44 +0000 Message-ID: References: <533710CFB86FA344BFBF2D6802E60286C9D989@SHSMSX101.ccr.corp.intel.com> <533710CFB86FA344BFBF2D6802E60286C9DB8B@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C9DB8B@SHSMSX101.ccr.corp.intel.com> Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Mon, 08 Dec 2014 15:27:15 -0000 > -----Original Message----- > From: Qiu, Michael > Sent: Monday, December 08, 2014 4:24 PM > To: Wodkowski, PawelX; dev@dpdk.org > Subject: Re: error: value computed is not used >=20 > On 2014/12/8 19:00, Wodkowski, PawelX wrote: > >> 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 us= ed > >> > >> 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 throwi= ng > > 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 compu= ting > > some value calling memcpy or rte_ memcpy and you should at least > > explicitly throw it away by casting to void. I like solution with stati= c >=20 > Actually, I try to pass "n" as a Int value like 4, it still report this > error :) My workaround was: (void) rte_memcpy(...); But this is only a workaround. >=20 > > inline but someone else should spoke about possible side effects. >=20 > Yes, but as I know inline is better than macros. >=20 > Thanks, > Michael > > > > Pawel > > > >