summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/ChangeLog3
-rw-r--r--tests/barrier3.c4
-rw-r--r--tests/barrier5.c6
-rw-r--r--tests/cancel2.c8
-rw-r--r--tests/cancel3.c4
-rw-r--r--tests/cancel4.c4
-rw-r--r--tests/cancel5.c4
-rw-r--r--tests/cancel6a.c4
-rw-r--r--tests/cancel6d.c4
-rw-r--r--tests/cancel7.c2
-rw-r--r--tests/cancel8.c2
-rw-r--r--tests/cancel9.c6
-rw-r--r--tests/cleanup0.c6
-rw-r--r--tests/cleanup1.c6
-rw-r--r--tests/cleanup2.c6
-rw-r--r--tests/cleanup3.c6
-rw-r--r--tests/condvar1_2.c4
-rw-r--r--tests/condvar2_1.c4
-rw-r--r--tests/condvar3_1.c4
-rw-r--r--tests/condvar3_2.c4
-rw-r--r--tests/create2.c3
-rw-r--r--tests/delay2.c4
-rw-r--r--tests/exception1.c6
-rw-r--r--tests/exception2.c2
-rw-r--r--tests/exception3.c2
-rw-r--r--tests/exit4.c2
-rw-r--r--tests/exit5.c2
-rw-r--r--tests/inherit1.c2
-rw-r--r--tests/join0.c4
-rw-r--r--tests/join1.c4
-rw-r--r--tests/join2.c4
-rw-r--r--tests/join3.c4
-rw-r--r--tests/mutex6e.c4
-rw-r--r--tests/mutex6es.c4
-rw-r--r--tests/mutex6r.c4
-rw-r--r--tests/mutex6rs.c4
-rw-r--r--tests/mutex7e.c4
-rw-r--r--tests/mutex7r.c4
-rw-r--r--tests/priority1.c4
-rw-r--r--tests/priority2.c2
-rw-r--r--tests/reuse1.c4
-rw-r--r--tests/rwlock6.c12
-rw-r--r--tests/rwlock6_t.c16
-rw-r--r--tests/rwlock6_t2.c12
-rw-r--r--tests/semaphore1.c17
-rw-r--r--tests/semaphore4.c8
-rw-r--r--tests/semaphore4t.c3
-rw-r--r--tests/spin4.c4
-rw-r--r--tests/tsd1.c4
-rw-r--r--tests/tsd2.c4
-rw-r--r--tests/valid1.c2
51 files changed, 119 insertions, 127 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index bf604f5..a42405f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,6 +1,9 @@
2011-03-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
* condvar3_2.c: abstime.tv_sec operation warning fixed.
+ * several: Use correct casting on pthread_join result arg
+ and associated declaration and usage; assumed that 64 bit
+ gcc gave some warnings for it.
2011-02-28 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
diff --git a/tests/barrier3.c b/tests/barrier3.c
index 66fe895..f65b60c 100644
--- a/tests/barrier3.c
+++ b/tests/barrier3.c
@@ -41,7 +41,7 @@
#include "test.h"
pthread_barrier_t barrier = NULL;
-static int result = 1;
+static void* result = (void*)1;
void * func(void * arg)
{
@@ -62,7 +62,7 @@ main()
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == PTHREAD_BARRIER_SERIAL_THREAD);
+ assert((int)(size_t)result == PTHREAD_BARRIER_SERIAL_THREAD);
assert(pthread_barrier_destroy(&barrier) == 0);
assert(pthread_barrierattr_destroy(&ba) == 0);
diff --git a/tests/barrier5.c b/tests/barrier5.c
index 4510be0..b64b7d7 100644
--- a/tests/barrier5.c
+++ b/tests/barrier5.c
@@ -72,14 +72,14 @@ func(void * crossings)
}
}
- return (void *) (size_t)serialThreads;
+ return (void*)(size_t)serialThreads;
}
int
main()
{
int i, j;
- int result;
+ void* result;
int serialThreadsTotal;
LONG Crossings;
pthread_t t[NUMTHREADS + 1];
@@ -104,7 +104,7 @@ main()
for (i = 1; i <= j; i++)
{
assert(pthread_join(t[i], (void *) &result) == 0);
- serialThreadsTotal += result;
+ serialThreadsTotal += (int)(size_t)result;
}
assert(serialThreadsTotal == BARRIERMULTIPLE);
diff --git a/tests/cancel2.c b/tests/cancel2.c
index d738a21..4669a28 100644
--- a/tests/cancel2.c
+++ b/tests/cancel2.c
@@ -217,17 +217,17 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_join(t[i], (void *) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) 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,
+ (((int)(size_t)result % 2) == 0) ? "ASYNCHRONOUS" : "DEFERRED");
}
failed |= fail;
}
diff --git a/tests/cancel3.c b/tests/cancel3.c
index 050b4ee..ff83c4b 100644
--- a/tests/cancel3.c
+++ b/tests/cancel3.c
@@ -173,7 +173,7 @@ main ()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/*
* The thread does not contain any cancelation points, so
@@ -182,7 +182,7 @@ main ()
*/
assert (pthread_join (t[i], (void *) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel4.c b/tests/cancel4.c
index ea792af..28c5d2e 100644
--- a/tests/cancel4.c
+++ b/tests/cancel4.c
@@ -173,7 +173,7 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/*
* The thread does not contain any cancelation points, so
@@ -182,7 +182,7 @@ main()
*/
assert(pthread_join(t[i], (void *) &result) == 0);
- fail = (result == (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result == (int) PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel5.c b/tests/cancel5.c
index 81b5ea0..17497dd 100644
--- a/tests/cancel5.c
+++ b/tests/cancel5.c
@@ -171,7 +171,7 @@ main ()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/*
* The thread does not contain any cancelation points, so
@@ -180,7 +180,7 @@ main ()
*/
assert (pthread_join (t[i], (void *) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel6a.c b/tests/cancel6a.c
index 8deb435..ca79d40 100644
--- a/tests/cancel6a.c
+++ b/tests/cancel6a.c
@@ -161,7 +161,7 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/*
* The thread does not contain any cancelation points, so
@@ -170,7 +170,7 @@ main()
*/
assert(pthread_join(t[i], (void *) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel6d.c b/tests/cancel6d.c
index bf770d2..e22a3c5 100644
--- a/tests/cancel6d.c
+++ b/tests/cancel6d.c
@@ -165,11 +165,11 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_join(t[i], (void *) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel7.c b/tests/cancel7.c
index 9fb2e61..fde8dab 100644
--- a/tests/cancel7.c
+++ b/tests/cancel7.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
diff --git a/tests/cancel8.c b/tests/cancel8.c
index 69eafe9..72b9287 100644
--- a/tests/cancel8.c
+++ b/tests/cancel8.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
diff --git a/tests/cancel9.c b/tests/cancel9.c
index b009161..d4567ef 100644
--- a/tests/cancel9.c
+++ b/tests/cancel9.c
@@ -172,7 +172,7 @@ main ()
Sleep (100);
assert (pthread_cancel (t) == 0);
assert (pthread_join (t, &result) == 0);
- assert (result == PTHREAD_CANCELED && "test_sleep" != NULL);
+ assert ((int)(size_t)result == (int)PTHREAD_CANCELED && "test_sleep" != NULL);
printf ("Cancel waiting thread.\n");
assert (pthread_create (&t, NULL, test_wait, NULL) == 0);
@@ -180,7 +180,7 @@ main ()
Sleep (100);
assert (pthread_cancel (t) == 0);
assert (pthread_join (t, &result) == 0);
- assert (result == PTHREAD_CANCELED && "test_wait");
+ assert ((int)(size_t)result == (int)PTHREAD_CANCELED && "test_wait");
printf ("Cancel blocked thread (blocked on network I/O).\n");
assert (pthread_create (&t, NULL, test_udp, NULL) == 0);
@@ -188,7 +188,7 @@ main ()
Sleep (100);
assert (pthread_cancel (t) == 0);
assert (pthread_join (t, &result) == 0);
- assert (result == PTHREAD_CANCELED && "test_udp" != NULL);
+ assert ((int)(size_t)result == (int)PTHREAD_CANCELED && "test_udp" != NULL);
}
else
{
diff --git a/tests/cleanup0.c b/tests/cleanup0.c
index 18092d0..c840afe 100644
--- a/tests/cleanup0.c
+++ b/tests/cleanup0.c
@@ -189,18 +189,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_join(t[i], (void *) &result) == 0);
- fail = (result == (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result == (int) PTHREAD_CANCELED);
if (fail)
{
fprintf(stderr, "Thread %d: started %d: result %d\n",
i,
threadbag[i].started,
- result);
+ (int)(size_t)result);
fflush(stderr);
}
failed = (failed || fail);
diff --git a/tests/cleanup1.c b/tests/cleanup1.c
index b35013b..b326549 100644
--- a/tests/cleanup1.c
+++ b/tests/cleanup1.c
@@ -203,18 +203,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_join(t[i], (void *) &result) == 0);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
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/tests/cleanup2.c b/tests/cleanup2.c
index e530f74..fa32b69 100644
--- a/tests/cleanup2.c
+++ b/tests/cleanup2.c
@@ -178,18 +178,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_join(t[i], (void *) &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/tests/cleanup3.c b/tests/cleanup3.c
index 4187396..575ffbd 100644
--- a/tests/cleanup3.c
+++ b/tests/cleanup3.c
@@ -183,18 +183,18 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_join(t[i], (void *) &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/tests/condvar1_2.c b/tests/condvar1_2.c
index ff71fc6..b985c5d 100644
--- a/tests/condvar1_2.c
+++ b/tests/condvar1_2.c
@@ -89,7 +89,7 @@ int
main()
{
int i, j, k;
- int result = -1;
+ void* result = (void*)-1;
pthread_t t;
for (k = 0; k < NUM_LOOPS; k++)
@@ -117,7 +117,7 @@ main()
while (j > 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert (result == 0);
+ assert ((int)(size_t)result == 0);
}
return 0;
diff --git a/tests/condvar2_1.c b/tests/condvar2_1.c
index 1dd106f..2cc563a 100644
--- a/tests/condvar2_1.c
+++ b/tests/condvar2_1.c
@@ -105,7 +105,7 @@ main()
{
int i;
pthread_t t[NUMTHREADS + 1];
- int result = 0;
+ void* result = (void*)0;
struct _timeb currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
@@ -133,7 +133,7 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
assert(pthread_join(t[i], (void *) &result) == 0);
- assert(result == i);
+ assert((int)(size_t)result == i);
}
{
diff --git a/tests/condvar3_1.c b/tests/condvar3_1.c
index 3221969..fe522ce 100644
--- a/tests/condvar3_1.c
+++ b/tests/condvar3_1.c
@@ -126,7 +126,7 @@ main()
{
int i;
pthread_t t[NUMTHREADS + 1];
- int result = 0;
+ void* result = (void*)0;
struct _timeb currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
@@ -169,7 +169,7 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
assert(pthread_join(t[i], (void *) &result) == 0);
- assert(result == i);
+ assert((int)(size_t)result == i);
}
fprintf(stderr, "awk = %d\n", awoken);
diff --git a/tests/condvar3_2.c b/tests/condvar3_2.c
index 0abe38a..cc21e9f 100644
--- a/tests/condvar3_2.c
+++ b/tests/condvar3_2.c
@@ -127,7 +127,7 @@ main()
{
int i;
pthread_t t[NUMTHREADS + 1];
- int result = 0;
+ void* result = (void*)0;
struct _timeb currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
@@ -153,7 +153,7 @@ main()
for (i = 1; i <= NUMTHREADS; i++)
{
assert(pthread_join(t[i], (void *) &result) == 0);
- assert(result == i);
+ 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
diff --git a/tests/create2.c b/tests/create2.c
index 2ffb64e..9b4e864 100644
--- a/tests/create2.c
+++ b/tests/create2.c
@@ -100,7 +100,8 @@ main()
{
washere = 0;
assert(pthread_create(&t, &attr, func, NULL) == 0);
- pthread_join(t, &result);
+ assert(pthread_join(t, &result) == 0);
+ assert((int)(size_t)result == 0);
assert(washere == 1);
}
diff --git a/tests/delay2.c b/tests/delay2.c
index 8e8e375..cdc70a6 100644
--- a/tests/delay2.c
+++ b/tests/delay2.c
@@ -65,7 +65,7 @@ int
main(int argc, char * argv[])
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
assert(pthread_mutex_lock(&mx) == 0);
@@ -75,7 +75,7 @@ main(int argc, char * argv[])
assert(pthread_mutex_unlock(&mx) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == (int) PTHREAD_CANCELED);
+ assert((int)(size_t)result == (int) PTHREAD_CANCELED);
return 0;
}
diff --git a/tests/exception1.c b/tests/exception1.c
index 4340078..4ccc24c 100644
--- a/tests/exception1.c
+++ b/tests/exception1.c
@@ -226,17 +226,17 @@ main()
for (i = 0; i < NUMTHREADS; i++)
{
int fail = 0;
- int result = 0;
+ void* result = (void*)0;
/* Canceled thread */
assert(pthread_join(ct[i], (void *) &result) == 0);
- assert(!(fail = (result != (int) PTHREAD_CANCELED)));
+ assert(!(fail = ((int)(size_t)result != (int) PTHREAD_CANCELED)));
failed = (failed || fail);
/* Exceptioned thread */
assert(pthread_join(et[i], (void *) &result) == 0);
- assert(!(fail = (result != ((int) PTHREAD_CANCELED + 2))));
+ assert(!(fail = ((int)(size_t)result != ((int) PTHREAD_CANCELED + 2))));
failed = (failed || fail);
}
diff --git a/tests/exception2.c b/tests/exception2.c
index 5c18568..222d305 100644
--- a/tests/exception2.c
+++ b/tests/exception2.c
@@ -62,7 +62,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
diff --git a/tests/exception3.c b/tests/exception3.c
index 9a70a40..3e8b9e7 100644
--- a/tests/exception3.c
+++ b/tests/exception3.c
@@ -62,7 +62,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
diff --git a/tests/exit4.c b/tests/exit4.c
index 1ceca4e..e8cd88a 100644
--- a/tests/exit4.c
+++ b/tests/exit4.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
diff --git a/tests/exit5.c b/tests/exit5.c
index 450ed3b..15e1bc9 100644
--- a/tests/exit5.c
+++ b/tests/exit5.c
@@ -63,7 +63,7 @@
*
* Assumptions:
* - have working pthread_create, pthread_self, pthread_mutex_lock/unlock
- * pthread_testcancel, pthread_cancel, pthread_join
+ * pthread_testcancel, pthread_cancel
*
* Pass Criteria:
* - Process returns zero exit status.
diff --git a/tests/inherit1.c b/tests/inherit1.c
index 1933bb1..24ceec5 100644
--- a/tests/inherit1.c
+++ b/tests/inherit1.c
@@ -169,7 +169,7 @@ main()
assert(pthread_attr_setschedparam(&attr, &param) == 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/tests/join0.c b/tests/join0.c
index c8367d3..3519f53 100644
--- a/tests/join0.c
+++ b/tests/join0.c
@@ -53,14 +53,14 @@ int
main(int argc, char * argv[])
{
pthread_t id;
- int result;
+ void* result = (void*)0;
/* Create a single thread and wait for it to exit. */
assert(pthread_create(&id, NULL, func, (void *) 123) == 0);
assert(pthread_join(id, (void *) &result) == 0);
- assert(result == 123);
+ assert((int)(size_t)result == 123);
/* Success. */
return 0;
diff --git a/tests/join1.c b/tests/join1.c
index cf92a05..b00026a 100644
--- a/tests/join1.c
+++ b/tests/join1.c
@@ -56,7 +56,7 @@ 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++)
@@ -70,7 +70,7 @@ main(int argc, char * argv[])
for (i = 0; i < 4; i++)
{
assert(pthread_join(id[i], (void *) &result) == 0);
- assert(result == i);
+ assert((int)(size_t)result == i);
}
/* Success. */
diff --git a/tests/join2.c b/tests/join2.c
index 5d829d1..036daf5 100644
--- a/tests/join2.c
+++ b/tests/join2.c
@@ -50,7 +50,7 @@ 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++)
@@ -61,7 +61,7 @@ main(int argc, char * argv[])
for (i = 0; i < 4; i++)
{
assert(pthread_join(id[i], (void *) &result) == 0);
- assert(result == i);
+ assert((int)(size_t)result == i);
}
/* Success. */
diff --git a/tests/join3.c b/tests/join3.c
index 62cc908..dc73e99 100644
--- a/tests/join3.c
+++ b/tests/join3.c
@@ -50,7 +50,7 @@ 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++)
@@ -67,7 +67,7 @@ main(int argc, char * argv[])
for (i = 0; i < 4; i++)
{
assert(pthread_join(id[i], (void *) &result) == 0);
- assert(result == i);
+ assert((int)(size_t)result == i);
}
/* Success. */
diff --git a/tests/mutex6e.c b/tests/mutex6e.c
index c17c920..dc6e853 100644
--- a/tests/mutex6e.c
+++ b/tests/mutex6e.c
@@ -74,7 +74,7 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
@@ -87,7 +87,7 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == 555);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/tests/mutex6es.c b/tests/mutex6es.c
index c8e6d2a..f34b691 100644
--- a/tests/mutex6es.c
+++ b/tests/mutex6es.c
@@ -73,14 +73,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER);
assert(pthread_create(&t, NULL, locker, NULL) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == 555);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/tests/mutex6r.c b/tests/mutex6r.c
index cc1a780..85bb6bd 100644
--- a/tests/mutex6r.c
+++ b/tests/mutex6r.c
@@ -73,7 +73,7 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
@@ -86,7 +86,7 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == 555);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/tests/mutex6rs.c b/tests/mutex6rs.c
index 0f03d6a..6c8c1f5 100644
--- a/tests/mutex6rs.c
+++ b/tests/mutex6rs.c
@@ -72,14 +72,14 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER);
assert(pthread_create(&t, NULL, locker, NULL) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == 555);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/tests/mutex7e.c b/tests/mutex7e.c
index d715150..52424be 100644
--- a/tests/mutex7e.c
+++ b/tests/mutex7e.c
@@ -74,7 +74,7 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
@@ -87,7 +87,7 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == 555);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/tests/mutex7r.c b/tests/mutex7r.c
index 7a1c206..1ce1aa6 100644
--- a/tests/mutex7r.c
+++ b/tests/mutex7r.c
@@ -73,7 +73,7 @@ int
main()
{
pthread_t t;
- int result = 0;
+ void* result = (void*)0;
int mxType = -1;
assert(pthread_mutexattr_init(&mxAttr) == 0);
@@ -86,7 +86,7 @@ main()
assert(pthread_create(&t, NULL, locker, NULL) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result == 555);
+ assert((int)(size_t)result == 555);
assert(lockCount == 2);
diff --git a/tests/priority1.c b/tests/priority1.c
index 66c5a4c..40316cc 100644
--- a/tests/priority1.c
+++ b/tests/priority1.c
@@ -164,8 +164,8 @@ main()
assert(pthread_join(t, &result) == 0);
- assert(param.sched_priority == (int) result);
- printf("%10d %10d %10d\n", param.sched_priority, (int) result, prio);
+ assert(param.sched_priority == (int)(size_t) result);
+ printf("%10d %10d %10d\n", param.sched_priority, (int)(size_t) result, prio);
}
return 0;
diff --git a/tests/priority2.c b/tests/priority2.c
index b435203..7d4648f 100644
--- a/tests/priority2.c
+++ b/tests/priority2.c
@@ -162,7 +162,7 @@ main()
assert(GetThreadPriority(pthread_getw32threadhandle_np(t)) ==
validPriorities[param.sched_priority+(PTW32TEST_MAXPRIORITIES/2)]);
pthread_join(t, &result);
- assert(param.sched_priority == (int)result);
+ assert(param.sched_priority == (int)(size_t)result);
}
return 0;
diff --git a/tests/reuse1.c b/tests/reuse1.c
index ae9efe4..2b9cf57 100644
--- a/tests/reuse1.c
+++ b/tests/reuse1.c
@@ -100,7 +100,7 @@ main()
washere = 0;
assert(pthread_create(&t, &attr, func, NULL) == 0);
assert(pthread_join(t, &result) == 0);;
- assert(result == 0);
+ assert((int)(size_t)result == 0);
assert(washere == 1);
last_t = t;
@@ -109,7 +109,7 @@ main()
washere = 0;
assert(pthread_create(&t, &attr, func, (void *) i) == 0);
pthread_join(t, &result);
- assert((int) result == i);
+ assert((int)(size_t) result == i);
assert(washere == 1);
/* thread IDs should be unique */
assert(!pthread_equal(t, last_t));
diff --git a/tests/rwlock6.c b/tests/rwlock6.c
index 9679d46..3f305e8 100644
--- a/tests/rwlock6.c
+++ b/tests/rwlock6.c
@@ -77,9 +77,9 @@ main()
pthread_t wrt1;
pthread_t wrt2;
pthread_t rdt;
- int wr1Result = 0;
- int wr2Result = 0;
- int rdResult = 0;
+ void* wr1Result = (void*)0;
+ void* wr2Result = (void*)0;
+ void* rdResult = (void*)0;
bankAccount = 0;
@@ -93,9 +93,9 @@ main()
assert(pthread_join(rdt, (void *) &rdResult) == 0);
assert(pthread_join(wrt2, (void *) &wr2Result) == 0);
- assert(wr1Result == 10);
- assert(rdResult == 10);
- assert(wr2Result == 20);
+ assert((int)(size_t)wr1Result == 10);
+ assert((int)(size_t)rdResult == 10);
+ assert((int)(size_t)wr2Result == 20);
return 0;
}
diff --git a/tests/rwlock6_t.c b/tests/rwlock6_t.c
index f8a05f1..6151d75 100644
--- a/tests/rwlock6_t.c
+++ b/tests/rwlock6_t.c
@@ -95,10 +95,10 @@ main()
pthread_t wrt2;
pthread_t rdt1;
pthread_t rdt2;
- int wr1Result = 0;
- int wr2Result = 0;
- int rd1Result = 0;
- int rd2Result = 0;
+ void* wr1Result = (void*)0;
+ void* wr2Result = (void*)0;
+ void* rd1Result = (void*)0;
+ void* rd2Result = (void*)0;
bankAccount = 0;
@@ -115,10 +115,10 @@ main()
assert(pthread_join(wrt2, (void *) &wr2Result) == 0);
assert(pthread_join(rdt2, (void *) &rd2Result) == 0);
- assert(wr1Result == 10);
- assert(rd1Result == 0);
- assert(wr2Result == 20);
- assert(rd2Result == 20);
+ assert((int)(size_t)wr1Result == 10);
+ assert((int)(size_t)rd1Result == 0);
+ assert((int)(size_t)wr2Result == 20);
+ assert((int)(size_t)rd2Result == 20);
return 0;
}
diff --git a/tests/rwlock6_t2.c b/tests/rwlock6_t2.c
index 0c7191f..8d658b4 100644
--- a/tests/rwlock6_t2.c
+++ b/tests/rwlock6_t2.c
@@ -86,9 +86,9 @@ main()
pthread_t wrt1;
pthread_t wrt2;
pthread_t rdt;
- int wr1Result = 0;
- int wr2Result = 0;
- int rdResult = 0;
+ void* wr1Result = (void*)0;
+ void* wr2Result = (void*)0;
+ void* rdResult = (void*)0;
struct _timeb currSysTime;
const DWORD NANOSEC_PER_MILLISEC = 1000000;
@@ -111,9 +111,9 @@ main()
assert(pthread_join(rdt, (void *) &rdResult) == 0);
assert(pthread_join(wrt2, (void *) &wr2Result) == 0);
- assert(wr1Result == 10);
- assert(rdResult == 0);
- assert(wr2Result == 100);
+ assert((int)(size_t)wr1Result == 10);
+ assert((int)(size_t)rdResult == 0);
+ assert((int)(size_t)wr2Result == 100);
return 0;
}
diff --git a/tests/semaphore1.c b/tests/semaphore1.c
index 59e6aee..de349c7 100644
--- a/tests/semaphore1.c
+++ b/tests/semaphore1.c
@@ -119,17 +119,18 @@ main()
{
pthread_t t;
sem_t s;
- int result;
+ void* result1 = (void*)-1;
+ int result2;
assert(pthread_create(&t, NULL, thr, NULL) == 0);
- assert(pthread_join(t, (void *)&result) == 0);
- assert(result == 0);
+ assert(pthread_join(t, (void *)&result1) == 0);
+ assert((int)(size_t)result1 == 0);
assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
- assert((result = sem_trywait(&s)) == -1);
+ assert((result2 = sem_trywait(&s)) == -1);
- if ( result == -1 )
+ if (result2 == -1)
{
int err = errno;
printf("main: sem_trywait 1: expecting error %s: got %s\n",
@@ -141,11 +142,11 @@ main()
printf("main: ok 1\n");
}
- assert((result = sem_post(&s)) == 0);
+ assert((result2 = sem_post(&s)) == 0);
- assert((result = sem_trywait(&s)) == 0);
+ assert((result2 = sem_trywait(&s)) == 0);
- if ( result == -1 )
+ if ( result2 == -1 )
{
perror("main: sem_trywait 2");
}
diff --git a/tests/semaphore4.c b/tests/semaphore4.c
index c2fc948..0ccd45a 100644
--- a/tests/semaphore4.c
+++ b/tests/semaphore4.c
@@ -94,7 +94,6 @@ main()
assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
assert(value == 0);
for (i = 1; i <= MAX_COUNT; i++)
@@ -104,28 +103,23 @@ main()
sched_yield();
assert(sem_getvalue(&s, &value) == 0);
} while (value != -i);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
assert(sem_getvalue(&s, &value) == 0);
assert(-value == MAX_COUNT);
-//printf("value = %d\n", -value); fflush(stdout);
assert(pthread_cancel(t[50]) == 0);
{
- int result;
+ void* result;
assert(pthread_join(t[50], (void *) &result) == 0);
-// printf("result = %d\n", result); fflush(stdout);
}
assert(sem_getvalue(&s, &value) == 0);
-//printf("value = %d\n", -value); fflush(stdout);
assert(-value == (MAX_COUNT - 1));
for (i = MAX_COUNT - 2; i >= 0; i--)
{
assert(sem_post(&s) == 0);
assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
diff --git a/tests/semaphore4t.c b/tests/semaphore4t.c
index 14a4669..97bc7f8 100644
--- a/tests/semaphore4t.c
+++ b/tests/semaphore4t.c
@@ -94,7 +94,6 @@ main()
assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);
assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
assert(value == 0);
for (i = 1; i <= MAX_COUNT; i++)
@@ -104,7 +103,6 @@ main()
sched_yield();
assert(sem_getvalue(&s, &value) == 0);
} while (value != -i);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
@@ -119,7 +117,6 @@ main()
{
assert(sem_post(&s) == 0);
assert(sem_getvalue(&s, &value) == 0);
-// printf("Value = %d\n", value); fflush(stdout);
assert(-value == i);
}
diff --git a/tests/spin4.c b/tests/spin4.c
index b6d3059..2139ffd 100644
--- a/tests/spin4.c
+++ b/tests/spin4.c
@@ -63,7 +63,7 @@ void * func(void * arg)
int
main()
{
- long result = 0;
+ void* result = (void*)0;
pthread_t t;
int CPUs;
struct _timeb sysTime;
@@ -93,7 +93,7 @@ main()
assert(pthread_spin_unlock(&lock) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert(result > 1000);
+ assert((int)(size_t)result > 1000);
assert(pthread_spin_destroy(&lock) == 0);
diff --git a/tests/tsd1.c b/tests/tsd1.c
index de5055a..84d7888 100644
--- a/tests/tsd1.c
+++ b/tests/tsd1.c
@@ -179,9 +179,7 @@ main()
*/
for (i = 1; i < NUM_THREADS; i++)
{
- int result = 0;
-
- assert(pthread_join(thread[i], (void *) &result) == 0);
+ assert(pthread_join(thread[i], NULL) == 0);
}
assert(pthread_key_delete(key) == 0);
diff --git a/tests/tsd2.c b/tests/tsd2.c
index 8aef83b..16e6994 100644
--- a/tests/tsd2.c
+++ b/tests/tsd2.c
@@ -183,9 +183,7 @@ main()
*/
for (i = 1; i < NUM_THREADS; i++)
{
- int result = 0;
-
- assert(pthread_join(thread[i], (void *) &result) == 0);
+ assert(pthread_join(thread[i], NULL) == 0);
}
assert(pthread_key_delete(key) == 0);
diff --git a/tests/valid1.c b/tests/valid1.c
index 4d5cab5..a3913fd 100644
--- a/tests/valid1.c
+++ b/tests/valid1.c
@@ -94,7 +94,7 @@ main()
washere = 0;
assert(pthread_create(&t, NULL, func, NULL) == 0);
assert(pthread_join(t, &result) == 0);
- assert(result == 0);
+ assert((int)(size_t)result == 0);
assert(washere == 1);
sched_yield();
assert(pthread_kill(t, 0) == ESRCH);