[ovs-dev] [PATCH dpdk-latest 1/1] sparse: Fix __ATOMIC_* redefinition errors

Eli Britstein elibr at nvidia.com
Wed Oct 21 11:49:12 UTC 2020


In sparse commit [1], __ATOMIC_* defines were introduced, which cause
redefinition errors. Wrap OVS defines with #ifndef to fix it.

[1] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=cf8f104749f5bca36852989297af8cc19ff24d5f

Tested-at: https://travis-ci.org/github/elibritstein/OVS/builds/737660375
Signed-off-by: Eli Britstein <elibr at nvidia.com>
---
 include/sparse/rte_mbuf.h        | 8 ++++++++
 include/sparse/rte_trace_point.h | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h
index ee461f91e..172c9954a 100644
--- a/include/sparse/rte_mbuf.h
+++ b/include/sparse/rte_mbuf.h
@@ -18,10 +18,18 @@
 #endif
 
 /* sparse doesn't know about gcc atomic builtins. */
+#ifndef __ATOMIC_ACQ_REL
 #define __ATOMIC_ACQ_REL 0
+#endif
+#ifndef __ATOMIC_RELAXED
 #define __ATOMIC_RELAXED 1
+#endif
+#ifndef __atomic_add_fetch
 #define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val))
+#endif
+#ifndef __atomic_store_n
 #define __atomic_store_n(p, val, memorder) (*(p) = (val))
+#endif
 
 /* Get actual <rte_mbuf.h> definitions for us to annotate and build on. */
 #include_next <rte_mbuf.h>
diff --git a/include/sparse/rte_trace_point.h b/include/sparse/rte_trace_point.h
index c28f1c941..94bd54b25 100644
--- a/include/sparse/rte_trace_point.h
+++ b/include/sparse/rte_trace_point.h
@@ -18,8 +18,12 @@
 #endif
 
 /* sparse doesn't know about gcc atomic builtins. */
+#ifndef __ATOMIC_ACQUIRE
 #define __ATOMIC_ACQUIRE 0
+#endif
+#ifndef __atomic_load_n
 #define __atomic_load_n(p, memorder) *(p)
+#endif
 
 /* Get actual <rte_trace_point.h> definitions for us to annotate and
  * build on. */
-- 
2.28.0.546.g385c171



More information about the dev mailing list