Re: ecpg: issue related to preprocessor directives - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: ecpg: issue related to preprocessor directives
Date
Msg-id 1853327.1596240391@sss.pgh.pa.us
Whole thread Raw
In response to ecpg: issue related to preprocessor directives  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Responses Re: ecpg: issue related to preprocessor directives
Re: ecpg: issue related to preprocessor directives
List pgsql-interfaces
Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> When the following ecpg program having preprocessor directives is compiled,
> the output produced is not correct.
> ...
> As seen from above output, both exec sql ifdef and exec sql else block got
> compiled which is wrong. If the above output is further compiled using gcc
> compiler, the compilation would fail.

Looking at pgc.l, it seems that 'elif' is treated as though it were
'endif' followed by 'ifdef', which of course completely loses the
expected property that a previous successful branch would keep the
elif branch from being expanded.

While this doesn't look terribly hard to fix, I'm a little disturbed
by the fact that the existing semantics seem to date back to 1999
(b57b0e044).  We're probably risking breaking existing app code if
we change it.  I think we *should* change it, of course, but I'm kind
of inclined not to back-patch.

            regards, tom lane



pgsql-interfaces by date:

Previous
From: Ashutosh Sharma
Date:
Subject: ecpg: issue related to preprocessor directives
Next
From: Tom Lane
Date:
Subject: Re: ecpg: issue related to preprocessor directives