1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-10 09:21:54 +03:00

gen_node_support.pl: improve error message for unclosed struct.

This error message was 'runaway "struct_name"', which isn't all
that clear; I think 'could not find closing brace for "struct_name"'
is better.  Also, provide the location of the struct start using the
script's usual '$file:$lineno' style.

Bug: #18901
Reported-by: Clemens Ruck <clemens.ruck@t-online.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18901-424272abe01357e6@postgresql.org
This commit is contained in:
Tom Lane
2025-04-22 13:56:31 -04:00
parent e29df428a1
commit eaf582806c

View File

@ -195,6 +195,7 @@ my $next_input_file = 0;
foreach my $infile (@ARGV) foreach my $infile (@ARGV)
{ {
my $in_struct; my $in_struct;
my $in_struct_lineno;
my $subline; my $subline;
my $is_node_struct; my $is_node_struct;
my $supertype; my $supertype;
@ -543,6 +544,7 @@ foreach my $infile (@ARGV)
if ($line =~ /^(?:typedef )?struct (\w+)$/ && $1 ne 'Node') if ($line =~ /^(?:typedef )?struct (\w+)$/ && $1 ne 'Node')
{ {
$in_struct = $1; $in_struct = $1;
$in_struct_lineno = $lineno;
$subline = 0; $subline = 0;
} }
# one node type typedef'ed directly from another # one node type typedef'ed directly from another
@ -570,7 +572,8 @@ foreach my $infile (@ARGV)
if ($in_struct) if ($in_struct)
{ {
die "runaway \"$in_struct\" in file \"$infile\"\n"; die
"$infile:$in_struct_lineno: could not find closing brace for struct \"$in_struct\"\n";
} }
close $ifh; close $ifh;