[PATCH] kbproto: typedef instead of #define

Jeremy Huddleston jeremyhu at freedesktop.org
Tue Apr 7 00:08:56 PDT 2009


On Apr 6, 2009, at 22:37, Jeremy Huddleston wrote:

>
> On Apr 6, 2009, at 20:24, Dan Nicholson wrote:
>
>> On Mon, Apr 6, 2009 at 6:50 PM, Jeremy Huddleston
>> <jeremyhu at freedesktop.org> wrote:
>>>
>>> On Apr 6, 2009, at 17:34, Jeremy Huddleston wrote:
>>>> diff --git a/include/X11/Xlib.h b/include/X11/Xlib.h
>>>> index 44557ea..e134c62 100644
>>>> --- a/include/X11/Xlib.h
>>>> +++ b/include/X11/Xlib.h
>>>> @@ -107,8 +107,8 @@ _Xmblen(
>>>>
>>>> typedef char *XPointer;
>>>>
>>>> -#define Bool int
>>>> -#define Status int
>>>> +typedef int Bool;
>>>> +typedef int Status;
>>>> #define True 1
>>>> #define False 0
>>>
>>> Then that screws up when Xdefs.h is included after Xlib.h ... why
>>> doesn't Xlib.h just #include Xdefs.h to get these?
>>
>> You can do the same thing as Xdefs.h:
>>
>> #ifndef Bool
>> #  ifndef _XTYPEDEF_BOOL
>> #   define _XTYPEDEF_BOOL
>> typedef int Bool;
>> #  endif
>> #endif
>
> I think that is probably the safest solution, but note that xauth
> still fails to build as a result:
>
> xauth fails to build:
> In file included from process.c:49:
> /usr/X11/include/X11/Xlib.h:114: error: redefinition of typedef ‘Bool’
> xauth.h:37: error: previous declaration of ‘Bool’ was here
>
> http://cgit.freedesktop.org/xorg/app/xauth/tree/xauth.h


And Xlib.h isn't the only one...

./fonts/FSlib.h:#define	Status	int
./ICE/ICElib.h:#define Status int
./Xwindows.h:#define Status wStatus
./Xwindows.h:#define Status int
./Xwinsock.h:#define Status wStatus
./Xwinsock.h:#define Status int

ick... this is messy...


More information about the xorg-devel mailing list