Permalink
Browse files

Compiler directive cleanups

  • Loading branch information...
1 parent 6c545bb commit 9361fd07a7f672ede68beeac293517179cf5daeb rpj committed May 30, 2011
View
@@ -1,3 +1,29 @@
+2011-05-29 Ross Johnson <ross dot johnson at homemail dot com dot au>
+
+ * *.[ch] (#ifdef): Extended cleanup to whole project.
+
+2011-05-29 Daniel Richard G. <skunk at iskunk dot org>
+
+ * Makefile (CC): Define CC to allow use of other compatible
+ compilers such as the Intel compilter icl.
+ * implement.h (#if): Fix forms like #if HAVE_SOMETHING.
+ * pthread.h: Likewise.
+ * sched.h: Likewise; PTW32_LEVEL_* becomes PTW32_SCHED_LEVEL_*.
+ * semaphore.h: Likewise.
+
+2011-05-11 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * ptw32_callUserDestroyRoutines.c (terminate): Altered includes
+ to match ptw32_threadStart.c.
+ * GNUmakefile (GCE-inlined-debug, DOPT): Fixed.
+
+2011-04-31 Ross Johnson <ross.johnson at homemail.com.au>
+
+ * (robust mutexes): Added this API. The API is not
+ mandatory for implementations that don't support PROCESS_SHARED
+ mutexes, nevertheless it was considered useful both functionally
+ and for source-level compatibility.
+
2011-03-26 Ross Johnson <ross.johnson at homemail.com.au>
* pthread_getunique_np.c: New non-POSIX interface for compatibility
View
@@ -59,7 +59,6 @@ RANLIB = $(CROSS)ranlib
RC = $(CROSS)windres
OPT = $(CLEANUP) -O3 # -finline-functions -findirect-inlining
-DOPT = $(CLEANUP) -g -O0
XOPT =
RCFLAGS = --include-dir=.
@@ -481,31 +480,31 @@ GC:
$(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
GC-debug:
- $(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_DLL)
+ $(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_DLL)
GCE:
$(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
GCE-debug:
- $(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_DLL)
+ $(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_CXX -g -O0" $(GCED_DLL)
GC-inlined:
$(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
GC-inlined-debug:
- $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_INLINED_STAMP)
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_INLINED_STAMP)
GCE-inlined:
$(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
GCE-inlined-debug:
- $(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_INLINED_STAMP)
+ $(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_CXX -g -O0" $(GCED_INLINED_STAMP)
GC-static:
$(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
GC-static-debug:
- $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_STATIC_STAMP)
+ $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="-D__CLEANUP_C -g -O0" $(GCD_STATIC_STAMP)
tests:
@ cd tests
View
@@ -27,6 +27,7 @@ STATIC_STAMPS = pthreadVCE$(DLL_VER).static pthreadVSE$(DLL_VER).static pthreadV
OPTIM = /O2 /Ob2
OPTIMD =
+CC = cl
CFLAGS = /W3 /MD /nologo /I. /D_WIN32_WINNT=0x400 /DHAVE_PTW32_CONFIG_H
CFLAGSD = /Z7 $(CFLAGS)
@@ -459,6 +460,7 @@ realclean: clean
clean:
if exist *.obj del *.obj
+ if exist *.def del *.def
if exist *.ilk del *.ilk
if exist *.pdb del *.pdb
if exist *.exp del *.exp
@@ -476,12 +478,12 @@ install: $(DLLS)
copy semaphore.h $(HDRDEST)
$(DLLS): $(DLL_OBJS)
- cl /LDd /Zi /nologo $(DLL_OBJS) \
+ $(CC) /LDd /Zi /nologo $(DLL_OBJS) \
/link /nodefaultlib:libcmt /implib:$*.lib \
msvcrt.lib $(XLIBS) /out:$@
$(INLINED_STAMPS): $(DLL_INLINED_OBJS)
- cl /LDd /Zi /nologo $(DLL_INLINED_OBJS) \
+ $(CC) /LDd /Zi /nologo $(DLL_INLINED_OBJS) \
/link /nodefaultlib:libcmt /implib:$*.lib \
msvcrt.lib $(XLIBS) /out:$*.dll
@@ -490,13 +492,13 @@ $(STATIC_STAMPS): $(DLL_INLINED_OBJS)
lib $(DLL_INLINED_OBJS) /out:$*.lib
.c.obj:
- cl $(EHFLAGS) /D$(CLEANUP) -c $<
+ $(CC) $(EHFLAGS) /D$(CLEANUP) -c $<
.rc.res:
rc /dPTW32_RC_MSC /d$(CLEANUP) $<
.c.i:
- cl /P /O2 /Ob1 $(VCFLAGS) $<
+ $(CC) /P /O2 /Ob1 $(VCFLAGS) $<
attr.obj: attr.c $(ATTR_SRCS) $(INCL)
barrier.obj: barrier.c $(BARRIER_SRCS) $(INCL)
View
@@ -34,7 +34,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ifdef PTW32_STATIC_LIB
+#if defined(PTW32_STATIC_LIB)
#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
View
@@ -108,7 +108,7 @@
* If you find that these are incorrect or incomplete please report it
* to the pthreads-win32 maintainer. Thanks.
*********************************************************************/
-#ifdef WINCE
+#if defined(WINCE)
#define NEED_DUPLICATEHANDLE
#define NEED_CREATETHREAD
#define NEED_ERRNO
@@ -121,12 +121,12 @@
#define RETAIN_WSALASTERROR
#endif
-#ifdef _UWIN
+#if defined(_UWIN)
#define HAVE_MODE_T
#define HAVE_STRUCT_TIMESPEC
#endif
-#ifdef __GNUC__
+#if defined(__GNUC__)
#define HAVE_C_INLINE
#endif
@@ -137,13 +137,13 @@
#define HAVE_MODE_T
#endif
-#ifdef __BORLANDC__
+#if defined(__BORLANDC__)
#endif
-#ifdef __WATCOMC__
+#if defined(__WATCOMC__)
#endif
-#ifdef __DMC__
+#if defined(__DMC__)
#define HAVE_SIGNAL_H
#define HAVE_C_INLINE
#endif
View
@@ -299,7 +299,7 @@ pthread_create (pthread_t * tid,
*tid = thread;
}
-#ifdef _UWIN
+#if defined(_UWIN)
if (result == 0)
pthread_count++;
#endif
View
6 dll.c
@@ -34,20 +34,20 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ifndef PTW32_STATIC_LIB
+#if !defined(PTW32_STATIC_LIB)
#include "pthread.h"
#include "implement.h"
-#ifdef _MSC_VER
+#if defined(_MSC_VER)
/*
* lpvReserved yields an unreferenced formal parameter;
* ignore it
*/
#pragma warning( disable : 4100 )
#endif
-#ifdef __cplusplus
+#if defined(__cplusplus)
/*
* Dear c++: Please don't mangle this name. -thanks
*/
View
@@ -99,7 +99,7 @@ ptw32_mcs_lock_t ptw32_spinlock_test_init_lock = 0;
*/
ptw32_mcs_lock_t ptw32_cond_list_lock = 0;
-#ifdef _UWIN
+#if defined(_UWIN)
/*
* Keep a count of the number of threads.
*/
View
@@ -35,10 +35,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ifndef _IMPLEMENT_H
+#if !defined(_IMPLEMENT_H)
#define _IMPLEMENT_H
-#ifdef _WIN32_WINNT
+#if defined(_WIN32_WINNT)
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x400
@@ -48,7 +48,7 @@
/*
* In case windows.h doesn't define it (e.g. WinCE perhaps)
*/
-#ifdef WINCE
+#if defined(WINCE)
typedef VOID (APIENTRY *PAPCFUNC)(DWORD dwParam);
#endif
@@ -60,7 +60,7 @@ typedef VOID (APIENTRY *PAPCFUNC)(DWORD dwParam);
/*
* In case ETIMEDOUT hasn't been defined above somehow.
*/
-#ifndef ETIMEDOUT
+#if !defined(ETIMEDOUT)
# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
#endif
@@ -82,7 +82,7 @@ typedef VOID (APIENTRY *PAPCFUNC)(DWORD dwParam);
#define INLINE
#endif
-#if defined (__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
+#if defined(__MINGW64__) || defined(__MINGW32__) || defined(_MSC_VER)
#define PTW32_INTERLOCKED_LONG unsigned long
#define PTW32_INTERLOCKED_LPLONG volatile unsigned long*
#define PTW32_INTERLOCKED_PVOID PVOID
@@ -133,7 +133,7 @@ typedef struct ptw32_thread_t_ ptw32_thread_t;
struct ptw32_thread_t_
{
-#ifdef _UWIN
+#if defined(_UWIN)
DWORD dummy[5];
#endif
UINT64 seqNumber; /* Process-unique thread sequence number */
@@ -152,10 +152,10 @@ struct ptw32_thread_t_
int cancelState;
int cancelType;
HANDLE cancelEvent;
-#ifdef __CLEANUP_C
+#if defined(__CLEANUP_C)
jmp_buf start_mark;
#endif /* __CLEANUP_C */
-#if HAVE_SIGSET_T
+#if defined(HAVE_SIGSET_T)
sigset_t sigmask;
#endif /* HAVE_SIGSET_T */
int implicit:1;
@@ -182,7 +182,7 @@ struct pthread_attr_t_
struct sched_param param;
int inheritsched;
int contentionscope;
-#if HAVE_SIGSET_T
+#if defined(HAVE_SIGSET_T)
sigset_t sigmask;
#endif /* HAVE_SIGSET_T */
};
@@ -201,7 +201,7 @@ struct sem_t_
int value;
pthread_mutex_t lock;
HANDLE sem;
-#ifdef NEED_SEM
+#if defined(NEED_SEM)
int leftToUnblock;
#endif
};
@@ -485,7 +485,7 @@ struct ThreadKeyAssoc
};
-#ifdef __CLEANUP_SEH
+#if defined(__CLEANUP_SEH)
/*
* --------------------------------------------------------------
* MAKE_SOFTWARE_EXCEPTION
@@ -574,11 +574,11 @@ extern ptw32_mcs_lock_t ptw32_cond_test_init_lock;
extern ptw32_mcs_lock_t ptw32_rwlock_test_init_lock;
extern ptw32_mcs_lock_t ptw32_spinlock_test_init_lock;
-#ifdef _UWIN
+#if defined(_UWIN)
extern int pthread_count;
#endif
-#ifdef __cplusplus
+#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
@@ -625,7 +625,7 @@ extern "C"
void ptw32_rwlock_cancelwrwait (void *arg);
-#if ! (defined (__MINGW64__) || defined(__MINGW32__)) || (defined (__MSVCRT__) && ! defined(__DMC__))
+#if ! (defined (__MINGW64__) || defined(__MINGW32__)) || (defined(__MSVCRT__) && ! defined(__DMC__))
unsigned __stdcall
#else
void
@@ -650,19 +650,19 @@ extern "C"
void ptw32_mcs_node_transfer (ptw32_mcs_local_node_t * new_node, ptw32_mcs_local_node_t * old_node);
-#ifdef NEED_FTIME
+#if defined(NEED_FTIME)
void ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft);
void ptw32_filetime_to_timespec (const FILETIME * ft, struct timespec *ts);
#endif
/* Declared in misc.c */
-#ifdef NEED_CALLOC
+#if defined(NEED_CALLOC)
#define calloc(n, s) ptw32_calloc(n, s)
void *ptw32_calloc (size_t n, size_t s);
#endif
/* Declared in private.c */
-#ifdef _MSC_VER
+#if defined(_MSC_VER)
/*
* Ignore the warning:
* "C++ exception specification ignored except to indicate that
@@ -671,19 +671,19 @@ extern "C"
#pragma warning(disable:4290)
#endif
void ptw32_throw (DWORD exception)
-#ifdef __CLEANUP_CXX
+#if defined(__CLEANUP_CXX)
throw(ptw32_exception_cancel,ptw32_exception_exit)
#endif
;
-#ifdef __cplusplus
+#if defined(__cplusplus)
}
#endif /* __cplusplus */
-#ifdef _UWIN_
-# ifdef _MT
-# ifdef __cplusplus
+#if defined(_UWIN_)
+# if defined(_MT)
+# if defined(__cplusplus)
extern "C"
{
# endif
@@ -694,7 +694,7 @@ extern "C"
unsigned (__stdcall *) (void *),
void *, unsigned, unsigned *);
_CRTIMP void __cdecl _endthreadex (unsigned);
-# ifdef __cplusplus
+# if defined(__cplusplus)
}
# endif
# endif
View
@@ -37,7 +37,7 @@
#if ! defined(_UWIN) && ! defined(WINCE)
# include <process.h>
#endif
-#ifndef NEED_FTIME
+#if !defined(NEED_FTIME)
#include <sys/timeb.h>
#endif
#include "pthread.h"
Oops, something went wrong.

0 comments on commit 9361fd0

Please sign in to comment.