Re: Fix pg_dump dependency on postgres.h

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix pg_dump dependency on postgres.h
Date: 2007-11-14 16:50:55
Message-ID: 25156.1195059055@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
> 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.

[ after further review... ]

It looks to me like the intended use of YYSTYPE_IS_DECLARED is to
denote the case where the user has supplied a typedef, not macro,
definition of YYSTYPE. So defining YYSTYPE as a macro and setting
YYSTYPE_IS_DECLARED as well really seems incorrect.

The real question with all this is that while the Bison manual clearly
says that you can #define YYSTYPE, there is not anything suggesting
that you can or should do that when using %union; they are presented as
two different ways of defining the type. So I find it a bit surprising
that the #if is there at all in parse.h. Nonetheless it is there in
all versions from 1.875 to 2.3, and in the 2.3 manual it says

Unless `YYSTYPE' is already defined as a macro, the output header
declares `YYSTYPE'.

So apparently the Bison guys do intend to carry that behavior forward.

AFAICT, therefore, the proposed patch should only define YYSTYPE and
not anything else (there's no need to be afraid of YYLTYPE at present).

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2007-11-14 17:06:09 Re: a tsearch2 (8.2.4) dictionary that only filters out stopwords
Previous Message Zdenek Kotala 2007-11-14 16:47:38 Re: Fix pg_dump dependency on postgres.h

Browse pgsql-patches by date

  From Date Subject
Next Message Oleg Bartunov 2007-11-14 17:06:09 Re: a tsearch2 (8.2.4) dictionary that only filters out stopwords
Previous Message Zdenek Kotala 2007-11-14 16:47:38 Re: Fix pg_dump dependency on postgres.h