From: Gowrishankar Muthukrishnan <gowrishanka...@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 <gowrishanka...@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

Reply via email to