From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 78E3D4C74 for ; Fri, 30 Mar 2018 17:26:33 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 148088182D27; Fri, 30 Mar 2018 15:26:33 +0000 (UTC) Received: from [10.36.112.19] (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2C2D215CDC6; Fri, 30 Mar 2018 15:26:31 +0000 (UTC) To: Ferruh Yigit , Andrew Rybchenko , dev@dpdk.org, xiangxia.m.yue@gmail.com, thomas@monjalon.net, tredaelli@redhat.com References: <20180330151641.20715-1-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <6255e836-127b-465b-2be0-74451081561d@redhat.com> Date: Fri, 30 Mar 2018 17:26:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 30 Mar 2018 15:26:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 30 Mar 2018 15:26:33 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [PATCH] vhost: fix build issue caused by unchecked returned values X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Mar 2018 15:26:34 -0000 On 03/30/2018 05:21 PM, Ferruh Yigit wrote: > On 3/30/2018 4:18 PM, Andrew Rybchenko wrote: >> On 03/30/2018 06:16 PM, Maxime Coquelin wrote: >>> This patch fixes below build issue seen with some compilers >>> or build options: >>> >>> lib/librte_vhost/fd_man.c: In function ‘fdset_pipe_read_cb’: >>> lib/librte_vhost/fd_man.c:284:2: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result] >>> read(readfd, charbuf, sizeof(charbuf)); >>> ^ >>> lib/librte_vhost/fd_man.c: In function ‘fdset_pipe_notify’: >>> lib/librte_vhost/fd_man.c:324:2: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] >>> write(fdset->u.writefd, "1", 1); >>> ^ >>> >>> Reported-by: Andrew Rybchenko >>> Signed-off-by: Tonghao Zhang >>> Signed-off-by: Maxime Coquelin >>> --- >>> lib/librte_vhost/fd_man.c | 17 +++++++++++++++-- >>> 1 file changed, 15 insertions(+), 2 deletions(-) >>> >>> diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c >>> index ca1ba2622..1f9e22f96 100644 >>> --- a/lib/librte_vhost/fd_man.c >>> +++ b/lib/librte_vhost/fd_man.c >>> @@ -281,7 +281,13 @@ fdset_pipe_read_cb(int readfd, void *dat __rte_unused, >>> int *remove __rte_unused) >>> { >>> char charbuf[16]; >>> - read(readfd, charbuf, sizeof(charbuf)); >>> + int r = read(readfd, charbuf, sizeof(charbuf)); >>> + /* >>> + * Just an optimization, we don't care if read() failed >>> + * so ignore explicitly its return value to make the >>> + * compiler happy >>> + */ >>> + RTE_SET_USED(r); >>> } >>> >>> void >>> @@ -321,5 +327,12 @@ fdset_pipe_init(struct fdset *fdset) >>> void >>> fdset_pipe_notify(struct fdset *fdset) >>> { >>> - write(fdset->u.writefd, "1", 1); >>> + int r = write(fdset->u.writefd, "1", 1); >>> + /* >>> + * Just an optimization, we don't care if read() failed >> >> read() -> write() > > I can fix while applying. Thanks! > >> >>> + * so ignore explicitly its return value to make the >>> + * compiler happy >>> + */ >>> + RTE_SET_USED(r); >>> + >>> } >> >