From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id C81D04C8F for ; Fri, 30 Mar 2018 17:19:00 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 64C179C0075; Fri, 30 Mar 2018 15:18:59 +0000 (UTC) Received: from [192.168.38.17] (84.52.114.114) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 30 Mar 2018 16:18:48 +0100 To: Maxime Coquelin , , , , , References: <20180330151641.20715-1-maxime.coquelin@redhat.com> From: Andrew Rybchenko Message-ID: Date: Fri, 30 Mar 2018 18:18:44 +0300 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: <20180330151641.20715-1-maxime.coquelin@redhat.com> Content-Language: en-GB X-Originating-IP: [84.52.114.114] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.100.1062-23750.003 X-TM-AS-Result: No--11.930600-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-MDID: 1522423140-nnwFNf8CZE3x Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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:19:01 -0000 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() > + * so ignore explicitly its return value to make the > + * compiler happy > + */ > + RTE_SET_USED(r); > + > }