diff mbox series

[v3] trace: fix compilation with C++

Message ID 20200812095150.1486443-1-skori@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series [v3] trace: fix compilation with C++ | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Sunil Kumar Kori Aug. 12, 2020, 9:51 a.m. UTC
From: Pawel Wodkowski <pawelwod@gmail.com>

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")

Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
---
v3:
 - fix subject.
v2:
 - Update proper typecasting.

 lib/librte_eal/include/rte_trace_point.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Chautru, Nicolas Sept. 11, 2020, 8:33 p.m. UTC | #1
Hi, 

> -----Original Message-----
> From: skori@marvell.com
> 
> 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")
> 
> Signed-off-by: Pawel Wodkowski <pawelwod@gmail.com>
> ---
> v3:
>  - fix subject.
> v2:
>  - Update proper typecasting.
> 
>  lib/librte_eal/include/rte_trace_point.h | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_eal/include/rte_trace_point.h
> b/lib/librte_eal/include/rte_trace_point.h
> index b03960277..6446f2f0f 100644
> --- a/lib/librte_eal/include/rte_trace_point.h
> +++ b/lib/librte_eal/include/rte_trace_point.h
> @@ -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;
>  	}
> --
> 2.25.1

We have to do the same fix on our end to build properly.

Acked-by: Nicolas Chautru <nicolas.chautru@intel.com>
David Marchand Sept. 17, 2020, 8:16 a.m. UTC | #2
On Wed, Aug 12, 2020 at 11:52 AM <skori@marvell.com> wrote:
>
> From: Pawel Wodkowski <pawelwod@gmail.com>
>
> 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")
>
> 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>

Applied, thanks.
diff mbox series

Patch

diff --git a/lib/librte_eal/include/rte_trace_point.h b/lib/librte_eal/include/rte_trace_point.h
index b03960277..6446f2f0f 100644
--- a/lib/librte_eal/include/rte_trace_point.h
+++ b/lib/librte_eal/include/rte_trace_point.h
@@ -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;
 	}