summaryrefslogtreecommitdiff
path: root/gcc/gthr-win32.h
diff options
context:
space:
mode:
authorcgf <cgf@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-03 20:58:51 +0000
committercgf <cgf@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-03 20:58:51 +0000
commit61dcce9cea168005470b9086083cd832a18ebc29 (patch)
treeefafcc7501e369c80b7d9e3f751e7c36d740fcb6 /gcc/gthr-win32.h
parent124c3198872747cb5782e0b1f5b708c6a657d4e1 (diff)
downloadgcc-61dcce9cea168005470b9086083cd832a18ebc29.tar.gz
* gthr-win32.h: Protect against conflicting typedef for BOOL in windows headers
and libobjc headers. * gthr-win32.h (__mingwthr_key_dtor): Use extern "C" linkage for C++. (_mingw.h): Remove duplicate include. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49465 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-win32.h')
-rw-r--r--gcc/gthr-win32.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc/gthr-win32.h b/gcc/gthr-win32.h
index 31da7a152bc..97d5a825cd6 100644
--- a/gcc/gthr-win32.h
+++ b/gcc/gthr-win32.h
@@ -64,7 +64,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define __GTHREADS 1
-#include <windows.h>
#include <errno.h>
#ifdef __MINGW32__
#include <_mingw.h>
@@ -72,6 +71,15 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifdef _LIBOBJC
+/* This is necessary to prevent windef.h (included from windows.h) from
+ defining it's own BOOL as a typedef. */
+#ifndef __OBJC__
+#define __OBJC__
+#endif
+#include <windows.h>
+/* Now undef the windows BOOL. */
+#undef BOOL
+
/* Key structure for maintaining thread specific storage */
static DWORD __gthread_objc_data_tls = (DWORD)-1;
@@ -320,9 +328,7 @@ __gthread_objc_condition_signal(objc_condition_t condition)
#else /* _LIBOBJC */
-#ifdef __MINGW32__
-#include <_mingw.h>
-#endif
+#include <windows.h>
typedef DWORD __gthread_key_t;
@@ -339,7 +345,14 @@ typedef HANDLE __gthread_mutex_t;
#if __MINGW32_MAJOR_VERSION >= 1 || \
(__MINGW32_MAJOR_VERSION == 0 && __MINGW32_MINOR_VERSION > 2)
#define MINGW32_SUPPORTS_MT_EH 1
-extern int __mingwthr_key_dtor PARAMS ((DWORD, void (*) (void *)));
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int __mingwthr_key_dtor (DWORD, void (*) (void *));
+#ifdef __cplusplus
+}
+#endif
+
/* Mingw runtime >= v0.3 provides a magic variable that is set to non-zero
if -mthreads option was specified, or 0 otherwise. This is to get around
the lack of weak symbols in PE-COFF. */