This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [patch]: Merge from gnustep for obj-c. Remove warnings for target w64.




Sent from my iPhone

On Nov 19, 2008, at 12:19 AM, Kai Tietz <Kai.Tietz@onevision.com> wrote:

"Danny Smith" <dansmister@gmail.com> wrote on 19.11.2008 03:58:14:

* objc/objc.h (BOOL): Prevent redeclaration of BOOL, if already
there.


--- gcc.orig/libobjc/objc/objc.h
+++ gcc/libobjc/objc/objc.h
@@ -39,8 +39,10 @@ extern "C" {
#ifdef __vxworks
typedef int BOOL;
#else
+#ifndef BOOL
typedef unsigned char  BOOL;
#endif
+#endif
#define YES   (BOOL)1
#define NO    (BOOL)0


That doe not seem right. It means that if w32api's windef.h is included before the objc.h language header, then BOOL may be equivalent to WINBOOL which is an int. If if is included after then is in an unsigned char. Wouldn't it be better to just #iundef BOOL before the typedef?

Danny

Well, I see in both cases a problem here. So to have the pattern #ifdef BOOL #undef BOOL #endif typedef unsigned char BOOL;

You can use #undef unconditional so no need for the ifdef.
This part of the patch is ok but I have to look into the other parts still.





and the pattern
#ifndef BOOL
typedef unsigned char BOOL;
#endif

are equivalent IMHO. But I open-minded for this, but see no real advantage
between one of the variants.


Kai

|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.



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