diff mbox series

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

Message ID 20201022105701.29650-1-elibr@nvidia.com
State Accepted
Headers show
Series [ovs-dev,dpdk-latest,V3,1/1] sparse: Fix __ATOMIC_* redefinition errors | expand

Commit Message

Eli Britstein Oct. 22, 2020, 10:57 a.m. UTC
In sparse commit [1], __ATOMIC_* defines were introduced, which cause
redefinition errors. Commits [2],[3] introduced builtin __atomic_*
functions that are defined in OVS.
Wrap OVS defines with #ifndef to fix it. We assume using either a sparse
version before all [1],[2],[3], or a version after them.

[1] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=cf8f104749f5
[2] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=7cdf84691f33
[3] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=f42e2afa9ed0

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

Comments

David Marchand Oct. 22, 2020, 8:12 p.m. UTC | #1
On Thu, Oct 22, 2020 at 12:57 PM Eli Britstein <elibr@nvidia.com> wrote:
>
> In sparse commit [1], __ATOMIC_* defines were introduced, which cause
> redefinition errors. Commits [2],[3] introduced builtin __atomic_*
> functions that are defined in OVS.
> Wrap OVS defines with #ifndef to fix it. We assume using either a sparse
> version before all [1],[2],[3], or a version after them.
>
> [1] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=cf8f104749f5
> [2] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=7cdf84691f33
> [3] https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=f42e2afa9ed0
>
> Tested-at: https://travis-ci.org/github/elibritstein/OVS/builds/737943898
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> ---
>  include/sparse/rte_mbuf.h        | 2 ++
>  include/sparse/rte_trace_point.h | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h
> index ee461f91e..981cdb441 100644
> --- a/include/sparse/rte_mbuf.h
> +++ b/include/sparse/rte_mbuf.h
> @@ -18,10 +18,12 @@
>  #endif
>
>  /* sparse doesn't know about gcc atomic builtins. */
> +#ifndef __ATOMIC_ACQ_REL
>  #define __ATOMIC_ACQ_REL 0
>  #define __ATOMIC_RELAXED 1
>  #define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val))
>  #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..803923275 100644
> --- a/include/sparse/rte_trace_point.h
> +++ b/include/sparse/rte_trace_point.h
> @@ -18,8 +18,10 @@
>  #endif
>
>  /* sparse doesn't know about gcc atomic builtins. */
> +#ifndef __ATOMIC_ACQUIRE
>  #define __ATOMIC_ACQUIRE 0
>  #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
>

LGTM.
Acked-by: David Marchand <david.marchand@redhat.com>
Stokes, Ian Oct. 30, 2020, 1:47 p.m. UTC | #2
> On Thu, Oct 22, 2020 at 12:57 PM Eli Britstein <elibr@nvidia.com> wrote:
> >
> > In sparse commit [1], __ATOMIC_* defines were introduced, which cause
> > redefinition errors. Commits [2],[3] introduced builtin __atomic_*
> > functions that are defined in OVS.
> > Wrap OVS defines with #ifndef to fix it. We assume using either a sparse
> > version before all [1],[2],[3], or a version after them.
> >
> > [1]
> https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=cf8f104749
> f5
> > [2]
> https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=7cdf84691f
> 33
> > [3]
> https://git.kernel.org/pub/scm/devel/sparse/sparse.git/commit/?id=f42e2afa9e
> d0
> >
> > Tested-at: https://travis-ci.org/github/elibritstein/OVS/builds/737943898
> > Signed-off-by: Eli Britstein <elibr@nvidia.com>
> > ---
> >  include/sparse/rte_mbuf.h        | 2 ++
> >  include/sparse/rte_trace_point.h | 2 ++
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h
> > index ee461f91e..981cdb441 100644
> > --- a/include/sparse/rte_mbuf.h
> > +++ b/include/sparse/rte_mbuf.h
> > @@ -18,10 +18,12 @@
> >  #endif
> >
> >  /* sparse doesn't know about gcc atomic builtins. */
> > +#ifndef __ATOMIC_ACQ_REL
> >  #define __ATOMIC_ACQ_REL 0
> >  #define __ATOMIC_RELAXED 1
> >  #define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val))
> >  #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..803923275 100644
> > --- a/include/sparse/rte_trace_point.h
> > +++ b/include/sparse/rte_trace_point.h
> > @@ -18,8 +18,10 @@
> >  #endif
> >
> >  /* sparse doesn't know about gcc atomic builtins. */
> > +#ifndef __ATOMIC_ACQUIRE
> >  #define __ATOMIC_ACQUIRE 0
> >  #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
> >
> 
> LGTM.
> Acked-by: David Marchand <david.marchand@redhat.com>
> 
> 
> --
> David Marchand

Thanks all, I've rebased dpdk-latest on master and pushed this commit.

Regards
Ian
diff mbox series

Patch

diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h
index ee461f91e..981cdb441 100644
--- a/include/sparse/rte_mbuf.h
+++ b/include/sparse/rte_mbuf.h
@@ -18,10 +18,12 @@ 
 #endif
 
 /* sparse doesn't know about gcc atomic builtins. */
+#ifndef __ATOMIC_ACQ_REL
 #define __ATOMIC_ACQ_REL 0
 #define __ATOMIC_RELAXED 1
 #define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val))
 #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..803923275 100644
--- a/include/sparse/rte_trace_point.h
+++ b/include/sparse/rte_trace_point.h
@@ -18,8 +18,10 @@ 
 #endif
 
 /* sparse doesn't know about gcc atomic builtins. */
+#ifndef __ATOMIC_ACQUIRE
 #define __ATOMIC_ACQUIRE 0
 #define __atomic_load_n(p, memorder) *(p)
+#endif
 
 /* Get actual <rte_trace_point.h> definitions for us to annotate and
  * build on. */