diff --git a/winsup/testsuite/winsup.api/pthread/cancel2.c b/winsup/testsuite/winsup.api/pthread/cancel2.c index 14889313e..19902dc0f 100644 --- a/winsup/testsuite/winsup.api/pthread/cancel2.c +++ b/winsup/testsuite/winsup.api/pthread/cancel2.c @@ -96,7 +96,7 @@ mythread(void * arg) pthread_testcancel(); } - return (void *) result; + return (void *) (size_t)result; } int @@ -156,17 +156,17 @@ main() for (i = 1; i <= NUMTHREADS; i++) { int fail = 0; - int result = 0; + void *result = 0; - assert(pthread_join(t[i], (void **) &result) == 0); - fail = (result != (int) PTHREAD_CANCELED); + assert(pthread_join(t[i], &result) == 0); + fail = (result != PTHREAD_CANCELED); if (fail) { fprintf(stderr, "Thread %d: started %d: location %d: cancel type %s\n", i, threadbag[i].started, result, - ((result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED"); + (((int)(size_t)result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED"); } failed |= fail; } diff --git a/winsup/testsuite/winsup.api/pthread/cancel3.c b/winsup/testsuite/winsup.api/pthread/cancel3.c index 3ac03e4b6..832fe2e3f 100644 --- a/winsup/testsuite/winsup.api/pthread/cancel3.c +++ b/winsup/testsuite/winsup.api/pthread/cancel3.c @@ -61,7 +61,7 @@ static bag_t threadbag[NUMTHREADS + 1]; void * mythread(void * arg) { - int result = ((int)PTHREAD_CANCELED + 1); + void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1); bag_t * bag = (bag_t *) arg; assert(bag == &threadbag[bag->threadnum]); @@ -81,7 +81,7 @@ mythread(void * arg) for (bag->count = 0; bag->count < 100; bag->count++) Sleep(100); - return (void *) result; + return result; } int @@ -136,16 +136,16 @@ main() for (i = 1; i <= NUMTHREADS; i++) { int fail = 0; - int result = 0; + void *result = 0; /* * The thread does not contain any cancelation points, so * a return value of PTHREAD_CANCELED confirms that async * cancelation succeeded. */ - assert(pthread_join(t[i], (void **) &result) == 0); + assert(pthread_join(t[i], &result) == 0); - fail = (result != (int) PTHREAD_CANCELED); + fail = (result != PTHREAD_CANCELED); if (fail) { diff --git a/winsup/testsuite/winsup.api/pthread/cancel4.c b/winsup/testsuite/winsup.api/pthread/cancel4.c index d6b2ffadf..d8151891b 100644 --- a/winsup/testsuite/winsup.api/pthread/cancel4.c +++ b/winsup/testsuite/winsup.api/pthread/cancel4.c @@ -66,7 +66,7 @@ static bag_t threadbag[NUMTHREADS + 1]; void * mythread(void * arg) { - int result = ((int)PTHREAD_CANCELED + 1); + void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1); bag_t * bag = (bag_t *) arg; assert(bag == &threadbag[bag->threadnum]); @@ -86,7 +86,7 @@ mythread(void * arg) for (bag->count = 0; bag->count < 100; bag->count++) Sleep(100); - return (void *) result; + return result; } int @@ -141,16 +141,16 @@ main() for (i = 1; i <= NUMTHREADS; i++) { int fail = 0; - int result = 0; + void* result = 0; /* * The thread does not contain any cancelation points, so * a return value of PTHREAD_CANCELED indicates that async * cancelation occurred. */ - assert(pthread_join(t[i], (void **) &result) == 0); + assert(pthread_join(t[i], &result) == 0); - fail = (result == (int) PTHREAD_CANCELED); + fail = (result == PTHREAD_CANCELED); if (fail) { diff --git a/winsup/testsuite/winsup.api/pthread/cancel5.c b/winsup/testsuite/winsup.api/pthread/cancel5.c index 9dd579543..8b7240615 100644 --- a/winsup/testsuite/winsup.api/pthread/cancel5.c +++ b/winsup/testsuite/winsup.api/pthread/cancel5.c @@ -62,7 +62,7 @@ static bag_t threadbag[NUMTHREADS + 1]; void * mythread(void * arg) { - int result = ((int)PTHREAD_CANCELED + 1); + void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1); bag_t * bag = (bag_t *) arg; assert(bag == &threadbag[bag->threadnum]); @@ -82,7 +82,7 @@ mythread(void * arg) for (bag->count = 0; bag->count < 100; bag->count++) Sleep(100); - return (void *) result; + return result; } int @@ -96,7 +96,7 @@ main() { threadbag[i].started = 0; threadbag[i].threadnum = i; - assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); + assert(pthread_create(&t[i], NULL, mythread, &threadbag[i]) == 0); } /* @@ -135,16 +135,16 @@ main() for (i = 1; i <= NUMTHREADS; i++) { int fail = 0; - int result = 0; + void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1); /* * The thread does not contain any cancelation points, so * a return value of PTHREAD_CANCELED confirms that async * cancelation succeeded. */ - assert(pthread_join(t[i], (void **) &result) == 0); + assert(pthread_join(t[i], &result) == 0); - fail = (result != (int) PTHREAD_CANCELED); + fail = (result != PTHREAD_CANCELED); if (fail) { diff --git a/winsup/testsuite/winsup.api/pthread/cleanup2.c b/winsup/testsuite/winsup.api/pthread/cleanup2.c index bcbaad3a7..75c239a00 100644 --- a/winsup/testsuite/winsup.api/pthread/cleanup2.c +++ b/winsup/testsuite/winsup.api/pthread/cleanup2.c @@ -84,7 +84,7 @@ mythread(void * arg) pthread_cleanup_pop(1); - return (void *) result; + return (void *) (size_t) result; } int @@ -129,18 +129,18 @@ main() for (i = 1; i <= NUMTHREADS; i++) { int fail = 0; - int result = 0; + void* result = 0; - assert(pthread_join(t[i], (void **) &result) == 0); + assert(pthread_join(t[i], &result) == 0); - fail = (result != 0); + fail = ((int)(size_t)result != 0); if (fail) { fprintf(stderr, "Thread %d: started %d: result: %d\n", i, threadbag[i].started, - result); + (int)(size_t)result); } failed = (failed || fail); } diff --git a/winsup/testsuite/winsup.api/pthread/cleanup3.c b/winsup/testsuite/winsup.api/pthread/cleanup3.c index f8201faa0..6fea8dc93 100644 --- a/winsup/testsuite/winsup.api/pthread/cleanup3.c +++ b/winsup/testsuite/winsup.api/pthread/cleanup3.c @@ -87,7 +87,7 @@ mythread(void * arg) pthread_cleanup_pop(0); - return (void *) result; + return (void *) (size_t)result; } int @@ -132,9 +132,9 @@ main() for (i = 1; i <= NUMTHREADS; i++) { int fail = 0; - int result = 0; + void* result = 0; - assert(pthread_join(t[i], (void **) &result) == 0); + assert(pthread_join(t[i], &result) == 0); fail = (result != 0); @@ -143,7 +143,7 @@ main() fprintf(stderr, "Thread %d: started %d: result: %d\n", i, threadbag[i].started, - result); + (int)(size_t)result); } failed = (failed || fail); } diff --git a/winsup/testsuite/winsup.api/pthread/condvar2_1.c b/winsup/testsuite/winsup.api/pthread/condvar2_1.c index da3416203..1aa4fed9a 100644 --- a/winsup/testsuite/winsup.api/pthread/condvar2_1.c +++ b/winsup/testsuite/winsup.api/pthread/condvar2_1.c @@ -69,7 +69,7 @@ main() { int i; pthread_t t[NUMTHREADS + 1]; - int result = 0; + void* result = 0; struct timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; @@ -89,19 +89,19 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); + assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t)i) == 0); } assert(pthread_mutex_unlock(&mutex) == 0); for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); + assert(pthread_join(t[i], &result) == 0); + assert((int)(size_t)result == i); } - result = pthread_cond_destroy(&cv); - assert(result == 0); + int result2 = pthread_cond_destroy(&cv); + assert(result2 == 0); return 0; } diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_1.c b/winsup/testsuite/winsup.api/pthread/condvar3_1.c index b08b04889..a4653ebc8 100644 --- a/winsup/testsuite/winsup.api/pthread/condvar3_1.c +++ b/winsup/testsuite/winsup.api/pthread/condvar3_1.c @@ -89,7 +89,7 @@ main() { int i; pthread_t t[NUMTHREADS + 1]; - int result = 0; + void* result = 0; struct timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; @@ -110,7 +110,7 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); + assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t)i) == 0); } do { @@ -127,8 +127,8 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); + assert(pthread_join(t[i], &result) == 0); + assert((int)(size_t)result == i); } printf("awk = %d\n", awoken); @@ -138,8 +138,8 @@ main() assert(signaled == awoken); assert(timedout == NUMTHREADS - signaled); - result = pthread_cond_destroy(&cv); - assert(result == 0); + int result2 = pthread_cond_destroy(&cv); + assert(result2 == 0); return 0; } diff --git a/winsup/testsuite/winsup.api/pthread/condvar3_2.c b/winsup/testsuite/winsup.api/pthread/condvar3_2.c index 57e7eb439..b08d8e256 100644 --- a/winsup/testsuite/winsup.api/pthread/condvar3_2.c +++ b/winsup/testsuite/winsup.api/pthread/condvar3_2.c @@ -66,7 +66,7 @@ mythread(void * arg) abstime2.tv_sec = abstime.tv_sec; - if ((int) arg % 3 == 0) + if ((int) (size_t)arg % 3 == 0) { abstime2.tv_sec += 2; } @@ -91,7 +91,7 @@ main() { int i; pthread_t t[NUMTHREADS + 1]; - int result = 0; + void* result = 0; struct timeb currSysTime; const DWORD NANOSEC_PER_MILLISEC = 1000000; @@ -109,15 +109,15 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_create(&t[i], NULL, mythread, (void *) i) == 0); + assert(pthread_create(&t[i], NULL, mythread, (void *)(size_t)i) == 0); } assert(pthread_mutex_unlock(&mutex) == 0); for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_join(t[i], (void **) &result) == 0); - assert(result == i); + assert(pthread_join(t[i], &result) == 0); + assert((int)(size_t)result == i); /* * Approximately 2/3rds of the threads are expected to time out. * Signal the remainder after some threads have woken up and exited @@ -132,8 +132,8 @@ main() assert(awoken == NUMTHREADS - timedout); - result = pthread_cond_destroy(&cv); - assert(result == 0); + int result2 = pthread_cond_destroy(&cv); + assert(result2 == 0); return 0; } diff --git a/winsup/testsuite/winsup.api/pthread/exit3.c b/winsup/testsuite/winsup.api/pthread/exit3.c index 0b6ec31c5..7baf7bb10 100644 --- a/winsup/testsuite/winsup.api/pthread/exit3.c +++ b/winsup/testsuite/winsup.api/pthread/exit3.c @@ -24,7 +24,7 @@ main(int argc, char * argv[]) /* Create a few threads and then exit. */ for (i = 0; i < 4; i++) { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); + assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0); } Sleep(1000); diff --git a/winsup/testsuite/winsup.api/pthread/inherit1.c b/winsup/testsuite/winsup.api/pthread/inherit1.c index a909eb763..545e4596f 100644 --- a/winsup/testsuite/winsup.api/pthread/inherit1.c +++ b/winsup/testsuite/winsup.api/pthread/inherit1.c @@ -47,7 +47,7 @@ void * func(void * arg) struct sched_param param; assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); - return (void *) param.sched_priority; + return (void *) (size_t)param.sched_priority; } int @@ -91,7 +91,7 @@ main() assert(pthread_attr_setschedparam(&attr, ¶m) == 0); assert(pthread_create(&t, &attr, func, NULL) == 0); pthread_join(t, &result); - assert((int) result == mainParam.sched_priority); + assert((int)(size_t) result == mainParam.sched_priority); } } diff --git a/winsup/testsuite/winsup.api/pthread/join1.c b/winsup/testsuite/winsup.api/pthread/join1.c index d74e0c484..8a9d17669 100644 --- a/winsup/testsuite/winsup.api/pthread/join1.c +++ b/winsup/testsuite/winsup.api/pthread/join1.c @@ -9,7 +9,7 @@ void * func(void * arg) { - int i = (int) arg; + int i = (int)(size_t)arg; Sleep(i * 500); @@ -24,12 +24,12 @@ main(int argc, char * argv[]) { pthread_t id[4]; int i; - int result; + void* result = (void*)-1; /* Create a few threads and then exit. */ for (i = 0; i < 4; i++) { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); + assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0); } /* Some threads will finish before they are joined, some after. */ @@ -37,9 +37,9 @@ main(int argc, char * argv[]) for (i = 0; i < 4; i++) { - assert(pthread_join(id[i], (void **) &result) == 0); + assert(pthread_join(id[i], &result) == 0); #if ! defined (__MINGW32__) || defined (__MSVCRT__) - assert(result == i); + assert((int)(size_t)result == i); #else # warning pthread_join not fully supported in this configuration. assert(result == 0); diff --git a/winsup/testsuite/winsup.api/pthread/join2.c b/winsup/testsuite/winsup.api/pthread/join2.c index cdc8ca2d9..9a8de4619 100644 --- a/winsup/testsuite/winsup.api/pthread/join2.c +++ b/winsup/testsuite/winsup.api/pthread/join2.c @@ -18,21 +18,21 @@ main(int argc, char * argv[]) { pthread_t id[4]; int i; - int result; + void* result = (void*)-1; /* Create a few threads and then exit. */ for (i = 0; i < 4; i++) { - assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); + assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0); } for (i = 0; i < 4; i++) { - assert(pthread_join(id[i], (void **) &result) == 0); + assert(pthread_join(id[i], &result) == 0); #if ! defined (__MINGW32__) || defined (__MSVCRT__) /* CRTDLL _beginthread doesn't support return value, so the assertion is guaranteed to fail. */ - assert(result == i); + assert((int)(size_t)result == i); #endif } diff --git a/winsup/testsuite/winsup.api/pthread/mutex4.c b/winsup/testsuite/winsup.api/pthread/mutex4.c index 8a983fee9..f4d31adb5 100644 --- a/winsup/testsuite/winsup.api/pthread/mutex4.c +++ b/winsup/testsuite/winsup.api/pthread/mutex4.c @@ -17,7 +17,7 @@ static pthread_mutex_t mutex1; void * unlocker(void * arg) { - int expectedResult = (int) arg; + int expectedResult = (int)(size_t)arg; wasHere++; assert(pthread_mutex_unlock(&mutex1) == expectedResult); diff --git a/winsup/testsuite/winsup.api/pthread/priority1.c b/winsup/testsuite/winsup.api/pthread/priority1.c index a31102895..b740b997f 100644 --- a/winsup/testsuite/winsup.api/pthread/priority1.c +++ b/winsup/testsuite/winsup.api/pthread/priority1.c @@ -48,7 +48,7 @@ void * func(void * arg) assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); assert(policy == SCHED_OTHER); - return (void *) param.sched_priority; + return (void *)(size_t)param.sched_priority; } int @@ -71,7 +71,7 @@ main() assert(pthread_attr_setschedparam(&attr, ¶m) == 0); assert(pthread_create(&t, &attr, func, NULL) == 0); pthread_join(t, &result); - assert((int) result == param.sched_priority); + assert((int)(size_t) result == param.sched_priority); } return 0; diff --git a/winsup/testsuite/winsup.api/pthread/priority2.c b/winsup/testsuite/winsup.api/pthread/priority2.c index 4dcf3859f..d2d0b0695 100644 --- a/winsup/testsuite/winsup.api/pthread/priority2.c +++ b/winsup/testsuite/winsup.api/pthread/priority2.c @@ -52,7 +52,7 @@ void * func(void * arg) assert(pthread_getschedparam(pthread_self(), &policy, ¶m) == 0); assert(pthread_mutex_unlock(&startMx) == 0); assert(policy == SCHED_OTHER); - return (void *) param.sched_priority; + return (void *) (size_t)param.sched_priority; } int @@ -73,7 +73,7 @@ main() assert(pthread_setschedparam(t, SCHED_OTHER, ¶m) == 0); assert(pthread_mutex_unlock(&startMx) == 0); pthread_join(t, &result); - assert((int) result == param.sched_priority); + assert((int)(size_t)result == param.sched_priority); } return 0; diff --git a/winsup/testsuite/winsup.api/pthread/rwlock6.c b/winsup/testsuite/winsup.api/pthread/rwlock6.c index d5f2320d0..870b7c264 100644 --- a/winsup/testsuite/winsup.api/pthread/rwlock6.c +++ b/winsup/testsuite/winsup.api/pthread/rwlock6.c @@ -25,7 +25,7 @@ void * wrfunc(void * arg) ba = bankAccount; assert(pthread_rwlock_unlock(&rwlock1) == 0); - return ((void *) ba); + return ((void *)(size_t)ba); } void * rdfunc(void * arg) @@ -36,7 +36,7 @@ void * rdfunc(void * arg) ba = bankAccount; assert(pthread_rwlock_unlock(&rwlock1) == 0); - return ((void *) ba); + return ((void *)(size_t)ba); } int @@ -45,9 +45,9 @@ main() pthread_t wrt1; pthread_t wrt2; pthread_t rdt; - int wr1Result = 0; - int wr2Result = 0; - int rdResult = 0; + void* wr1Result = 0; + void* wr2Result = 0; + void* rdResult = 0; bankAccount = 0; @@ -57,13 +57,13 @@ main() Sleep(500); assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0); - assert(pthread_join(wrt1, (void **) &wr1Result) == 0); - assert(pthread_join(rdt, (void **) &rdResult) == 0); - assert(pthread_join(wrt2, (void **) &wr2Result) == 0); + assert(pthread_join(wrt1, &wr1Result) == 0); + assert(pthread_join(rdt, &rdResult) == 0); + assert(pthread_join(wrt2, &wr2Result) == 0); - assert(wr1Result == 10); - assert(rdResult == 20); - assert(wr2Result == 20); + assert((int)(size_t)wr1Result == 10); + assert((int)(size_t)rdResult == 20); + assert((int)(size_t)wr2Result == 20); return 0; }