Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maICk-0003li-Tg for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Oct 2021 13:52:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1maICi-0005tu-DU for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Oct 2021 13:52:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maICi-0005tl-5q for pgsql-hackers@lists.postgresql.org; Tue, 12 Oct 2021 13:52:28 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maICb-00038N-0w for pgsql-hackers@postgresql.org; Tue, 12 Oct 2021 13:52:27 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 9B759FF807; Tue, 12 Oct 2021 13:52:17 +0000 (UTC) Subject: Re: automatically generating node support functions To: Peter Eisentraut , pgsql-hackers References: <2f876203-7142-fa71-6d22-6ce00eb26869@enterprisedb.com> From: Andrew Dunstan Message-ID: <50fedc80-4104-bdc8-d777-04f030fc550f@dunslane.net> Date: Tue, 12 Oct 2021 09:52:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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