trace: fix C++ compilation
authorPawel Wodkowski <pawelwod@gmail.com>
Wed, 12 Aug 2020 09:51:50 +0000 (15:21 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 17 Sep 2020 09:13:44 +0000 (11:13 +0200)
trace_mem is declared as 'void *' which triggers following error:
'...invalid conversion from ‘void*’ to ‘__rte_trace_header*’
[-fpermissive]...'

Fix this by adding proper typecast to 'struct __rte_trace_header *'.

Fixes: ebaee6409702 ("trace: simplify trace point headers")
Cc: stable@dpdk.org
Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Nicolas Chautru <nicolas.chautru@intel.com>
lib/librte_eal/include/rte_trace_point.h

index b039602..e226f07 100644 (file)
@@ -298,13 +298,14 @@ RTE_DECLARE_PER_LCORE(void *, trace_mem);
 static __rte_always_inline void *
 __rte_trace_mem_get(uint64_t in)
 {
-       struct __rte_trace_header *trace = RTE_PER_LCORE(trace_mem);
+       struct __rte_trace_header *trace =
+               (struct __rte_trace_header *)(RTE_PER_LCORE(trace_mem));
        const uint16_t sz = in & __RTE_TRACE_FIELD_SIZE_MASK;
 
        /* Trace memory is not initialized for this thread */
        if (unlikely(trace == NULL)) {
                __rte_trace_mem_per_thread_alloc();
-               trace = RTE_PER_LCORE(trace_mem);
+               trace = (struct __rte_trace_header *)(RTE_PER_LCORE(trace_mem));
                if (unlikely(trace == NULL))
                        return NULL;
        }