From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id E91761F7 for ; Mon, 15 Dec 2014 14:27:19 +0100 (CET) Received: by mail-wi0-f180.google.com with SMTP id n3so9015798wiv.7 for ; Mon, 15 Dec 2014 05:27:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=pnZSJgm9ZAXyXuecMybCagkhGbBw1v5NAzHMyclgIAU=; b=T5vTVb4H92b+2IB0UBpb+gmIRflOIkXasn4SqFE5AuT4Q2QsJSLv8XrGjli/sn1AG/ C//CqqiuJ8fwm8TLMxirQmLtHTXCmtzs53FWLDNBt3RNSx501TZQ6Bd8FYT7OJvhhkPz 9Tka0P/KE0klkKUQdF2Bvd3QWOIUxjRzpDbPaQHBZ0guclN64kjXoZm22oF3S5np4bvP hOjSv0AB3KOIX+waQ7IOYgppFgyYPJThP+fi+EASRtw1f0NI8bbKO4C3KDs5POUaO9oV vbqWkR2N/3LqmBfw7SDcT7L9o38zMOUuQ/SexJ4X5H8Ty4OsLH5dkOowmov1tR8vvryz H4JQ== X-Gm-Message-State: ALoCoQnCVCgwa3oxvGZcRsJvI6Y7qy9IAxeRn8K+hcH3n/zuDG46pahF02J1JapWknkF7ilnBrki X-Received: by 10.180.8.202 with SMTP id t10mr31931748wia.15.1418650039141; Mon, 15 Dec 2014 05:27:19 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id qd2sm13257672wic.19.2014.12.15.05.27.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Dec 2014 05:27:18 -0800 (PST) From: Thomas Monjalon To: "Wodkowski, PawelX" Date: Mon, 15 Dec 2014 14:26:53 +0100 Message-ID: <3427289.cFFhb9tNHS@xps13> Organization: 6WIND User-Agent: KMail/4.14.3 (Linux/3.17.4-1-ARCH; KDE/4.14.3; x86_64; ; ) In-Reply-To: References: <533710CFB86FA344BFBF2D6802E60286C9D989@SHSMSX101.ccr.corp.intel.com> <19703944.gAxOdpYSXo@xps13> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 13:27:20 -0000 2014-12-15 11:27, Wodkowski, PawelX: > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > 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 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 > > > > > > > > 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. > > > > It's not so bad. > > > > > > > inline but someone else should spoke about possible side effects. > > > > > > > > Yes, but as I know inline is better than macros. > > > > From the GCC manual: > > " > > You may use this built-in function in either a macro or an inline function. > > 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 call > > the inline function with a string constant or compound literal and does not > > return 1 when you pass a constant numeric value to the inline function unless > > you specify the -O option. > > " > > > > It seems the "inline fix" cannot be used. > > > > I'm going to send a patch with Pawel's workaround. > > 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: > 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? Do you to support -Wunused-value? -- Thomas