From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id DEAF11BAB4 for ; Thu, 10 May 2018 14:32:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2018 05:32:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,385,1520924400"; d="scan'208";a="54022702" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.222.32]) by fmsmga001.fm.intel.com with ESMTP; 10 May 2018 05:32:21 -0700 From: David Hunt To: dev@dpdk.org Cc: john.mcnamara@intel.com, David Hunt Date: Thu, 10 May 2018 06:31:12 +0100 Message-Id: <20180510053112.25491-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.0 Subject: [dpdk-dev] [PATCH] examples: fix typdef in performance thread app X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 12:32:24 -0000 The function pthread_create() expects void *(*func) (void *) for function pointer, however, lthread_func_t was defined as void (*func) (void *), so now gcc 8.1 warns that the cast is incorrect, causing a compilation failure. This patch changes the declaration of lthread_func_t from returning a void to returning a void*, and then changes the sample app in the relevant places that are affected by the typedef change. Fixes: 116819b9ed0d ("examples/performance-thread: add lthread subsystem") Signed-off-by: David Hunt --- examples/performance-thread/common/lthread.c | 3 ++- examples/performance-thread/common/lthread_api.h | 2 +- examples/performance-thread/l3fwd-thread/main.c | 15 ++++++++------- examples/performance-thread/pthread_shim/main.c | 4 ++-- .../pthread_shim/pthread_shim.c | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/examples/performance-thread/common/lthread.c b/examples/performance-thread/common/lthread.c index 7d76c8c46..0b60a42a8 100644 --- a/examples/performance-thread/common/lthread.c +++ b/examples/performance-thread/common/lthread.c @@ -320,13 +320,14 @@ struct lthread *lthread_current(void) /* * Tasklet to cancel a thread */ -static void +static void * _cancel(void *arg) { struct lthread *lt = (struct lthread *) arg; lt->state |= BIT(ST_LT_CANCELLED); lthread_detach(); + return NULL; } diff --git a/examples/performance-thread/common/lthread_api.h b/examples/performance-thread/common/lthread_api.h index ff245a082..a74680bf7 100644 --- a/examples/performance-thread/common/lthread_api.h +++ b/examples/performance-thread/common/lthread_api.h @@ -143,7 +143,7 @@ struct lthread_mutex; struct lthread_condattr; struct lthread_mutexattr; -typedef void (*lthread_func_t) (void *); +typedef void *(*lthread_func_t) (void *); /* * Define the size of stack for an lthread diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index f51e6b0fd..852965de9 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -1990,7 +1990,7 @@ cpu_load_collector(__rte_unused void *arg) { * * This loop is used to start empty scheduler on lcore. */ -static void +static void * lthread_null(__rte_unused void *args) { int lcore_id = rte_lcore_id(); @@ -2000,7 +2000,7 @@ lthread_null(__rte_unused void *args) } /* main processing loop */ -static void +static void * lthread_tx_per_ring(void *dummy) { int nb_rx; @@ -2053,7 +2053,7 @@ lthread_tx_per_ring(void *dummy) * This lthread is used to spawn one new lthread per ring from producers. * */ -static void +static void * lthread_tx(void *args) { struct lthread *lt; @@ -2100,7 +2100,7 @@ lthread_tx(void *args) } } -static void +static void * lthread_rx(void *dummy) { int ret; @@ -2124,7 +2124,7 @@ lthread_rx(void *dummy) if (rx_conf->n_rx_queue == 0) { RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", rte_lcore_id()); - return; + return NULL; } RTE_LOG(INFO, L3FWD, "Entering main Rx loop on lcore %u\n", rte_lcore_id()); @@ -2204,8 +2204,9 @@ lthread_rx(void *dummy) * This lthread loop spawns all rx and tx lthreads on master lcore */ -static void -lthread_spawner(__rte_unused void *arg) { +static void * +lthread_spawner(__rte_unused void *arg) +{ struct lthread *lt[MAX_THREAD]; int i; int n_thread = 0; diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c index 964ea252d..b64ca8b60 100644 --- a/examples/performance-thread/pthread_shim/main.c +++ b/examples/performance-thread/pthread_shim/main.c @@ -119,8 +119,8 @@ void *helloworld_pthread(void *arg) */ __thread pthread_t tid[HELLOW_WORLD_MAX_LTHREADS]; -static void initial_lthread(void *args); -static void initial_lthread(void *args __attribute__((unused))) +static void *initial_lthread(void *args); +static void *initial_lthread(void *args __attribute__((unused))) { int lcore = (int) rte_lcore_id(); /* diff --git a/examples/performance-thread/pthread_shim/pthread_shim.c b/examples/performance-thread/pthread_shim/pthread_shim.c index c31de4e9d..53f12437f 100644 --- a/examples/performance-thread/pthread_shim/pthread_shim.c +++ b/examples/performance-thread/pthread_shim/pthread_shim.c @@ -365,7 +365,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) int pthread_create(pthread_t *__restrict tid, const pthread_attr_t *__restrict attr, - void *(func) (void *), + lthread_func_t func, void *__restrict arg) { if (override) { @@ -390,7 +390,7 @@ pthread_create(pthread_t *__restrict tid, } } return lthread_create((struct lthread **)tid, lcore, - (void (*)(void *))func, arg); + func, arg); } return _sys_pthread_funcs.f_pthread_create(tid, attr, func, arg); } -- 2.17.0