summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrpj <rpj>2011-03-06 10:46:44 +0000
committerrpj <rpj>2011-03-06 10:46:44 +0000
commit1183e5acfa10c7bda1dc39034d6e2fa6dec6016f (patch)
treefd5220ed96e0fef2390b72ad170b62f0516242ce /tests
parent85dfeaf6133e1b74eefed26cf76c3f8631c7dd1d (diff)
64 bit compatibility (mingw64)
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/GNUmakefile52
-rw-r--r--tests/barrier5.c4
-rw-r--r--tests/benchtest1.c9
-rw-r--r--tests/benchtest2.c9
-rw-r--r--tests/benchtest3.c9
-rw-r--r--tests/benchtest4.c9
-rw-r--r--tests/benchtest5.c9
-rw-r--r--tests/cancel3.c8
-rw-r--r--tests/cancel4.c8
-rw-r--r--tests/cancel5.c10
-rw-r--r--tests/cancel6a.c8
-rw-r--r--tests/cancel6d.c10
-rw-r--r--tests/cancel7.c6
-rw-r--r--tests/cancel8.c6
-rw-r--r--tests/cancel9.c6
-rw-r--r--tests/condvar2.c4
-rw-r--r--tests/condvar2_1.c6
-rw-r--r--tests/condvar3.c4
-rw-r--r--tests/condvar3_1.c6
-rw-r--r--tests/condvar3_2.c6
-rw-r--r--tests/condvar3_3.c6
-rw-r--r--tests/condvar4.c4
-rw-r--r--tests/condvar5.c4
-rw-r--r--tests/condvar6.c4
-rw-r--r--tests/condvar7.c4
-rw-r--r--tests/condvar8.c4
-rw-r--r--tests/condvar9.c4
-rw-r--r--tests/delay2.c4
-rw-r--r--tests/detach1.c4
-rw-r--r--tests/exception1.c18
-rw-r--r--tests/exit3.c2
-rw-r--r--tests/exit4.c2
-rw-r--r--tests/exit5.c2
-rw-r--r--tests/join1.c4
-rw-r--r--tests/join2.c2
-rw-r--r--tests/join3.c2
-rw-r--r--tests/mutex4.c4
-rw-r--r--tests/mutex8.c4
-rw-r--r--tests/mutex8e.c4
-rw-r--r--tests/mutex8n.c4
-rw-r--r--tests/mutex8r.c4
-rw-r--r--tests/once2.c6
-rw-r--r--tests/once3.c6
-rw-r--r--tests/reuse1.c2
-rw-r--r--tests/rwlock2_t.c4
-rw-r--r--tests/rwlock3_t.c4
-rw-r--r--tests/rwlock4_t.c4
-rw-r--r--tests/rwlock5_t.c4
-rw-r--r--tests/rwlock6.c4
-rw-r--r--tests/rwlock6_t.c12
-rw-r--r--tests/rwlock6_t2.c20
-rw-r--r--tests/rwlock7.c11
-rw-r--r--tests/rwlock8.c11
-rw-r--r--tests/sizes.c36
-rw-r--r--tests/spin3.c4
-rw-r--r--tests/spin4.c17
-rw-r--r--tests/stress1.c10
58 files changed, 303 insertions, 137 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index a42405f..1ca1711 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-06 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * several (MINGW64): Cast and call fixups for 64 bit compatibility;
+ clean build via x86_64-w64-mingw32 cross toolchain on Linux
+ i686 targeting x86_64 win64.
+
2011-03-04 Ross Johnson <Ross dot Johnson at homemail dot com dot au>
* condvar3_2.c: abstime.tv_sec operation warning fixed.
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index 013351f..159e376 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -37,15 +37,21 @@ CP = cp -f
MV = mv -f
RM = rm -f
CAT = cat
-#CP = copy
-#MV = rename
-#RM = erase
-#CAT = type
MKDIR = mkdir
TOUCH = echo Passed >
ECHO = @echo
MAKE = make -k
+# For cross compiling use e.g.
+# # make CROSS=i386-mingw32msvc- clean GC
+CROSS =
+
+AR = $(CROSS)ar
+DLLTOOL = $(CROSS)dlltool
+CC = $(CROSS)gcc
+CXX = $(CROSS)g++
+RANLIB = $(CROSS)ranlib
+
#
# Mingw32
#
@@ -56,6 +62,9 @@ CFLAGS = -O3 -UNDEBUG -Wall $(XXCFLAGS)
BUILD_DIR = ..
INCLUDES = -I.
+.INTERMEDIATE: %.exe %.pass
+.SECONDARY: %.exe %.pass
+.PRECIOUS: %.exe %.pass
TEST = GC
@@ -145,6 +154,9 @@ STATICTESTS = \
exception1 exception2 exception3 \
cancel9 create3 stress1
+ALLTESTS = $(TESTS) $(BENCHTESTS)
+
+ASM = $(ALLTESTS:%=%.s)
PASSES = $(TESTS:%=%.pass)
BENCHRESULTS = $(BENCHTESTS:%=%.bench)
STRESSRESULTS = $(STRESSTESTS:%=%.pass)
@@ -167,34 +179,40 @@ all:
@ $(MAKE) clean GCE
GC:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-pass
+
+GC-asm:
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" all-asm
GCE:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_CXX" all-pass
+ $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_CXX" all-pass
GCX:
- $(MAKE) TEST=GC CC=g++ XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_C" all-pass
+ $(MAKE) TEST=GC CC=$(CXX) XXCFLAGS="-fopenmp -mthreads -D__CLEANUP_C" all-pass
GC-bench:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="benchlib.o" all-bench
GCE-bench:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
+ $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="benchlib." all-bench
GC-debug:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-fopenmp -D__CLEANUP_C" DLL_VER="$(DLL_VER)d" all-pass
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-fopenmp -D__CLEANUP_C" DLL_VER="$(DLL_VER)d" all-pass
GC-static:
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C -DPTW32_STATIC_LIB" XXLIBS="-lws2_32" DLL="" all-static
GC-stress:
$(ECHO) Stress tests can take a long time since they are trying to
$(ECHO) expose weaknesses that may be intermittant or statistically rare.
$(ECHO) A pass does not prove correctness, but may give greater confidence.
- $(MAKE) TEST=GC CC=gcc XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-stress
+ $(MAKE) TEST=GC CC=$(CC) XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-stress
GCE-stress:
- $(MAKE) TEST=GCE CC=g++ XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
+ $(MAKE) TEST=GCE CC=$(CXX) XXCFLAGS="-mthreads -D__CLEANUP_CXX" XXLIBS="" all-stress
+
+all-asm: $(ASM)
+ @ $(ECHO) ALL TESTS PASSED! Congratulations!
all-pass: $(PASSES)
@ $(ECHO) ALL TESTS PASSED! Congratulations!
@@ -347,20 +365,20 @@ valid2.pass: valid1.pass
sizes.pass: sizes.exe
@ $(ECHO) Running $*
- $< > SIZES.$(TEST)
+ ./$< > SIZES.$(TEST)
@ $(CAT) SIZES.$(TEST)
@ $(ECHO) Passed
@ $(TOUCH) $@
%.pass: %.exe
@ $(ECHO) Running $*
- $*
+ ./$*
@ $(ECHO) Passed
@ $(TOUCH) $@
%.bench: $(LIB) $(DLL) $(HDR) $(QAPC) $(XXLIBS) %.exe
@ $(ECHO) Running $*
- $*
+ ./$*
@ $(ECHO) Done
@ $(TOUCH) $@
@@ -373,6 +391,7 @@ sizes.pass: sizes.exe
@ $(CC) -E $(CFLAGS) -o $@ $< $(INCLUDES)
%.s: %.c $(HDR)
+ @ $(ECHO) Compiling $@
@ $(CC) -S $(CFLAGS) -o $@ $< $(INCLUDES)
$(COPYFILES):
@@ -397,6 +416,7 @@ clean:
- $(RM) *.e
- $(RM) *.i
- $(RM) *.o
+ - $(RM) *.s
- $(RM) *.so
- $(RM) *.obj
- $(RM) *.pdb
diff --git a/tests/barrier5.c b/tests/barrier5.c
index b64b7d7..7810638 100644
--- a/tests/barrier5.c
+++ b/tests/barrier5.c
@@ -56,7 +56,7 @@ func(void * crossings)
int result;
int serialThreads = 0;
- while ((LONG)crossings >= (LONG)InterlockedIncrement((LPLONG)&totalThreadCrossings))
+ while ((LONG)(size_t)crossings >= (LONG)InterlockedIncrement((LPLONG)&totalThreadCrossings))
{
result = pthread_barrier_wait(&barrier);
@@ -97,7 +97,7 @@ main()
for (i = 1; i <= j; i++)
{
- assert(pthread_create(&t[i], NULL, func, (void *) Crossings) == 0);
+ assert(pthread_create(&t[i], NULL, func, (void *)(size_t)Crossings) == 0);
}
serialThreadsTotal = 0;
diff --git a/tests/benchtest1.c b/tests/benchtest1.c
index 21e8e64..ba4abc5 100644
--- a/tests/benchtest1.c
+++ b/tests/benchtest1.c
@@ -53,8 +53,13 @@
pthread_mutex_t mx;
pthread_mutexattr_t ma;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTimeStart;
+ struct __timeb64 currSysTimeStop;
+#else
+ struct _timeb currSysTimeStart;
+ struct _timeb currSysTimeStop;
+#endif
long durationMilliSecs;
long overHeadMilliSecs = 0;
int two = 2;
diff --git a/tests/benchtest2.c b/tests/benchtest2.c
index 10deca2..76df9a2 100644
--- a/tests/benchtest2.c
+++ b/tests/benchtest2.c
@@ -60,8 +60,13 @@ CRITICAL_SECTION cs1, cs2;
pthread_mutexattr_t ma;
long durationMilliSecs;
long overHeadMilliSecs = 0;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTimeStart;
+ struct __timeb64 currSysTimeStop;
+#else
+ struct _timeb currSysTimeStart;
+ struct _timeb currSysTimeStop;
+#endif
pthread_t worker;
int running = 0;
diff --git a/tests/benchtest3.c b/tests/benchtest3.c
index 6ff3c90..faf0fdb 100644
--- a/tests/benchtest3.c
+++ b/tests/benchtest3.c
@@ -54,8 +54,13 @@
pthread_mutex_t mx;
old_mutex_t ox;
pthread_mutexattr_t ma;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTimeStart;
+ struct __timeb64 currSysTimeStop;
+#else
+ struct _timeb currSysTimeStart;
+ struct _timeb currSysTimeStop;
+#endif
long durationMilliSecs;
long overHeadMilliSecs = 0;
diff --git a/tests/benchtest4.c b/tests/benchtest4.c
index d64438d..53c529b 100644
--- a/tests/benchtest4.c
+++ b/tests/benchtest4.c
@@ -54,8 +54,13 @@
pthread_mutex_t mx;
old_mutex_t ox;
pthread_mutexattr_t ma;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTimeStart;
+ struct __timeb64 currSysTimeStop;
+#else
+ struct _timeb currSysTimeStart;
+ struct _timeb currSysTimeStop;
+#endif
long durationMilliSecs;
long overHeadMilliSecs = 0;
diff --git a/tests/benchtest5.c b/tests/benchtest5.c
index 0d5c360..83d59c1 100644
--- a/tests/benchtest5.c
+++ b/tests/benchtest5.c
@@ -53,8 +53,13 @@
sem_t sema;
HANDLE w32sema;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTimeStart;
+ struct __timeb64 currSysTimeStop;
+#else
+ struct _timeb currSysTimeStart;
+ struct _timeb currSysTimeStop;
+#endif
long durationMilliSecs;
long overHeadMilliSecs = 0;
int one = 1;
diff --git a/tests/cancel3.c b/tests/cancel3.c
index ff83c4b..8c7bd9f 100644
--- a/tests/cancel3.c
+++ b/tests/cancel3.c
@@ -96,7 +96,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]);
@@ -116,7 +116,7 @@ mythread (void *arg)
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep (100);
- return (void *) (size_t)result;
+ return result;
}
int
@@ -180,9 +180,9 @@ main ()
* 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 = ((int)(size_t)result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel4.c b/tests/cancel4.c
index 28c5d2e..893f33b 100644
--- a/tests/cancel4.c
+++ b/tests/cancel4.c
@@ -98,7 +98,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]);
@@ -118,7 +118,7 @@ mythread(void * arg)
for (bag->count = 0; bag->count < 20; bag->count++)
Sleep(100);
- return (void *) (size_t)result;
+ return result;
}
int
@@ -180,9 +180,9 @@ main()
* 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 = ((int)(size_t)result == (int) PTHREAD_CANCELED);
+ fail = (result == PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel5.c b/tests/cancel5.c
index 17497dd..6c39516 100644
--- a/tests/cancel5.c
+++ b/tests/cancel5.c
@@ -96,7 +96,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]);
@@ -116,7 +116,7 @@ mythread (void *arg)
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep (100);
- return (void *) (size_t)result;
+ return result;
}
int
@@ -171,16 +171,16 @@ main ()
for (i = 1; i <= NUMTHREADS; i++)
{
int fail = 0;
- void* result = (void*)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 = ((int)(size_t)result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel6a.c b/tests/cancel6a.c
index ca79d40..58063d5 100644
--- a/tests/cancel6a.c
+++ b/tests/cancel6a.c
@@ -85,7 +85,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]);
@@ -105,7 +105,7 @@ mythread(void * arg)
for (bag->count = 0; bag->count < 100; bag->count++)
Sleep(100);
- return (void *) (size_t)result;
+ return result;
}
int
@@ -168,9 +168,9 @@ main()
* 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 = ((int)(size_t)result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel6d.c b/tests/cancel6d.c
index e22a3c5..3fd296a 100644
--- a/tests/cancel6d.c
+++ b/tests/cancel6d.c
@@ -86,7 +86,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]);
@@ -109,7 +109,7 @@ mythread(void * arg)
pthread_testcancel();
}
- return (void *) (size_t)result;
+ return result;
}
int
@@ -125,7 +125,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, (void *)(size_t) &threadbag[i]) == 0);
}
/*
@@ -167,9 +167,9 @@ main()
int fail = 0;
void* result = (void*)0;
- assert(pthread_join(t[i], (void *) &result) == 0);
+ assert(pthread_join(t[i], &result) == 0);
- fail = ((int)(size_t)result != (int) PTHREAD_CANCELED);
+ fail = (result != PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel7.c b/tests/cancel7.c
index fde8dab..5f1390f 100644
--- a/tests/cancel7.c
+++ b/tests/cancel7.c
@@ -118,7 +118,9 @@ Win32thread(void * arg)
pthread_testcancel();
}
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
return 0;
+#endif
}
int
@@ -188,13 +190,13 @@ main()
/*
* Can't get a result code.
*/
- result = (int) PTHREAD_CANCELED;
+ result = (int)(size_t)PTHREAD_CANCELED;
#endif
assert(threadbag[i].self.p != NULL);
assert(pthread_kill(threadbag[i].self, 0) == ESRCH);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != (int)(size_t)PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel8.c b/tests/cancel8.c
index 72b9287..7204d19 100644
--- a/tests/cancel8.c
+++ b/tests/cancel8.c
@@ -119,7 +119,9 @@ Win32thread(void * arg)
pthread_cond_wait(&CV, &CVLock);
pthread_cleanup_pop(1);
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
return 0;
+#endif
}
int
@@ -189,13 +191,13 @@ main()
/*
* Can't get a result code.
*/
- result = (int) PTHREAD_CANCELED;
+ result = (int)(size_t)PTHREAD_CANCELED;
#endif
assert(threadbag[i].self.p != NULL);
assert(pthread_kill(threadbag[i].self, 0) == ESRCH);
- fail = (result != (int) PTHREAD_CANCELED);
+ fail = (result != (int)(size_t)PTHREAD_CANCELED);
if (fail)
{
diff --git a/tests/cancel9.c b/tests/cancel9.c
index d4567ef..b009161 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 ((int)(size_t)result == (int)PTHREAD_CANCELED && "test_sleep" != NULL);
+ assert (result == 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 ((int)(size_t)result == (int)PTHREAD_CANCELED && "test_wait");
+ assert (result == 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 ((int)(size_t)result == (int)PTHREAD_CANCELED && "test_udp" != NULL);
+ assert (result == PTHREAD_CANCELED && "test_udp" != NULL);
}
else
{
diff --git a/tests/condvar2.c b/tests/condvar2.c
index 9bd0aba..dd9851b 100644
--- a/tests/condvar2.c
+++ b/tests/condvar2.c
@@ -87,7 +87,11 @@ int
main()
{
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
diff --git a/tests/condvar2_1.c b/tests/condvar2_1.c
index 2cc563a..7d938f8 100644
--- a/tests/condvar2_1.c
+++ b/tests/condvar2_1.c
@@ -106,7 +106,11 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
void* result = (void*)0;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -125,7 +129,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);
}
assert(pthread_mutex_unlock(&mutex) == 0);
diff --git a/tests/condvar3.c b/tests/condvar3.c
index 47077b3..0a6c152 100644
--- a/tests/condvar3.c
+++ b/tests/condvar3.c
@@ -112,7 +112,11 @@ main()
{
pthread_t t[NUMTHREADS];
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert((t[0] = pthread_self()).p != NULL);
diff --git a/tests/condvar3_1.c b/tests/condvar3_1.c
index fe522ce..e747a01 100644
--- a/tests/condvar3_1.c
+++ b/tests/condvar3_1.c
@@ -127,7 +127,11 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
void* result = (void*)0;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -148,7 +152,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 {
diff --git a/tests/condvar3_2.c b/tests/condvar3_2.c
index cc21e9f..399faec 100644
--- a/tests/condvar3_2.c
+++ b/tests/condvar3_2.c
@@ -128,7 +128,11 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
void* result = (void*)0;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cv, NULL) == 0);
@@ -145,7 +149,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);
}
assert(pthread_mutex_unlock(&mutex) == 0);
diff --git a/tests/condvar3_3.c b/tests/condvar3_3.c
index af95046..ae1ed70 100644
--- a/tests/condvar3_3.c
+++ b/tests/condvar3_3.c
@@ -87,7 +87,11 @@ int main()
int rc;
struct timespec abstime = { 0, 0 };
- struct _timeb currSysTime;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
+ struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert(pthread_cond_init(&cnd, 0) == 0);
diff --git a/tests/condvar4.c b/tests/condvar4.c
index 42a8168..8d9fbe9 100644
--- a/tests/condvar4.c
+++ b/tests/condvar4.c
@@ -112,7 +112,11 @@ main()
{
pthread_t t[NUMTHREADS];
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
diff --git a/tests/condvar5.c b/tests/condvar5.c
index c1cd3e5..acbc65a 100644
--- a/tests/condvar5.c
+++ b/tests/condvar5.c
@@ -111,7 +111,11 @@ main()
{
pthread_t t[NUMTHREADS];
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
diff --git a/tests/condvar6.c b/tests/condvar6.c
index e7be0da..ed16e5d 100644
--- a/tests/condvar6.c
+++ b/tests/condvar6.c
@@ -144,7 +144,11 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
diff --git a/tests/condvar7.c b/tests/condvar7.c
index 8df30cb..3975e2c 100644
--- a/tests/condvar7.c
+++ b/tests/condvar7.c
@@ -154,7 +154,11 @@ main()
int i;
pthread_t t[NUMTHREADS + 1];
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
cvthing.shared = 0;
diff --git a/tests/condvar8.c b/tests/condvar8.c
index 564a3ea..96978f2 100644
--- a/tests/condvar8.c
+++ b/tests/condvar8.c
@@ -155,7 +155,11 @@ main()
int first, last;
pthread_t t[NUMTHREADS + 1];
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert((t[0] = pthread_self()).p != NULL);
diff --git a/tests/condvar9.c b/tests/condvar9.c
index 8adffb6..dfcd158 100644
--- a/tests/condvar9.c
+++ b/tests/condvar9.c
@@ -163,7 +163,11 @@ main()
int canceledThreads = 0;
pthread_t t[NUMTHREADS + 1];
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
assert((t[0] = pthread_self()).p != NULL);
diff --git a/tests/delay2.c b/tests/delay2.c
index cdc70a6..2551336 100644
--- a/tests/delay2.c
+++ b/tests/delay2.c
@@ -58,7 +58,7 @@ func(void * arg)
#pragma inline_depth()
#endif
- return (void *) 1;
+ return (void *)(size_t)1;
}
int
@@ -75,7 +75,7 @@ main(int argc, char * argv[])
assert(pthread_mutex_unlock(&mx) == 0);
assert(pthread_join(t, (void *) &result) == 0);
- assert((int)(size_t)result == (int) PTHREAD_CANCELED);
+ assert(result == (void*)PTHREAD_CANCELED);
return 0;
}
diff --git a/tests/detach1.c b/tests/detach1.c
index 165c8c1..89756c7 100644
--- a/tests/detach1.c
+++ b/tests/detach1.c
@@ -46,7 +46,7 @@ enum {
void *
func(void * arg)
{
- int i = (int) arg;
+ int i = (int)(size_t)arg;
Sleep(i * 10);
@@ -65,7 +65,7 @@ main(int argc, char * argv[])
/* Create a few threads and then exit. */
for (i = 0; i < NUMTHREADS; 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 detached, some after. */
diff --git a/tests/exception1.c b/tests/exception1.c
index 4ccc24c..a18e078 100644
--- a/tests/exception1.c
+++ b/tests/exception1.c
@@ -86,7 +86,7 @@ void *
exceptionedThread(void * arg)
{
int dummy = 0;
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
/* Set to async cancelable */
assert(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) == 0);
@@ -110,7 +110,7 @@ exceptionedThread(void * arg)
__except (EXCEPTION_EXECUTE_HANDLER)
{
/* Should get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#elif defined(__cplusplus)
try
@@ -129,7 +129,7 @@ exceptionedThread(void * arg)
#endif
{
/* Should get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#endif
@@ -139,7 +139,7 @@ exceptionedThread(void * arg)
void *
canceledThread(void * arg)
{
- int result = ((int)PTHREAD_CANCELED + 1);
+ void* result = (void*)((int)(size_t)PTHREAD_CANCELED + 1);
int count;
/* Set to async cancelable */
@@ -161,7 +161,7 @@ canceledThread(void * arg)
__except (EXCEPTION_EXECUTE_HANDLER)
{
/* Should NOT get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#elif defined(__cplusplus)
try
@@ -180,7 +180,7 @@ canceledThread(void * arg)
#endif
{
/* Should NOT get into here. */
- result = ((int)PTHREAD_CANCELED + 2);
+ result = (void*)((int)(size_t)PTHREAD_CANCELED + 2);
}
#endif
@@ -229,14 +229,14 @@ main()
void* result = (void*)0;
/* Canceled thread */
- assert(pthread_join(ct[i], (void *) &result) == 0);
- assert(!(fail = ((int)(size_t)result != (int) PTHREAD_CANCELED)));
+ assert(pthread_join(ct[i], &result) == 0);
+ assert(!(fail = (result != PTHREAD_CANCELED)));
failed = (failed || fail);
/* Exceptioned thread */
assert(pthread_join(et[i], (void *) &result) == 0);
- assert(!(fail = ((int)(size_t)result != ((int) PTHREAD_CANCELED + 2))));
+ assert(!(fail = (result != (void*)((int)(size_t)PTHREAD_CANCELED + 2))));
failed = (failed || fail);
}
diff --git a/tests/exit3.c b/tests/exit3.c
index 574a92d..a8b12c8 100644
--- a/tests/exit3.c
+++ b/tests/exit3.c
@@ -58,7 +58,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/tests/exit4.c b/tests/exit4.c
index e8cd88a..06dd8b1 100644
--- a/tests/exit4.c
+++ b/tests/exit4.c
@@ -111,7 +111,7 @@ Win32thread(void * arg)
/*
* Doesn't return and doesn't create an implicit POSIX handle.
*/
- pthread_exit((void *) result);
+ pthread_exit((void *)(size_t)result);
return 0;
}
diff --git a/tests/exit5.c b/tests/exit5.c
index 15e1bc9..ac98f99 100644
--- a/tests/exit5.c
+++ b/tests/exit5.c
@@ -115,7 +115,7 @@ Win32thread(void * arg)
/*
* Doesn't return.
*/
- pthread_exit((void *) result);
+ pthread_exit((void *)(size_t)result);
return 0;
}
diff --git a/tests/join1.c b/tests/join1.c
index b00026a..631b604 100644
--- a/tests/join1.c
+++ b/tests/join1.c
@@ -41,7 +41,7 @@
void *
func(void * arg)
{
- int i = (int) arg;
+ int i = (int)(size_t)arg;
Sleep(i * 100);
@@ -61,7 +61,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);
}
/* Some threads will finish before they are joined, some after. */
diff --git a/tests/join2.c b/tests/join2.c
index 036daf5..82682a8 100644
--- a/tests/join2.c
+++ b/tests/join2.c
@@ -55,7 +55,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);
}
for (i = 0; i < 4; i++)
diff --git a/tests/join3.c b/tests/join3.c
index dc73e99..acdc5fe 100644
--- a/tests/join3.c
+++ b/tests/join3.c
@@ -55,7 +55,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);
}
/*
diff --git a/tests/mutex4.c b/tests/mutex4.c
index 547d9cb..b728722 100644
--- a/tests/mutex4.c
+++ b/tests/mutex4.c
@@ -49,7 +49,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);
@@ -72,7 +72,7 @@ main()
/*
* NORMAL (fast) mutexes don't check ownership.
*/
- assert(pthread_create(&t, NULL, unlocker, (void *) 0) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void *)(size_t)0) == 0);
assert(pthread_join(t, NULL) == 0);
assert(pthread_mutex_unlock(&mutex1) == EPERM);
assert(wasHere == 2);
diff --git a/tests/mutex8.c b/tests/mutex8.c
index f019006..9798f5a 100644
--- a/tests/mutex8.c
+++ b/tests/mutex8.c
@@ -44,7 +44,11 @@ static pthread_mutex_t mutex;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/mutex8e.c b/tests/mutex8e.c
index 4720bc6..0e1cbd7 100644
--- a/tests/mutex8e.c
+++ b/tests/mutex8e.c
@@ -52,7 +52,11 @@ static pthread_mutexattr_t mxAttr;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/mutex8n.c b/tests/mutex8n.c
index 193107e..c7141e3 100644
--- a/tests/mutex8n.c
+++ b/tests/mutex8n.c
@@ -52,7 +52,11 @@ static pthread_mutexattr_t mxAttr;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/mutex8r.c b/tests/mutex8r.c
index e48df5b..58242fe 100644
--- a/tests/mutex8r.c
+++ b/tests/mutex8r.c
@@ -52,7 +52,11 @@ static pthread_mutexattr_t mxAttr;
void * locker(void * arg)
{
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/once2.c b/tests/once2.c
index 248ccb1..84e3f4b 100644
--- a/tests/once2.c
+++ b/tests/once2.c
@@ -70,11 +70,11 @@ myfunc(void)
void *
mythread(void * arg)
{
- assert(pthread_once(&once[(int) arg], myfunc) == 0);
+ assert(pthread_once(&once[(int)(size_t)arg], myfunc) == 0);
EnterCriticalSection(&numThreads.cs);
numThreads.i++;
LeaveCriticalSection(&numThreads.cs);
- return 0;
+ return (void*)(size_t)0;
}
int
@@ -91,7 +91,7 @@ main()
once[j] = o;
for (i = 0; i < NUM_THREADS; i++)
- assert(pthread_create(&t[i][j], NULL, mythread, (void *) j) == 0);
+ assert(pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j) == 0);
}
for (j = 0; j < NUM_ONCE; j++)
diff --git a/tests/once3.c b/tests/once3.c
index c706f80..e1886c1 100644
--- a/tests/once3.c
+++ b/tests/once3.c
@@ -86,11 +86,11 @@ mythread(void * arg)
* eventually cancels only when it becomes the new once thread.
*/
assert(pthread_cancel(pthread_self()) == 0);
- assert(pthread_once(&once[(int) arg], myfunc) == 0);
+ assert(pthread_once(&once[(int)(size_t)arg], myfunc) == 0);
EnterCriticalSection(&numThreads.cs);
numThreads.i++;
LeaveCriticalSection(&numThreads.cs);
- return 0;
+ return (void*)(size_t)0;
}
int
@@ -108,7 +108,7 @@ main()
for (i = 0; i < NUM_THREADS; i++)
{
- assert(pthread_create(&t[i][j], NULL, mythread, (void *) j) == 0);
+ assert(pthread_create(&t[i][j], NULL, mythread, (void *)(size_t)j) == 0);
}
}
diff --git a/tests/reuse1.c b/tests/reuse1.c
index 2b9cf57..1a7dff0 100644
--- a/tests/reuse1.c
+++ b/tests/reuse1.c
@@ -107,7 +107,7 @@ main()
for (i = 1; i < NUMTHREADS; i++)
{
washere = 0;
- assert(pthread_create(&t, &attr, func, (void *) i) == 0);
+ assert(pthread_create(&t, &attr, func, (void *)(size_t)i) == 0);
pthread_join(t, &result);
assert((int)(size_t) result == i);
assert(washere == 1);
diff --git a/tests/rwlock2_t.c b/tests/rwlock2_t.c
index f49879e..af7ef05 100644
--- a/tests/rwlock2_t.c
+++ b/tests/rwlock2_t.c
@@ -50,7 +50,11 @@ int
main()
{
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/rwlock3_t.c b/tests/rwlock3_t.c
index f77fccb..60798dd 100644
--- a/tests/rwlock3_t.c
+++ b/tests/rwlock3_t.c
@@ -63,7 +63,11 @@ main()
{
pthread_t t;
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/rwlock4_t.c b/tests/rwlock4_t.c
index 5df5c05..cccfd27 100644
--- a/tests/rwlock4_t.c
+++ b/tests/rwlock4_t.c
@@ -63,7 +63,11 @@ main()
{
pthread_t t;
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/rwlock5_t.c b/tests/rwlock5_t.c
index 4e6d644..96b4348 100644
--- a/tests/rwlock5_t.c
+++ b/tests/rwlock5_t.c
@@ -65,7 +65,11 @@ main()
{
pthread_t t;
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
diff --git a/tests/rwlock6.c b/tests/rwlock6.c
index 3f305e8..8861823 100644
--- a/tests/rwlock6.c
+++ b/tests/rwlock6.c
@@ -57,7 +57,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)
@@ -68,7 +68,7 @@ void * rdfunc(void * arg)
ba = bankAccount;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
int
diff --git a/tests/rwlock6_t.c b/tests/rwlock6_t.c
index 6151d75..4af85d9 100644
--- a/tests/rwlock6_t.c
+++ b/tests/rwlock6_t.c
@@ -55,14 +55,18 @@ void * wrfunc(void * arg)
bankAccount += 10;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) bankAccount);
+ return ((void *)(size_t)bankAccount);
}
void * rdfunc(void * arg)
{
int ba = -1;
struct timespec abstime = { 0, 0 };
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
@@ -85,7 +89,7 @@ void * rdfunc(void * arg)
assert(pthread_rwlock_unlock(&rwlock1) == 0);
}
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
int
@@ -104,11 +108,11 @@ main()
assert(pthread_create(&wrt1, NULL, wrfunc, NULL) == 0);
Sleep(500);
- assert(pthread_create(&rdt1, NULL, rdfunc, (void *) 1) == 0);
+ assert(pthread_create(&rdt1, NULL, rdfunc, (void *)(size_t)1) == 0);
Sleep(500);
assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0);
Sleep(500);
- assert(pthread_create(&rdt2, NULL, rdfunc, (void *) 2) == 0);
+ assert(pthread_create(&rdt2, NULL, rdfunc, (void *)(size_t)2) == 0);
assert(pthread_join(wrt1, (void *) &wr1Result) == 0);
assert(pthread_join(rdt1, (void *) &rd1Result) == 0);
diff --git a/tests/rwlock6_t2.c b/tests/rwlock6_t2.c
index 8d658b4..28de466 100644
--- a/tests/rwlock6_t2.c
+++ b/tests/rwlock6_t2.c
@@ -60,7 +60,7 @@ void * wrfunc(void * arg)
Sleep(2000);
bankAccount += 10;
assert(pthread_rwlock_unlock(&rwlock1) == 0);
- return ((void *) bankAccount);
+ return ((void *)(size_t)bankAccount);
}
else if ((int) (size_t)arg == 2)
{
@@ -68,7 +68,7 @@ void * wrfunc(void * arg)
return ((void *) 100);
}
- return ((void *) -1);
+ return ((void *)(size_t)-1);
}
void * rdfunc(void * arg)
@@ -77,7 +77,7 @@ void * rdfunc(void * arg)
assert(pthread_rwlock_timedrdlock(&rwlock1, &abstime) == ETIMEDOUT);
- return ((void *) ba);
+ return ((void *)(size_t)ba);
}
int
@@ -89,7 +89,11 @@ main()
void* wr1Result = (void*)0;
void* wr2Result = (void*)0;
void* rdResult = (void*)0;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
const DWORD NANOSEC_PER_MILLISEC = 1000000;
PTW32_FTIME(&currSysTime);
@@ -101,15 +105,15 @@ main()
bankAccount = 0;
- assert(pthread_create(&wrt1, NULL, wrfunc, (void *) 1) == 0);
+ assert(pthread_create(&wrt1, NULL, wrfunc, (void *)(size_t)1) == 0);
Sleep(100);
assert(pthread_create(&rdt, NULL, rdfunc, NULL) == 0);
Sleep(100);
- assert(pthread_create(&wrt2, NULL, wrfunc, (void *) 2) == 0);
+ assert(pthread_create(&wrt2, NULL, wrfunc, (void *)(size_t)2) == 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((int)(size_t)wr1Result == 10);
assert((int)(size_t)rdResult == 0);
diff --git a/tests/rwlock7.c b/tests/rwlock7.c
index 1e8fdf0..33e87e2 100644
--- a/tests/rwlock7.c
+++ b/tests/rwlock7.c
@@ -108,8 +108,13 @@ main (int argc, char *argv[])
int data_updates = 0;
int seed = 1;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime1;
+ struct __timeb64 currSysTime2;
+#else
struct _timeb currSysTime1;
struct _timeb currSysTime2;
+#endif
/*
* Initialize the shared data.
@@ -135,7 +140,7 @@ main (int argc, char *argv[])
threads[count].seed = 1 + rand_r (&seed) % 71;
assert(pthread_create (&threads[count].thread_id,
- NULL, thread_routine, (void*)&threads[count]) == 0);
+ NULL, thread_routine, (void*)(size_t)&threads[count]) == 0);
}
/*
@@ -190,8 +195,8 @@ main (int argc, char *argv[])
PTW32_FTIME(&currSysTime2);
printf( "\nstart: %ld/%d, stop: %ld/%d, duration:%ld\n",
- currSysTime1.time,currSysTime1.millitm,
- currSysTime2.time,currSysTime2.millitm,
+ (long)currSysTime1.time,currSysTime1.millitm,
+ (long)currSysTime2.time,currSysTime2.millitm,
((long)((currSysTime2.time*1000+currSysTime2.millitm) -
(currSysTime1.time*1000+currSysTime1.millitm))));
diff --git a/tests/rwlock8.c b/tests/rwlock8.c
index 207646c..28552ba 100644
--- a/tests/rwlock8.c
+++ b/tests/rwlock8.c
@@ -114,8 +114,13 @@ main (int argc, char *argv[])
int data_updates = 0;
int seed = 1;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime1;
+ struct __timeb64 currSysTime2;
+#else
struct _timeb currSysTime1;
struct _timeb currSysTime2;
+#endif
/*
* Initialize the shared data.
@@ -141,7 +146,7 @@ main (int argc, char *argv[])
threads[count].seed = 1 + rand_r (&seed) % 71;
assert(pthread_create (&threads[count].thread_id,
- NULL, thread_routine, (void*)&threads[count]) == 0);
+ NULL, thread_routine, (void*)(size_t)&threads[count]) == 0);
}
/*
@@ -196,8 +201,8 @@ main (int argc, char *argv[])
PTW32_FTIME(&currSysTime2);
printf( "\nstart: %ld/%d, stop: %ld/%d, duration:%ld\n",
- currSysTime1.time,currSysTime1.millitm,
- currSysTime2.time,currSysTime2.millitm,
+ (long)currSysTime1.time,currSysTime1.millitm,
+ (long)currSysTime2.time,currSysTime2.millitm,
((long)((currSysTime2.time*1000+currSysTime2.millitm) -
(currSysTime1.time*1000+currSysTime1.millitm))));
diff --git a/tests/sizes.c b/tests/sizes.c
index 73c7261..554d0e8 100644
--- a/tests/sizes.c
+++ b/tests/sizes.c
@@ -8,24 +8,24 @@ main()
{
printf("Sizes of pthreads-win32 structs\n");
printf("-------------------------------\n");
- printf("%30s %4d\n", "pthread_t", sizeof(pthread_t));
- printf("%30s %4d\n", "ptw32_thread_t", sizeof(ptw32_thread_t));
- printf("%30s %4d\n", "pthread_attr_t_", sizeof(struct pthread_attr_t_));
- printf("%30s %4d\n", "sem_t_", sizeof(struct sem_t_));
- printf("%30s %4d\n", "pthread_mutex_t_", sizeof(struct pthread_mutex_t_));
- printf("%30s %4d\n", "pthread_mutexattr_t_", sizeof(struct pthread_mutexattr_t_));
- printf("%30s %4d\n", "pthread_spinlock_t_", sizeof(struct pthread_spinlock_t_));
- printf("%30s %4d\n", "pthread_barrier_t_", sizeof(struct pthread_barrier_t_));
- printf("%30s %4d\n", "pthread_barrierattr_t_", sizeof(struct pthread_barrierattr_t_));
- printf("%30s %4d\n", "pthread_key_t_", sizeof(struct pthread_key_t_));
- printf("%30s %4d\n", "pthread_cond_t_", sizeof(struct pthread_cond_t_));
- printf("%30s %4d\n", "pthread_condattr_t_", sizeof(struct pthread_condattr_t_));
- printf("%30s %4d\n", "pthread_rwlock_t_", sizeof(struct pthread_rwlock_t_));
- printf("%30s %4d\n", "pthread_rwlockattr_t_", sizeof(struct pthread_rwlockattr_t_));
- printf("%30s %4d\n", "pthread_once_t_", sizeof(struct pthread_once_t_));
- printf("%30s %4d\n", "ptw32_cleanup_t", sizeof(struct ptw32_cleanup_t));
- printf("%30s %4d\n", "ptw32_mcs_node_t_", sizeof(struct ptw32_mcs_node_t_));
- printf("%30s %4d\n", "sched_param", sizeof(struct sched_param));
+ printf("%30s %4d\n", "pthread_t", (int)sizeof(pthread_t));
+ printf("%30s %4d\n", "ptw32_thread_t", (int)sizeof(ptw32_thread_t));
+ printf("%30s %4d\n", "pthread_attr_t_", (int)sizeof(struct pthread_attr_t_));
+ printf("%30s %4d\n", "sem_t_", (int)sizeof(struct sem_t_));
+ printf("%30s %4d\n", "pthread_mutex_t_", (int)sizeof(struct pthread_mutex_t_));
+ printf("%30s %4d\n", "pthread_mutexattr_t_", (int)sizeof(struct pthread_mutexattr_t_));
+ printf("%30s %4d\n", "pthread_spinlock_t_", (int)sizeof(struct pthread_spinlock_t_));
+ printf("%30s %4d\n", "pthread_barrier_t_", (int)sizeof(struct pthread_barrier_t_));
+ printf("%30s %4d\n", "pthread_barrierattr_t_", (int)sizeof(struct pthread_barrierattr_t_));
+ printf("%30s %4d\n", "pthread_key_t_", (int)sizeof(struct pthread_key_t_));
+ printf("%30s %4d\n", "pthread_cond_t_", (int)sizeof(struct pthread_cond_t_));
+ printf("%30s %4d\n", "pthread_condattr_t_", (int)sizeof(struct pthread_condattr_t_));
+ printf("%30s %4d\n", "pthread_rwlock_t_", (int)sizeof(struct pthread_rwlock_t_));
+ printf("%30s %4d\n", "pthread_rwlockattr_t_", (int)sizeof(struct pthread_rwlockattr_t_));
+ printf("%30s %4d\n", "pthread_once_t_", (int)sizeof(struct pthread_once_t_));
+ printf("%30s %4d\n", "ptw32_cleanup_t", (int)sizeof(struct ptw32_cleanup_t));
+ printf("%30s %4d\n", "ptw32_mcs_node_t_", (int)sizeof(struct ptw32_mcs_node_t_));
+ printf("%30s %4d\n", "sched_param", (int)sizeof(struct sched_param));
printf("-------------------------------\n");
return 0;
diff --git a/tests/spin3.c b/tests/spin3.c
index 8c0dae6..fa16b35 100644
--- a/tests/spin3.c
+++ b/tests/spin3.c
@@ -46,7 +46,7 @@ static pthread_spinlock_t spin;
void * unlocker(void * arg)
{
- int expectedResult = (int) arg;
+ int expectedResult = (int)(size_t)arg;
wasHere++;
assert(pthread_spin_unlock(&spin) == expectedResult);
@@ -62,7 +62,7 @@ main()
wasHere = 0;
assert(pthread_spin_init(&spin, PTHREAD_PROCESS_PRIVATE) == 0);
assert(pthread_spin_lock(&spin) == 0);
- assert(pthread_create(&t, NULL, unlocker, (void *) 0) == 0);
+ assert(pthread_create(&t, NULL, unlocker, (void*)0) == 0);
assert(pthread_join(t, NULL) == 0);
assert(pthread_spin_unlock(&spin) == EPERM);
assert(pthread_spin_destroy(&spin) == 0);
diff --git a/tests/spin4.c b/tests/spin4.c
index 2139ffd..44527fe 100644
--- a/tests/spin4.c
+++ b/tests/spin4.c
@@ -41,8 +41,13 @@
#include <sys/timeb.h>
pthread_spinlock_t lock = PTHREAD_SPINLOCK_INITIALIZER;
-struct _timeb currSysTimeStart;
-struct _timeb currSysTimeStop;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTimeStart;
+ struct __timeb64 currSysTimeStop;
+#else
+ struct _timeb currSysTimeStart;
+ struct _timeb currSysTimeStop;
+#endif
#define GetDurationMilliSecs(_TStart, _TStop) ((_TStop.time*1000+_TStop.millitm) \
- (_TStart.time*1000+_TStart.millitm))
@@ -57,7 +62,7 @@ void * func(void * arg)
assert(pthread_spin_unlock(&lock) == 0);
PTW32_FTIME(&currSysTimeStop);
- return (void *) (size_t)GetDurationMilliSecs(currSysTimeStart, currSysTimeStop);
+ return (void *)(size_t)GetDurationMilliSecs(currSysTimeStart, currSysTimeStop);
}
int
@@ -66,7 +71,11 @@ main()
void* result = (void*)0;
pthread_t t;
int CPUs;
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 sysTime;
+#else
struct _timeb sysTime;
+#endif
if ((CPUs = pthread_num_processors_np()) == 1)
{
@@ -92,7 +101,7 @@ main()
assert(pthread_spin_unlock(&lock) == 0);
- assert(pthread_join(t, (void *) &result) == 0);
+ assert(pthread_join(t, &result) == 0);
assert((int)(size_t)result > 1000);
assert(pthread_spin_destroy(&lock) == 0);
diff --git a/tests/stress1.c b/tests/stress1.c
index fb50124..e4dbbd2 100644
--- a/tests/stress1.c
+++ b/tests/stress1.c
@@ -111,7 +111,11 @@ enum {
struct timespec *
millisecondsFromNow (struct timespec * time, int millisecs)
{
+#if (defined(__MINGW64__) || defined(__MINGW32__)) && __MSVCRT_VERSION__ >= 0x0601
+ struct __timeb64 currSysTime;
+#else
struct _timeb currSysTime;
+#endif
int64_t nanosecs, secs;
const int64_t NANOSEC_PER_MILLISEC = 1000000;
const int64_t NANOSEC_PER_SEC = 1000000000;
@@ -141,9 +145,9 @@ millisecondsFromNow (struct timespec * time, int millisecs)
void *
masterThread (void * arg)
{
- int dither = (int) arg;
+ int dither = (int)(size_t)arg;
- timeout = (int) arg;
+ timeout = (int)(size_t)arg;
pthread_barrier_wait(&startBarrier);
@@ -239,7 +243,7 @@ main ()
assert(pthread_barrier_init(&readyBarrier, NULL, 3) == 0);
assert(pthread_barrier_init(&holdBarrier, NULL, 3) == 0);
- assert(pthread_create(&master, NULL, masterThread, (void *) timeout) == 0);
+ assert(pthread_create(&master, NULL, masterThread, (void *)(size_t)timeout) == 0);
assert(pthread_create(&slave, NULL, slaveThread, NULL) == 0);
allExit = FALSE;