Re: Fix pg_dump dependency on postgres.h - Mailing list pgsql-patches

From Zdenek Kotala
Subject Re: Fix pg_dump dependency on postgres.h
Date
Msg-id 473B1468.6000704@sun.com
Whole thread Raw
In response to Re: Fix pg_dump dependency on postgres.h  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Fix pg_dump dependency on postgres.h  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Alvaro Herrera wrote:
> Zdenek Kotala wrote:
>> Alvaro Herrera wrote:
>
>>>>> 3) Put following fake into keyword.c before include "parse.h" line. It
>>>>> is easiest way.
>>>>> #define TYPE_IS_DECLARED 1
>>>>> #define YYLTYPE_IS_DECLARED 1
>>>>> #define YYLTYPE void*
>>>>> #define YYSTYPE void*
>>>> New version of patch is attached. I selected variant 3 as a best
>>>> solution. Patch also fix some other postgres.h dependencyin another tools
>>>> such as pg_controldata, pg_config. The last unfixed tool is pg_resetxlog
>>>> which deserves own patch.
>>> Humm, but YYLTYPE is defined in gramparse.h (and as a different type)
>>> ...  Also, I see that if you define YYLTYPE then you don't need
>>> YYLTYPE_IS_DECLARED as well.  Also I don't see any TYPE_IS_DECLARED
>>> here.  What I'm thinking is that this patch is not very portable :-(
>> Thanks you for your comments.
>>
>> You are right, define YYLTYPE and YYSTYPE is enough to skip union/structure
>> definition.  I think, data type is not important for this purpose, but use
>> int instead of void* seem good idea. It will be synchronized with
>> gramparse.h.
>>
>> What do you mean "not very portable"? What could be problem there?
>
> I'm not sure.  My point is that it seems your parse.h requires
> TYPE_IS_DECLARED, but mine doesn't.  What else could be lurking in there
> that requires a specific fix?  In order to avoid that, it would be
> better if there was a solution to the problem along the lines of #2 you
> proposed.
>

TYPE_IS_DECLARED was my mistake. It should be YYSTYPE_IS_DECLARED. It
works because YYSTYPE is also defined and #ifdef checks both. Copy and
paste :( error. Sorry for confusion. I'm going to send new version.


        Zdenek


pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Fix pg_dump dependency on postgres.h
Next
From: Tom Lane
Date:
Subject: Re: Fix pg_dump dependency on postgres.h