From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gowrishankar.m@linux.vnet.ibm.com>
Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com
 [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id DD4DD1B3CA
 for <dev@dpdk.org>; Tue, 30 Jan 2018 09:48:53 +0100 (CET)
Received: from pps.filterd (m0098417.ppops.net [127.0.0.1])
 by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id
 w0U8iLGx083758 for <dev@dpdk.org>; Tue, 30 Jan 2018 03:48:53 -0500
Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106])
 by mx0a-001b2d01.pphosted.com with ESMTP id 2ftkuu4h8x-1
 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)
 for <dev@dpdk.org>; Tue, 30 Jan 2018 03:48:52 -0500
Received: from localhost
 by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only!
 Violators will be prosecuted
 for <dev@dpdk.org> from <gowrishankar.m@linux.vnet.ibm.com>;
 Tue, 30 Jan 2018 08:48:51 -0000
Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198)
 by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway:
 Authorized Use Only! Violators will be prosecuted; 
 Tue, 30 Jan 2018 08:48:48 -0000
Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com
 [9.149.105.232])
 by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id
 w0U8mm4749741896; Tue, 30 Jan 2018 08:48:48 GMT
Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1])
 by IMSVA (Postfix) with ESMTP id A0FA252043;
 Tue, 30 Jan 2018 07:41:04 +0000 (GMT)
Received: from chozha.in.ibm.com (unknown [9.124.35.17])
 by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id D112352041;
 Tue, 30 Jan 2018 07:41:03 +0000 (GMT)
From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
To: dev@dpdk.org
Cc: Olivier Matz <olivier.matz@6wind.com>, thomas@monjalon.net,
 Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Date: Tue, 30 Jan 2018 14:18:46 +0530
X-Mailer: git-send-email 1.9.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-TM-AS-GCONF: 00
x-cbid: 18013008-0040-0000-0000-0000040A4EF6
X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused
x-cbparentid: 18013008-0041-0000-0000-0000260DE5CD
Message-Id: <0d242c92a3734252f6baa5592c56afeba254941b.1517301739.git.gowrishankar.m@linux.vnet.ibm.com>
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, ,
 definitions=2018-01-30_05:, , signatures=0
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
 priorityscore=1501
 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0
 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000
 definitions=main-1801300111
Subject: [dpdk-dev] [PATCH] ring: fix compilation error with a broken else
	clause
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jan 2018 08:48:54 -0000

From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>

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 <gowrishankar.m@linux.vnet.ibm.com>
---

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 ‘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_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) {
 		rte_smp_wmb();
+	}
 	else
 		rte_smp_rmb();
 	/*
-- 
1.9.1