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

From Tom Lane
Subject Re: Fix pg_dump dependency on postgres.h
Date
Msg-id 25156.1195059055@sss.pgh.pa.us
Whole thread Raw
In response to Re: Fix pg_dump dependency on postgres.h  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Responses Re: Fix pg_dump dependency on postgres.h
List pgsql-patches
Zdenek Kotala <Zdenek.Kotala@Sun.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

pgsql-patches by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: Fix pg_dump dependency on postgres.h
Next
From: Oleg Bartunov
Date:
Subject: Re: a tsearch2 (8.2.4) dictionary that only filters out stopwords