Re: base_yylex undefined in src/interface/ecpg/preproc/parser.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Дилян Палаузов <dpa-postgres(at)aegee(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: base_yylex undefined in src/interface/ecpg/preproc/parser.c
Date: 2016-12-11 18:32:50
Message-ID: 12637.1481481170@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?UTF-8?B?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?= <dpa-postgres(at)aegee(dot)org> writes:
> with the newest flex (v2.6.2-19-g6bea32e, which is newer than 2.6.3) I
> need this patch to compile postgres:

Ugh.

> With previous versions of flex the compilation has worked. But I do not
> find in the code where is supposed yylex to be renamed to base_yylex
> when parser.c is proccessed. pgc.l also does not use %option
> prefix=base_yy, which would be the right way to rename yylex (apart from
> #define YY_DECL).
> What is the purpose to rename yylex to base_yylex?

It's mostly for consistency with the backend, where we have multiple bison
parsers (and multiple flex lexers) so there's a policy of renaming all of
them away from the default name. Since ecpg is a standalone program,
we could in principle not bother to rename its parser; but I'd rather
keep it in as close sync with the corresponding backend code as possible.

The reason for the current hacky approach is explained in pgc.l:

/*
* Change symbol names as expected by preproc.y. It'd be better to do this
* with %option prefix="base_yy", but that affects some other names that
* various files expect *not* to be prefixed with "base_". Cleaning it up
* is not worth the trouble right now.
*/
#define yylex base_yylex
#define yylval base_yylval

Looks like it's time to pay down that technical debt.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-12-11 20:04:53 Re: base_yylex undefined in src/interface/ecpg/preproc/parser.c
Previous Message Дилян Палаузов 2016-12-11 16:49:39 base_yylex undefined in src/interface/ecpg/preproc/parser.c