From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] ring: fix compilation error with a broken else clause Date: Tue, 30 Jan 2018 10:13:16 +0100 Message-ID: <1695593.b6GUU2UBLd@xps> References: <0d242c92a3734252f6baa5592c56afeba254941b.1517301739.git.gowrishankar.m@linux.vnet.ibm.com> <20180130085607.GA29747@jerin> <39703dba-4199-79eb-6624-00496f20865c@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: Jerin Jacob , dev@dpdk.org, Olivier Matz To: gowrishankar muthukrishnan Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 6504F1B307 for ; Tue, 30 Jan 2018 10:14:06 +0100 (CET) In-Reply-To: <39703dba-4199-79eb-6624-00496f20865c@linux.vnet.ibm.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 30/01/2018 10:09, gowrishankar muthukrishnan: > On Tuesday 30 January 2018 02:26 PM, Jerin Jacob wrote: > > -----Original Message----- > >> Date: Tue, 30 Jan 2018 14:18:46 +0530 > >> From: Gowrishankar > >> To: dev@dpdk.org > >> CC: Olivier Matz , thomas@monjalon.net, > >> Gowrishankar Muthukrishnan > >> Subject: [dpdk-dev] [PATCH] ring: fix compilation error with a broken = else > >> clause > >> X-Mailer: git-send-email 1.9.1 > >> > >> From: Gowrishankar Muthukrishnan > >> > >> Calling rte_smp_wmb macro expands into a compound block, which > >> would break compiling a else clause following it, if that calling > >> place has been terminated already with ";", as in below code. > >> This patch adds { } around this macro to allow compiling else too. > >> > >> Fixes: git show c9fb3c6289 ("ring: move code in a new header file") > >> > >> Signed-off-by: Gowrishankar Muthukrishnan > >> --- > >> > >> Error in compiling source: > >> > >> In file included from /tmp/dpdk/lib/librte_ring/rte_ring.h:372:0, > >> from /tmp/dpdk/lib/librte_ring/rte_ring.c:90: > >> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h: In function =E2=80=98upd= ate_tail=E2=80=99: > >> /tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: =E2=80=98els= e=E2=80=99 without a previous =E2=80=98if=E2=80=99 > >> else > >> ^~~~ > >> /tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_r= ing.o' failed > >> > >> lib/librte_ring/rte_ring_generic.h | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_= ring_generic.h > >> index 8c3e65b..a668489 100644 > >> --- a/lib/librte_ring/rte_ring_generic.h > >> +++ b/lib/librte_ring/rte_ring_generic.h > >> @@ -70,8 +70,9 @@ > >> update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t= new_val, > >> uint32_t single, uint32_t enqueue) > >> { > >> - if (enqueue) > >> + if (enqueue) { > > Just wondering, Is it because of rte_smp_wmb() implementation of ppc64 = is > > not just correct? > > > > We had a similar fix for arm64. > > http://dpdk.org/browse/dpdk/commit/?id=3D59a3cae5305816b3739b4197d277f9= 455af53b9f > Thanks Jerin. Yes. Similar fix also works. I did not want to touch=20 > include/ at this time, as it is called at various places in source. > As same problem is seen in arm64, I think it is ok to go with your=20 > change. If so, I can send version 2 patch with similar change as you show= ed. Please send a patch for the fix in atomics.