This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[OBJC]: Patch to gthr-win32.h to prevent BOOL conflict
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 22 Dec 2001 20:55:47 +1100 (EST)
- Subject: [OBJC]: Patch to gthr-win32.h to prevent BOOL conflict
Hello
Windows32 definition of BOOL conflicts with the typedef in objc/objc.h.
causing problems in gthr-win32.h.
This is the definition of BOOL in mingw and cygwin windef.h header:
#ifndef __OBJC__
typedef WINBOOL BOOL;
#else
#define BOOL WINBOOL
#endif
where WINBOOL is typedef as int.
The following patch follows the approach used in earlier (gcc-2.95)
versions of libobjc, (libobjc/thr-win32.c), defining __OBJC__ to prevent
the conflicting typedefs for BOOL.
Without this patch, libobjc fails to build on mingw. Patch allows to build.
ChangeLog
2001-12-22 Danny Smith <dannysmith@users.sourceforge.net>
* gthr-win32.h: If _LIBOBJC, protect against conflicting
typedef for BOOL in windows headers.
(_mingw.h): Remove duplicate include.
Index: gthr-win32.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gthr-win32.h,v
retrieving revision 1.12
diff -u -p -r1.12 gthr-win32.h
--- gthr-win32.h 2001/11/19 00:24:52 1.12
+++ gthr-win32.h 2001/12/22 09:31:10
@@ -64,7 +64,6 @@ Software Foundation, 59 Temple Place - S
#define __GTHREADS 1
-#include <windows.h>
#include <errno.h>
#ifdef __MINGW32__
#include <_mingw.h>
@@ -72,6 +71,15 @@ Software Foundation, 59 Temple Place - S
#ifdef _LIBOBJC
+/* This is necessary to prevent windef.h (included from windows.h) from
+ defining BOOL as a typedef. */
+#ifndef __OBJC__
+#define __OBJC__
+#endif
+#include <windows.h>
+/* Now undef the windows BOOL macro. */
+#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_con
#else /* _LIBOBJC */
-#ifdef __MINGW32__
-#include <_mingw.h>
-#endif
+#include <windows.h>
typedef DWORD __gthread_key_t;
http://my.yahoo.com.au - My Yahoo!
- It's My Yahoo! Get your own!