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 BDEB4805D for ; Mon, 15 Dec 2014 12:27:38 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 15 Dec 2014 03:27:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="429059983" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by FMSMGA003.fm.intel.com with ESMTP; 15 Dec 2014 03:16:36 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.213]) by IRSMSX104.ger.corp.intel.com ([169.254.5.209]) with mapi id 14.03.0195.001; Mon, 15 Dec 2014 11:27:35 +0000 From: "Wodkowski, PawelX" To: Thomas Monjalon , "Qiu, Michael" Thread-Topic: [dpdk-dev] error: value computed is not used Thread-Index: AdASxiisLi704rCnRgagZfyMuDIXlQANP/TQAVaWb4AAALwbsA== Date: Mon, 15 Dec 2014 11:27:35 +0000 Message-ID: References: <533710CFB86FA344BFBF2D6802E60286C9D989@SHSMSX101.ccr.corp.intel.com> <533710CFB86FA344BFBF2D6802E60286C9DB8B@SHSMSX101.ccr.corp.intel.com> <19703944.gAxOdpYSXo@xps13> In-Reply-To: <19703944.gAxOdpYSXo@xps13> 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 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: Mon, 15 Dec 2014 11:27:39 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Monday, December 15, 2014 11:55 AM > To: Wodkowski, PawelX; Qiu, Michael > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] error: value computed is not used >=20 > 2014-12-08 15:26, Wodkowski, PawelX: > > From: Qiu, Michael > > > 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 no= t 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 p= ass( 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 th= rowing > > > > everything else (including returned value). In that case error is n= ot > > > > produced (I think this is a bug in compiler). In other case it is c= omputing > > > > some value calling memcpy or rte_ memcpy and you should at least > > > > explicitly throw it away by casting to void. I like solution with s= tatic > > > > > > Actually, I try to pass "n" as a Int value like 4, it still report th= is > > > error :) > > > > My workaround was: > > (void) rte_memcpy(...); > > > > But this is only a workaround. >=20 > It's not so bad. >=20 > > > > inline but someone else should spoke about possible side effects. > > > > > > Yes, but as I know inline is better than macros. >=20 > From the GCC manual: > " > You may use this built-in function in either a macro or an inline functio= n. > However, if you use it in an inlined function and pass an argument of the > function as the argument to the built-in, GCC never returns 1 when you ca= ll > the inline function with a string constant or compound literal and does n= ot > return 1 when you pass a constant numeric value to the inline function un= less > you specify the -O option. > " >=20 > It seems the "inline fix" cannot be used. >=20 > I'm going to send a patch with Pawel's workaround. And something like this? diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/libr= te_eal/common/include/arch/x86/rte_memcpy.h index 290c5cd..906c911 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h @@ -168,10 +168,10 @@ rte_mov128(dst + 128, src + 128); } =20 diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/libr= te_eal/common/include/arch/x86/rte_memcpy.h index 290c5cd..c3e8b81 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h @@ -169,9 +169,9 @@ } =20 #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)); }) =20 static inline void * rte_memcpy_func(void *dst, const void *src, size_t n) Thomas, can you check build with EXTRA_CFLAG=3D'-Wunused-value'.=20 /home/pwodkowx/grizzly/dpdk_org_declan_v3_mode4_v2/lib/librte_pmd_ixgbe/ixg= be/ixgbe_common.c: In function 'ixgbe_host_interface_command': /home/pwodkowx/grizzly/dpdk_org_declan_v3_mode4_v2/lib/librte_pmd_ixgbe/ixg= be/ixgbe_common.c:4429:3: error: statement with no effect [-Werror=3Dunused= -value] /home/pwodkowx/grizzly/dpdk_org_declan_v3_mode4_v2/lib/librte_pmd_ixgbe/ixg= be/ixgbe_common.c:4448:3: error: statement with no effect [-Werror=3Dunused= -value]