Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc75c6f8

Browse files
committed
Don't hard-code the input file name in gen_tabcomplete.pl's output.
Use $ARGV[0], that is the specified input file name, in #linedirectives generated by gen_tabcomplete.pl. This makes codecoverage reports work properly in the meson build system (wherethe input file name will be a relative path).Also fix up brain fade in the meson build rule for tab-complete.c:we only need to write the input file name once not twice.Jacob Champion (some cosmetic adjustments by me)Discussion:https://postgr.es/m/CAOYmi+=+oWAoi8pqnH0MJQqsSn4ddzqDhqRQJvyiN2aJSWvw2w@mail.gmail.com
1 parent95eb4cd commitc75c6f8

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

‎src/bin/psql/gen_tabcomplete.pl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@
5555

5656
GetOptions('outfile=s'=> \$outfile)ordie"$0: wrong arguments";
5757

58-
openmy$infh,'<',$ARGV[0]
59-
ordie"$0: could not open input file '$ARGV[0]':$!\n";
58+
my$infile =$ARGV[0];
59+
openmy$infh,'<',$infile
60+
ordie"$0: could not open input file '$infile':$!\n";
6061

6162
my$outfh;
6263
if ($outfile)
@@ -91,7 +92,7 @@
9192
9293
#define SWITCH_CONVERSION_APPLIED
9394
94-
#line 1 "tab-complete.in.c"
95+
#line 1 "${infile}"
9596
EOM
9697

9798
# Scan input file until we find the data-replacement label line.
@@ -114,7 +115,7 @@
114115
# with the line numbering of the original, to simplify compiler error message
115116
# reading and debugging.
116117
my$next_line_no =$. + 1;
117-
$output_code .="#line${next_line_no}\"tab-complete.in.c\"\n";
118+
$output_code .="#line${next_line_no}\"${infile}\"\n";
118119

119120
# Scan until we find the BEGIN GEN_TABCOMPLETE line.
120121
# Add the scanned code to $output_code verbatim.
@@ -131,7 +132,7 @@
131132

132133
# Keep line numbering in sync.
133134
$next_line_no =$. + 1;
134-
$output_code .="#line${next_line_no}\"tab-complete.in.c\"\n";
135+
$output_code .="#line${next_line_no}\"${infile}\"\n";
135136

136137
# Scan input file, collecting outer-level else-if conditions
137138
# to pass to process_else_if.
@@ -190,7 +191,7 @@
190191

191192
# Keep line numbering in sync.
192193
$next_line_no =$. + 1;
193-
$output_code .="#line${next_line_no}\"tab-complete.in.c\"\n";
194+
$output_code .="#line${next_line_no}\"${infile}\"\n";
194195

195196
# Scan the rest, adding it to $output_code verbatim.
196197
while (<$infh>)
@@ -245,7 +246,7 @@ sub process_else_if
245246
process_match($typ,$cs,$args,$else_if_lineno,$isfirst);
246247
$isfirst = 0;
247248
# approximate line positioning of AND'd condition
248-
$output_code .="#line${end_lineno}\"tab-complete.in.c\"\n";
249+
$output_code .="#line${end_lineno}\"${infile}\"\n";
249250
$output_code .="\tif ($else_if_line\n";
250251
}
251252
elsif ($else_if_line =~
@@ -269,7 +270,7 @@ sub process_else_if
269270
if ($end_lineno !=$else_if_lineno)
270271
{
271272
my$next_lineno =$end_lineno + 1;
272-
$output_code .="#line${next_lineno}\"tab-complete.in.c\"\n";
273+
$output_code .="#line${next_lineno}\"${infile}\"\n";
273274
}
274275
}
275276

‎src/bin/psql/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ tabcomplete = custom_target('tabcomplete',
2727
input:'tab-complete.in.c',
2828
output:'tab-complete.c',
2929
command: [
30-
perl,files('gen_tabcomplete.pl'),files('tab-complete.in.c'),
31-
'--outfile','@OUTPUT@','@INPUT@',
30+
perl,files('gen_tabcomplete.pl'),'@INPUT@',
31+
'--outfile','@OUTPUT@',
3232
],
3333
)
3434
generated_sources+= tabcomplete

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp