This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[OBJC]: Patch to gthr-win32.h to prevent BOOL conflict

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__

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.


2001-12-22  Danny Smith <>

	* 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__
+#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>
+#include <windows.h>
 typedef DWORD __gthread_key_t; - My Yahoo!
- It's My Yahoo! Get your own!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]