Re: automatically generating node support functions - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: automatically generating node support functions
Date
Msg-id 50fedc80-4104-bdc8-d777-04f030fc550f@dunslane.net
Whole thread Raw
In response to Re: automatically generating node support functions  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: automatically generating node support functions  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers
On 10/11/21 10:22 AM, Peter Eisentraut wrote:
>
> On 15.09.21 21:01, Peter Eisentraut wrote:
>> On 17.08.21 16:36, Peter Eisentraut wrote:
>>> Here is another set of preparatory patches that clean up various
>>> special cases and similar in the node support.
>>
>> This set of patches has been committed.  I'll close this commit fest
>> entry and come back with the main patch series in the future.
>
> Here is an updated version of my original patch, so we have something
> to continue the discussion around.  This takes into account all the
> preparatory patches that have been committed in the meantime.  I have
> also changed it so that the array size of a pointer is now explicitly
> declared using pg_node_attr(array_size(N)) instead of picking the most
> recent scalar field, which was admittedly hacky.  I have also added
> MSVC build support and made the Perl code more portable, so that the
> cfbot doesn't have to be sad.



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.

cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Make query ID more portable
Next
From: Dilip Kumar
Date:
Subject: Re: Gather performance analysis