Re: build remaining Flex files standalone - Mailing list pgsql-hackers

From John Naylor
Subject Re: build remaining Flex files standalone
Date
Msg-id CAFBsxsHQu42RqhNh_q-EpnS7ZFi-Q003TujEg3xWq99Cy5Z5OA@mail.gmail.com
Whole thread Raw
In response to Re: build remaining Flex files standalone  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Wed, Aug 17, 2022 at 8:14 AM Andres Freund <andres@anarazel.de> wrote:

> > > > +/* functions shared between guc.c and guc-file.l */
> > > > [...]
> > > I think I prefer your suggestion of a guc_internal.h upthread.
> >
> > Started in 0002, but left open the headerscheck failure.
> >
> > Also, if such a thing is meant to be #include'd only by two generated
> > files, maybe it should just live in the directory where they live, and
> > not in the src/include dir?
>
> It's not something we've done for the backend afaics, but I don't see a reason
> not to start at some point.

BTW, I forgot to mention I did this for the json path parser, which
makes the makefile code simpler than what was there before
550b9d26f80fa30. AFAICS, we could also do the same for gramparse.h,
which is internal to parser.c. If I'm not mistaken, the only reason we
symlink gram.h to src/include/* is so that gramparse.h can include it.
So keeping gramparse.h in the backend could allow removing some gram.h
makefile incantations.

> > > Why does this need to be defined in a semi-public header? If we do this in
> > > multiple files we'll end up with the danger of macro redefinition warnings.
> >
> > I tried to put all the Flex/Bison stuff in another *_internal header,
> > but that breaks the build. Putting just this one symbol in a header is
> > silly, but done that way for now. Maybe two copies of the symbol?
>
> The problem is that if it's in a header you can't include another header with
> such a define. That's fine if it's a .h that's just intended to be included by
> a limited set of files, but for something like a header for a datatype that
> might need to be included to e.g. define a PL transform or a new operator or
> ...  This would be solved by the %code requires thing, right?

I believe it would.

-- 
John Naylor
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug: When user-defined AM is used, the index path cannot be selected correctly
Next
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Handle infinite recursion in logical replication setup