Permalink
Browse files

More 64 bit cast fixups

  • Loading branch information...
rpj
rpj committed Mar 6, 2011
1 parent 1e42dcd commit 839ca1c0310548d3967a34a6caae90dcc45948ed
View
@@ -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
View
@@ -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).
-
+
View
@@ -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 \
View
@@ -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
View
@@ -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
View
@@ -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.
*
* --------------------------------------------------------------------------
*
View
@@ -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
View
@@ -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>
View
@@ -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>
View
@@ -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);
View
@@ -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;
View
@@ -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;
View
@@ -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
+-------------------------------
View
@@ -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);
View
@@ -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;
}
View
@@ -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)
{
View
@@ -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);
View
@@ -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);
View
@@ -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);
View
@@ -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);
View
@@ -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);
}
View
@@ -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);
}
View
@@ -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);
}
View
@@ -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.
View
@@ -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;
View
@@ -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);
View
@@ -113,7 +113,7 @@ exceptionedThread(void * arg)
}
int
-main(int argc, char argv[])
+main(int argc, char* argv[])
{
int i;
pthread_t mt;
View
@@ -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);
View
@@ -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);
}
View
@@ -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);
}
View
@@ -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);
}
View
@@ -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);
View
@@ -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);
View
@@ -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);
Oops, something went wrong.

0 comments on commit 839ca1c

Please sign in to comment.