[PATCH v4 1/7] eal: fix header build with C++

Joyce Kong Joyce.Kong at arm.com
Mon Feb 14 10:30:52 CET 2022


<snip>

> Subject: [PATCH v4 1/7] eal: fix header build with C++
>
> C++ files could not include some headers because:
>
> * "new" is a keyword in C++, so can't be a variable name
> * there is no automatic casting to/from void *
>
> Fixes: 184104fc6121 ("ticketlock: introduce fair ticket based locking")
> Fixes: 032a7e5499a0 ("trace: implement provider payload")
> Cc: joyce.kong at arm.com
> Cc: jerinj at marvell.com
> Cc: stable at dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Joyce Kong <joyce.kong at arm.com>

> ---
>  lib/eal/include/generic/rte_ticketlock.h | 14 +++++++-------
>  lib/eal/include/rte_trace_point.h        |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/lib/eal/include/generic/rte_ticketlock.h
> b/lib/eal/include/generic/rte_ticketlock.h
> index c1b8808f51..693c67b517 100644
> --- a/lib/eal/include/generic/rte_ticketlock.h
> +++ b/lib/eal/include/generic/rte_ticketlock.h
> @@ -91,13 +91,13 @@ rte_ticketlock_unlock(rte_ticketlock_t *tl)  static
> inline int  rte_ticketlock_trylock(rte_ticketlock_t *tl)  {
> -     rte_ticketlock_t old, new;
> -     old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
> -     new.tickets = old.tickets;
> -     new.s.next++;
> -     if (old.s.next == old.s.current) {
> -             if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets,
> -                 new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
> +     rte_ticketlock_t oldl, newl;
> +     oldl.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
> +     newl.tickets = oldl.tickets;
> +     newl.s.next++;
> +     if (oldl.s.next == oldl.s.current) {
> +             if (__atomic_compare_exchange_n(&tl->tickets, &oldl.tickets,
> +                 newl.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
>                       return 1;
>       }
>
> diff --git a/lib/eal/include/rte_trace_point.h
> b/lib/eal/include/rte_trace_point.h
> index e226f073f7..0f8700974f 100644
> --- a/lib/eal/include/rte_trace_point.h
> +++ b/lib/eal/include/rte_trace_point.h
> @@ -370,7 +370,7 @@ do { \
>  do { \
>       if (unlikely(in == NULL)) \
>               return; \
> -     rte_strscpy(mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX); \
> +     rte_strscpy((char *)mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX);
> \
>       mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX);
> \  } while (0)
>
> --
> 2.32.0

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the stable mailing list