[dpdk-dev] test: fix wrong function type casing

Message ID 20180510082920.8779-1-jerin.jacob@caviumnetworks.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jerin Jacob May 10, 2018, 8:29 a.m. UTC
  make flip_bit() as lcore_function_t.
Found this issue with gcc 8.1

test/test/test_distributor_perf.c: In function ‘time_cache_line_switch’:
test/test/test_distributor_perf.c:59:24: warning: cast between
incompatible function types from ‘void (*)(volatile uint64_t *)’ {aka
‘void (*) (volatile long unsigned int *)’} to ‘int (*)(void *)’
[-Wcast-function-type] rte_eal_remote_launch((lcore_function_t *)flip_bit,
&data[0], slaveid);

Cc: bruce.richardson@intel.com
Cc: stable@dpdk.org

Fixes: c3eabff124e6 ("distributor: add unit tests")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 test/test/test_distributor_perf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo May 10, 2018, 3:58 p.m. UTC | #1
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jerin Jacob

> Sent: Thursday, May 10, 2018 9:29 AM

> To: dev@dpdk.org

> Cc: thomas@monjalon.net; andy@warmcat.com; Jerin Jacob

> <jerin.jacob@caviumnetworks.com>; Richardson, Bruce

> <bruce.richardson@intel.com>; stable@dpdk.org

> Subject: [dpdk-dev] [PATCH] test: fix wrong function type casing

> 

> make flip_bit() as lcore_function_t.

> Found this issue with gcc 8.1

> 

> test/test/test_distributor_perf.c: In function ‘time_cache_line_switch’:

> test/test/test_distributor_perf.c:59:24: warning: cast between incompatible

> function types from ‘void (*)(volatile uint64_t *)’ {aka ‘void (*) (volatile long

> unsigned int *)’} to ‘int (*)(void *)’

> [-Wcast-function-type] rte_eal_remote_launch((lcore_function_t *)flip_bit,

> &data[0], slaveid);

> 

> Cc: bruce.richardson@intel.com

> Cc: stable@dpdk.org

> 

> Fixes: c3eabff124e6 ("distributor: add unit tests")

> 

> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---


Already fixed here:

http://dpdk.org/dev/patchwork/patch/39717/
  

Patch

diff --git a/test/test/test_distributor_perf.c b/test/test/test_distributor_perf.c
index 557715e13..edf1998ab 100644
--- a/test/test/test_distributor_perf.c
+++ b/test/test/test_distributor_perf.c
@@ -31,7 +31,7 @@  struct worker_stats worker_stats[RTE_MAX_LCORE];
  * worker thread used for testing the time to do a round-trip of a cache
  * line between two cores and back again
  */
-static void
+static int
 flip_bit(volatile uint64_t *arg)
 {
 	uint64_t old_val = 0;
@@ -41,6 +41,7 @@  flip_bit(volatile uint64_t *arg)
 		old_val = *arg;
 		*arg = 0;
 	}
+	return 0;
 }
 
 /*