diff options
author | rpj <rpj> | 2011-03-06 15:01:05 +0000 |
---|---|---|
committer | rpj <rpj> | 2011-03-06 15:01:05 +0000 |
commit | a39dab139b7c301ffd5a5592c292123c54e686cd (patch) | |
tree | 73aeb7a868f7c075de9ec43344d17d21f99763f9 | |
parent | 1183e5acfa10c7bda1dc39034d6e2fa6dec6016f (diff) |
More 64 bit cast fixups
41 files changed, 84 insertions, 69 deletions
@@ -21,7 +21,7 @@ OPTIM = /O2 RC = brcc32 RCFLAGS = -i. -CFLAGS = /q /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H=1 /4 /tWD /tWM \ +CFLAGS = /q /I. /D_WIN32_WINNT=0x400 /DHAVE_PTW32_CONFIG_H=1 /4 /tWD /tWM \ /w-aus /w-asc /w-par #C cleanup code diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 334b945..836e105 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -7,7 +7,7 @@ Ben Elliston bje at cygnus dot com Initiated the project; setup the project infrastructure (CVS, web page, etc.); early prototype routines. -Ross Johnson rpj at callisto dot canberra dot edu dot au +Ross Johnson Ross dot Johnson at dot homemail dot com dot au early prototype routines; ongoing project coordination/maintenance; implementation of spin locks and barriers; @@ -131,4 +131,4 @@ Vladimir Kliatchko vladimir at kliatchko dot com Ramiro Polla ramiro.polla at gmail.com static library auto init/cleanup on application start/exit via RT hooks (MSC and GCC compilers only). -
\ No newline at end of file + diff --git a/GNUmakefile b/GNUmakefile index ceffd9f..b357c39 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -99,7 +99,7 @@ GCE_CFLAGS = $(PTW32_FLAGS) -mthreads ## Mingw32 MAKE ?= make -CFLAGS = $(OPT) $(XOPT) -I. -DHAVE_CONFIG_H -Wall +CFLAGS = $(OPT) $(XOPT) -I. -DHAVE_PTW32_CONFIG_H -Wall DLL_INLINED_OBJS = \ pthread.o \ @@ -27,7 +27,7 @@ STATIC_STAMPS = pthreadVCE$(DLL_VER).static pthreadVSE$(DLL_VER).static pthreadV OPTIM = /O2 /Ob2 OPTIMD = -CFLAGS = /W3 /MD /nologo /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H +CFLAGS = /W3 /MD /nologo /I. /D_WIN32_WINNT=0x400 /DHAVE_PTW32_CONFIG_H CFLAGSD = /Z7 $(CFLAGS) # Uncomment this if config.h defines RETAIN_WSALASTERROR @@ -4,7 +4,7 @@ VERSION = - CCFLAGS = -V -g $(CC.DLL) -HAVE_CONFIG_H == 1 +HAVE_PTW32_CONFIG_H == 1 _MT == 1 _timeb == timeb _ftime == ftime diff --git a/autostatic.c b/autostatic.c index ab9326a..e60bd12 100755 --- a/autostatic.c +++ b/autostatic.c @@ -1,8 +1,8 @@ /* - * pthread_barrier_wait.c + * autostatic.c * * Description: - * This translation unit implements barrier primitives. + * This translation unit implements static auto-init and auto-exit logic. * * -------------------------------------------------------------------------- * diff --git a/builddmc.bat b/builddmc.bat index 3edbaeb..bf813d8 100644 --- a/builddmc.bat +++ b/builddmc.bat @@ -3,7 +3,7 @@ set DMCDIR=c:\dm ; RELEASE -%DMCDIR%\bin\dmc -D_WIN32_WINNT -D_MT -DHAVE_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/NODEBUG -L/SU:WINDOWS +%DMCDIR%\bin\dmc -D_WIN32_WINNT -D_MT -DHAVE_PTW32_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/NODEBUG -L/SU:WINDOWS ; DEBUG -%DMCDIR%\bin\dmc -g -D_WIN32_WINNT -D_MT -DHAVE_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/SU:WINDOWS +%DMCDIR%\bin\dmc -g -D_WIN32_WINNT -D_MT -DHAVE_PTW32_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/SU:WINDOWS diff --git a/need_errno.h b/need_errno.h index 6099479..314e518 100644 --- a/need_errno.h +++ b/need_errno.h @@ -20,8 +20,8 @@ #ifndef _INC_ERRNO #define _INC_ERRNO -#if !defined(_WIN32) && !defined(_MAC) -#error ERROR: Only Mac or Win32 targets supported! +#if !defined(_WIN32) +#error ERROR: Only Win32 targets supported! #endif #include <winsock.h> @@ -112,7 +112,7 @@ #ifdef _UWIN # define HAVE_STRUCT_TIMESPEC 1 # define HAVE_SIGNAL_H 1 -# undef HAVE_CONFIG_H +# undef HAVE_PTW32_CONFIG_H # pragma comment(lib, "pthread") #endif @@ -210,9 +210,9 @@ typedef unsigned long DWORD_PTR; * ----------------- */ -#if HAVE_CONFIG_H +#if HAVE_PTW32_CONFIG_H #include "config.h" -#endif /* HAVE_CONFIG_H */ +#endif /* HAVE_PTW32_CONFIG_H */ #ifndef NEED_FTIME #include <time.h> diff --git a/pthread_cancel.c b/pthread_cancel.c index 8ef2a11..1d2ea67 100644 --- a/pthread_cancel.c +++ b/pthread_cancel.c @@ -47,7 +47,7 @@ ptw32_cancel_self (void) } static void CALLBACK -ptw32_cancel_callback (DWORD unused) +ptw32_cancel_callback (ULONG_PTR unused) { ptw32_throw (PTW32_EPS_CANCEL); diff --git a/ptw32_MCS_lock.c b/ptw32_MCS_lock.c index bb942ba..ff74efa 100644 --- a/ptw32_MCS_lock.c +++ b/ptw32_MCS_lock.c @@ -148,7 +148,10 @@ ptw32_mcs_flag_wait (LONG * flag) * Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors. * ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991. */ -INLINE void +#ifdef PTW32_BUILD_INLINED +INLINE +#endif /* PTW32_BUILD_INLINED */ +void ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node) { ptw32_mcs_local_node_t *pred; @@ -179,7 +182,10 @@ ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node) * Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors. * ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991. */ -INLINE void +#ifdef PTW32_BUILD_INLINED +INLINE +#endif /* PTW32_BUILD_INLINED */ +void ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node) { ptw32_mcs_lock_t *lock = node->lock; @@ -212,7 +218,10 @@ ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node) /* * ptw32_mcs_lock_try_acquire */ -INLINE int +#ifdef PTW32_BUILD_INLINED +INLINE +#endif /* PTW32_BUILD_INLINED */ +int ptw32_mcs_lock_try_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node) { node->lock = lock; @@ -238,7 +247,10 @@ ptw32_mcs_lock_try_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * no * * Should only be called by the thread that has the lock. */ -INLINE void +#ifdef PTW32_BUILD_INLINED +INLINE +#endif /* PTW32_BUILD_INLINED */ +void ptw32_mcs_node_transfer (ptw32_mcs_local_node_t * new_node, ptw32_mcs_local_node_t * old_node) { new_node->lock = old_node->lock; diff --git a/ptw32_relmillisecs.c b/ptw32_relmillisecs.c index c9d39f3..a82bfb7 100644 --- a/ptw32_relmillisecs.c +++ b/ptw32_relmillisecs.c @@ -41,7 +41,10 @@ #endif -INLINE DWORD +#ifdef PTW32_BUILD_INLINED +INLINE +#endif /* PTW32_BUILD_INLINED */ +DWORD ptw32_relmillisecs (const struct timespec * abstime) { const int64_t NANOSEC_PER_MILLISEC = 1000000; diff --git a/tests/SIZES.GCE b/tests/SIZES.GCE index a9ea64d..7048d3a 100755 --- a/tests/SIZES.GCE +++ b/tests/SIZES.GCE @@ -1,21 +1,21 @@ -Sizes of pthreads-win32 structs -------------------------------- +Sizes of pthreads-win32 structs
+-------------------------------
pthread_t 8
ptw32_thread_t 76
- pthread_attr_t_ 28 + pthread_attr_t_ 28
sem_t_ 12
pthread_mutex_t_ 24
- pthread_mutexattr_t_ 8 - pthread_spinlock_t_ 8 + pthread_mutexattr_t_ 8
+ pthread_spinlock_t_ 8
pthread_barrier_t_ 36
- pthread_barrierattr_t_ 4 - pthread_key_t_ 16 - pthread_cond_t_ 32 - pthread_condattr_t_ 4 - pthread_rwlock_t_ 28 - pthread_rwlockattr_t_ 4 + pthread_barrierattr_t_ 4
+ pthread_key_t_ 16
+ pthread_cond_t_ 32
+ pthread_condattr_t_ 4
+ pthread_rwlock_t_ 28
+ pthread_rwlockattr_t_ 4
pthread_once_t_ 16
- ptw32_cleanup_t 12 + ptw32_cleanup_t 12
ptw32_mcs_node_t_ 16
- sched_param 4 -------------------------------- + sched_param 4
+-------------------------------
diff --git a/tests/barrier3.c b/tests/barrier3.c index f65b60c..dece770 100644 --- a/tests/barrier3.c +++ b/tests/barrier3.c @@ -60,7 +60,7 @@ main() assert(pthread_create(&t, NULL, func, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == PTHREAD_BARRIER_SERIAL_THREAD); diff --git a/tests/barrier5.c b/tests/barrier5.c index 7810638..3533840 100644 --- a/tests/barrier5.c +++ b/tests/barrier5.c @@ -103,7 +103,7 @@ main() serialThreadsTotal = 0; for (i = 1; i <= j; i++) { - assert(pthread_join(t[i], (void *) &result) == 0); + assert(pthread_join(t[i], &result) == 0); serialThreadsTotal += (int)(size_t)result; } diff --git a/tests/cancel2.c b/tests/cancel2.c index 4669a28..d7c7f86 100644 --- a/tests/cancel2.c +++ b/tests/cancel2.c @@ -219,7 +219,7 @@ 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); if (fail) { diff --git a/tests/cleanup0.c b/tests/cleanup0.c index c840afe..d9fbedc 100644 --- a/tests/cleanup0.c +++ b/tests/cleanup0.c @@ -191,7 +191,7 @@ 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); diff --git a/tests/cleanup1.c b/tests/cleanup1.c index b326549..30d4940 100644 --- a/tests/cleanup1.c +++ b/tests/cleanup1.c @@ -205,7 +205,7 @@ 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); diff --git a/tests/cleanup2.c b/tests/cleanup2.c index fa32b69..67037c2 100644 --- a/tests/cleanup2.c +++ b/tests/cleanup2.c @@ -180,7 +180,7 @@ 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 != 0); diff --git a/tests/cleanup3.c b/tests/cleanup3.c index 575ffbd..62317b3 100644 --- a/tests/cleanup3.c +++ b/tests/cleanup3.c @@ -185,7 +185,7 @@ 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 != 0); diff --git a/tests/condvar1_2.c b/tests/condvar1_2.c index b985c5d..3d961f0 100644 --- a/tests/condvar1_2.c +++ b/tests/condvar1_2.c @@ -116,7 +116,7 @@ main() } while (j > 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert ((int)(size_t)result == 0); } diff --git a/tests/condvar2_1.c b/tests/condvar2_1.c index 7d938f8..7607abd 100644 --- a/tests/condvar2_1.c +++ b/tests/condvar2_1.c @@ -136,7 +136,7 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_join(t[i], (void *) &result) == 0); + assert(pthread_join(t[i], &result) == 0); assert((int)(size_t)result == i); } diff --git a/tests/condvar3_1.c b/tests/condvar3_1.c index e747a01..bc539d5 100644 --- a/tests/condvar3_1.c +++ b/tests/condvar3_1.c @@ -172,7 +172,7 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_join(t[i], (void *) &result) == 0); + assert(pthread_join(t[i], &result) == 0); assert((int)(size_t)result == i); } diff --git a/tests/condvar3_2.c b/tests/condvar3_2.c index 399faec..192b842 100644 --- a/tests/condvar3_2.c +++ b/tests/condvar3_2.c @@ -156,7 +156,7 @@ main() for (i = 1; i <= NUMTHREADS; i++) { - assert(pthread_join(t[i], (void *) &result) == 0); + assert(pthread_join(t[i], &result) == 0); assert((int)(size_t)result == i); /* * Approximately 2/3rds of the threads are expected to time out. diff --git a/tests/delay2.c b/tests/delay2.c index 2551336..071b837 100644 --- a/tests/delay2.c +++ b/tests/delay2.c @@ -74,7 +74,7 @@ main(int argc, char * argv[]) assert(pthread_mutex_unlock(&mx) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert(result == (void*)PTHREAD_CANCELED); return 0; diff --git a/tests/exception1.c b/tests/exception1.c index a18e078..62a5a63 100644 --- a/tests/exception1.c +++ b/tests/exception1.c @@ -235,7 +235,7 @@ main() failed = (failed || fail); /* Exceptioned thread */ - assert(pthread_join(et[i], (void *) &result) == 0); + assert(pthread_join(et[i], &result) == 0); assert(!(fail = (result != (void*)((int)(size_t)PTHREAD_CANCELED + 2)))); failed = (failed || fail); diff --git a/tests/exception2.c b/tests/exception2.c index 222d305..faf677d 100644 --- a/tests/exception2.c +++ b/tests/exception2.c @@ -113,7 +113,7 @@ exceptionedThread(void * arg) } int -main(int argc, char argv[]) +main(int argc, char* argv[]) { int i; pthread_t mt; diff --git a/tests/join0.c b/tests/join0.c index 3519f53..d888e9d 100644 --- a/tests/join0.c +++ b/tests/join0.c @@ -58,7 +58,7 @@ main(int argc, char * argv[]) /* 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(pthread_join(id, &result) == 0); assert((int)(size_t)result == 123); diff --git a/tests/join1.c b/tests/join1.c index 631b604..337af83 100644 --- a/tests/join1.c +++ b/tests/join1.c @@ -69,7 +69,7 @@ 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); assert((int)(size_t)result == i); } diff --git a/tests/join2.c b/tests/join2.c index 82682a8..b3b85ee 100644 --- a/tests/join2.c +++ b/tests/join2.c @@ -60,7 +60,7 @@ 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); assert((int)(size_t)result == i); } diff --git a/tests/join3.c b/tests/join3.c index acdc5fe..44380ac 100644 --- a/tests/join3.c +++ b/tests/join3.c @@ -66,7 +66,7 @@ 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); assert((int)(size_t)result == i); } diff --git a/tests/mutex6e.c b/tests/mutex6e.c index dc6e853..3f28ee7 100644 --- a/tests/mutex6e.c +++ b/tests/mutex6e.c @@ -86,7 +86,7 @@ main() assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == 555); assert(lockCount == 2); diff --git a/tests/mutex6es.c b/tests/mutex6es.c index f34b691..d4b6249 100644 --- a/tests/mutex6es.c +++ b/tests/mutex6es.c @@ -79,7 +79,7 @@ main() assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == 555); assert(lockCount == 2); diff --git a/tests/mutex6r.c b/tests/mutex6r.c index 85bb6bd..552f394 100644 --- a/tests/mutex6r.c +++ b/tests/mutex6r.c @@ -85,7 +85,7 @@ main() assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == 555); assert(lockCount == 2); diff --git a/tests/mutex6rs.c b/tests/mutex6rs.c index 6c8c1f5..4242fd6 100644 --- a/tests/mutex6rs.c +++ b/tests/mutex6rs.c @@ -78,7 +78,7 @@ main() assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == 555); assert(lockCount == 2); diff --git a/tests/mutex7e.c b/tests/mutex7e.c index 52424be..82d941f 100644 --- a/tests/mutex7e.c +++ b/tests/mutex7e.c @@ -86,7 +86,7 @@ main() assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == 555); assert(lockCount == 2); diff --git a/tests/mutex7r.c b/tests/mutex7r.c index 1ce1aa6..2c1699b 100644 --- a/tests/mutex7r.c +++ b/tests/mutex7r.c @@ -85,7 +85,7 @@ main() assert(pthread_create(&t, NULL, locker, NULL) == 0); - assert(pthread_join(t, (void *) &result) == 0); + assert(pthread_join(t, &result) == 0); assert((int)(size_t)result == 555); assert(lockCount == 2); diff --git a/tests/rwlock6.c b/tests/rwlock6.c index 8861823..0ac6b27 100644 --- a/tests/rwlock6.c +++ b/tests/rwlock6.c @@ -89,9 +89,9 @@ 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((int)(size_t)wr1Result == 10); assert((int)(size_t)rdResult == 10); diff --git a/tests/rwlock6_t.c b/tests/rwlock6_t.c index 4af85d9..6c45b0a 100644 --- a/tests/rwlock6_t.c +++ b/tests/rwlock6_t.c @@ -114,10 +114,10 @@ main() Sleep(500); 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); - assert(pthread_join(wrt2, (void *) &wr2Result) == 0); - assert(pthread_join(rdt2, (void *) &rd2Result) == 0); + assert(pthread_join(wrt1, &wr1Result) == 0); + assert(pthread_join(rdt1, &rd1Result) == 0); + assert(pthread_join(wrt2, &wr2Result) == 0); + assert(pthread_join(rdt2, &rd2Result) == 0); assert((int)(size_t)wr1Result == 10); assert((int)(size_t)rd1Result == 0); diff --git a/tests/semaphore1.c b/tests/semaphore1.c index de349c7..0f2eb77 100644 --- a/tests/semaphore1.c +++ b/tests/semaphore1.c @@ -110,7 +110,7 @@ thr(void * arg) assert(sem_post(&s) == 0); - return 0; + return NULL; } @@ -123,7 +123,7 @@ main() int result2; assert(pthread_create(&t, NULL, thr, NULL) == 0); - assert(pthread_join(t, (void *)&result1) == 0); + assert(pthread_join(t, &result1) == 0); assert((int)(size_t)result1 == 0); assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0); diff --git a/tests/semaphore4.c b/tests/semaphore4.c index 0ccd45a..3a28c7b 100644 --- a/tests/semaphore4.c +++ b/tests/semaphore4.c @@ -111,7 +111,7 @@ main() assert(pthread_cancel(t[50]) == 0); { void* result; - assert(pthread_join(t[50], (void *) &result) == 0); + assert(pthread_join(t[50], &result) == 0); } assert(sem_getvalue(&s, &value) == 0); assert(-value == (MAX_COUNT - 1)); |