[PATCH] Quash CPP build warnings
Daniel Richard G.
skunk@iskunk.org
Fri Aug 26 00:06:00 GMT 2005
The attached patch, against pthread.h and sched.h, eliminates a number of
warnings of the form
...\pthread.h(950) : warning C4668: 'PTW32_LEVEL' is not defined as
a preprocessor macro, replacing with '0' for '#if/#elif'
when compiling with the MSVC toolchain and "-W4 -Wall".
--Daniel
--
NAME = Daniel Richard G. ## Remember, skunks _\|/_ meef?
EMAIL1 = skunk@iskunk.org ## don't smell bad--- (/o|o\) /
EMAIL2 = skunk@alum.mit.edu ## it's the people who < (^),>
WWW = http://www.******.org/ ## annoy them that do! / \
--
(****** = site not yet online)
-------------- next part --------------
Index: pthread.h
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/pthread.h,v
retrieving revision 1.134
diff -u -b -r1.134 pthread.h
--- pthread.h 3 Jun 2005 08:36:28 -0000 1.134
+++ pthread.h 25 Aug 2005 23:26:21 -0000
@@ -210,7 +210,7 @@
* -----------------
*/
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
@@ -220,7 +220,7 @@
/* use native WIN32 time API */
#endif /* NEED_FTIME */
-#if HAVE_SIGNAL_H
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif /* HAVE_SIGNAL_H */
@@ -523,7 +523,7 @@
#define SEM_VALUE_MAX INT_MAX
-#if __GNUC__ && ! defined (__declspec)
+#if defined (__GNUC__) && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
@@ -947,7 +947,7 @@
PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
void (*init_routine) (void));
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#if defined(PTW32_LEVEL) && PTW32_LEVEL >= PTW32_LEVEL_MAX
PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
@@ -1122,7 +1122,7 @@
PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
int pshared);
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
+#if defined(PTW32_LEVEL) && PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
/*
* Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
@@ -1176,9 +1176,9 @@
*/
PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
-#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#if defined(PTW32_LEVEL) && PTW32_LEVEL >= PTW32_LEVEL_MAX
/*
* Returns the Win32 HANDLE for the POSIX thread.
@@ -1276,7 +1276,7 @@
#endif
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#if defined(PTW32_LEVEL) && PTW32_LEVEL >= PTW32_LEVEL_MAX
/* FIXME: This is only required if the library was built using SEH */
/*
Index: sched.h
===================================================================
RCS file: /cvs/pthreads-win32/pthreads/sched.h,v
retrieving revision 1.16
diff -u -b -r1.16 sched.h
--- sched.h 1 Apr 2005 00:55:21 -0000 1.16
+++ sched.h 25 Aug 2005 23:26:21 -0000
@@ -66,7 +66,7 @@
#endif
-#if __GNUC__ && ! defined (__declspec)
+#if defined (__GNUC__) && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
More information about the Pthreads-win32
mailing list