Re: automatically generating node support functions

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: automatically generating node support functions
Date: 2021-12-29 11:08:17
Message-ID: 7848b872-7a10-67b2-b55f-7c9c475ae863@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12.10.21 15:52, Andrew Dunstan wrote:
> I haven't been through the whole thing, but I did notice this: the
> comment stripping code looks rather fragile. I think it would blow up if
> there were a continuation line not starting with  qr/\s*\*/. It's a lot
> simpler and more robust to do this if you slurp the file in whole.
> Here's what we do in the buildfarm code:
>
>     my $src = file_contents($_);
> # strip C comments
>     # We used to use the recipe in perlfaq6 but there is actually no point.
>     # We don't need to keep the quoted string values anyway, and
>     # on some platforms the complex regex causes perl to barf and crash.
>     $src =~ s{/\*.*?\*/}{}gs;
>
> After you've done that splitting it into lines is pretty simple.

Here is an updated patch, with some general rebasing, and the above
improvement. It now also generates #include lines necessary in
copyfuncs etc. to pull in all the node types it operates on.

Further, I have looked more into the "metadata" approach discussed in
[0]. It's pretty easy to generate that kind of output from the data
structures my script produces. You just loop over all the node types
and print stuff and keep a few counters. I don't plan to work on that
at this time, but I just wanted to point out that if people wanted to
move into that direction, my patch wouldn't be in the way.

[0]:
https://www.postgresql.org/message-id/flat/20190828234136.fk2ndqtld3onfrrp%40alap3.anarazel.de

Attachment Content-Type Size
v3-0001-Automatically-generate-node-support-functions.patch text/plain 71.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrice Chapuis 2021-12-29 11:32:41 Re: Logical replication timeout problem
Previous Message Anton Voloshin 2021-12-29 10:16:46 [PATCH] allow src/tools/msvc/*.bat files to be called from the root of the source tree