[igt-dev] [PATCH i-g-t 1/4] tests/sw_sync: fix pthread start_routine declaration

Lucas De Marchi lucas.demarchi at intel.com
Wed Jun 6 22:27:38 UTC 2018


pthread_create() expects a void *(*start_routine) (void *). Fix warning
the following warning on gcc 8:

../tests/sw_sync.c:773:37: warning: cast between incompatible function types from ‘int (*)(void *)’ to ‘void * (*)(void *)’ [-Wcast-function-type]
   pthread_create(&threads[i], NULL, (void * (*)(void *))
                                     ^
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 tests/sw_sync.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 20dfbbb9..afe58b0c 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -669,7 +669,7 @@ static struct {
 	pthread_mutex_t lock;
 } test_mpsc_data;
 
-static int mpsc_producer_thread(void *d)
+static void *mpsc_producer_thread(void *d)
 {
 	int id = (long)d;
 	int fence, i;
@@ -702,7 +702,7 @@ static int mpsc_producer_thread(void *d)
 		close(fence);
 	}
 
-	return 0;
+	return NULL;
 }
 
 static int mpsc_consumer_thread(void)
-- 
2.17.1



More information about the igt-dev mailing list