From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gowrishankar Subject: [PATCH v2] eal/ppc: fix compilation error with a broken else clause Date: Tue, 30 Jan 2018 16:23:18 +0530 Message-ID: References: <0d242c92a3734252f6baa5592c56afeba254941b.1517301739.git.gowrishankar.m@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=y Content-Transfer-Encoding: 8bit Cc: Chao Zhu , Olivier Matz , thomas@monjalon.net, Gowrishankar Muthukrishnan To: dev@dpdk.org Return-path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id 0813B1B3E0 for ; Tue, 30 Jan 2018 11:53:25 +0100 (CET) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0UAoTWQ134862 for ; Tue, 30 Jan 2018 05:53:25 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ftq7q0abj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 Jan 2018 05:53:25 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Jan 2018 10:53:23 -0000 In-Reply-To: <0d242c92a3734252f6baa5592c56afeba254941b.1517301739.git.gowrishankar.m@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" From: Gowrishankar Muthukrishnan Calling rte_smp_{w/r}mb 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: d23a6bd04d ("eal/ppc: fix memory barrier for IBM POWER") Fixes: 05c3fd7110 ("eal/ppc: atomic operations for IBM Power") Signed-off-by: Gowrishankar Muthukrishnan --- v2: fixed ppc_64 atomic defines for a below error. 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 ‘update_tail’: /tmp/dpdk/lib/librte_ring/rte_ring_generic.h:75:2: error: ‘else’ without a previous ‘if’ else ^~~~ /tmp/dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'rte_ring.o' failed lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h index f38618f..39fce7b 100644 --- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h @@ -64,9 +64,9 @@ * occur before the STORE operations generated after. */ #ifdef RTE_ARCH_64 -#define rte_wmb() {asm volatile("lwsync" : : : "memory"); } +#define rte_wmb() asm volatile("lwsync" : : : "memory") #else -#define rte_wmb() {asm volatile("sync" : : : "memory"); } +#define rte_wmb() asm volatile("sync" : : : "memory") #endif /** @@ -76,9 +76,9 @@ * occur before the LOAD operations generated after. */ #ifdef RTE_ARCH_64 -#define rte_rmb() {asm volatile("lwsync" : : : "memory"); } +#define rte_rmb() asm volatile("lwsync" : : : "memory") #else -#define rte_rmb() {asm volatile("sync" : : : "memory"); } +#define rte_rmb() asm volatile("sync" : : : "memory") #endif #define rte_smp_mb() rte_mb() -- 1.9.1