From c0a1472e2272045d6520eb92f6a5438e2323b79b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 25 Oct 2012 14:43:10 -0700 Subject: Fix compiler warnings in some NPTL tests. --- nptl/tst-cond25.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'nptl/tst-cond25.c') diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c index 370cd67d1c..cdc129d5f3 100644 --- a/nptl/tst-cond25.c +++ b/nptl/tst-cond25.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -87,13 +88,13 @@ waiter (void *u) { int i, ret = 0; void *tret = NULL; - int seq = (int)u; + int seq = (uintptr_t) u; for (i = 0; i < ITERS / NUM; i++) { if ((ret = pthread_mutex_lock (&mutex)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret)); goto out; } @@ -101,14 +102,14 @@ waiter (void *u) if ((ret = pthread_cond_wait (&cond, &mutex)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("waiter[%u]:wait failed: %s\n", seq, strerror (ret)); goto unlock_out; } if ((ret = pthread_mutex_unlock (&mutex)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret)); goto out; } @@ -130,7 +131,7 @@ timed_waiter (void *u) { int i, ret; void *tret = NULL; - int seq = (int)u; + int seq = (uintptr_t) u; for (i = 0; i < ITERS / NUM; i++) { @@ -138,7 +139,7 @@ timed_waiter (void *u) if ((ret = clock_gettime(CLOCK_REALTIME, &ts)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("%u:clock_gettime failed: %s\n", seq, strerror (errno)); goto out; } @@ -146,7 +147,7 @@ timed_waiter (void *u) if ((ret = pthread_mutex_lock (&mutex)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret)); goto out; } @@ -155,13 +156,13 @@ timed_waiter (void *u) /* We should not time out either. */ if ((ret = pthread_cond_timedwait (&cond, &mutex, &ts)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("waiter[%u]:timedwait failed: %s\n", seq, strerror (ret)); goto unlock_out; } if ((ret = pthread_mutex_unlock (&mutex)) != 0) { - tret = (void *)1; + tret = (void *) (uintptr_t) 1; printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret)); goto out; } @@ -195,7 +196,8 @@ do_test_wait (thr_func f) goto out; } - if ((ret = pthread_mutexattr_setprotocol (&attr, PTHREAD_PRIO_INHERIT)) != 0) + if ((ret = pthread_mutexattr_setprotocol (&attr, + PTHREAD_PRIO_INHERIT)) != 0) { printf ("mutexattr_setprotocol failed: %s\n", strerror (ret)); goto out; @@ -214,7 +216,8 @@ do_test_wait (thr_func f) } for (j = 0; j < NUM; j++) - if ((ret = pthread_create (&w[j], NULL, f, (void *)j)) != 0) + if ((ret = pthread_create (&w[j], NULL, + f, (void *) (uintptr_t) j)) != 0) { printf ("waiter[%d]: create failed: %s\n", j, strerror (ret)); goto out; -- cgit 1.4.1