Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3a7cc72

Browse files
committed
Don't fall off the end of perl functions
This complies with the perlcritic policy Subroutines::RequireFinalReturn, which is a severity 4 policy. Since we only currently check at severity level 5, the policy is raised to that level until we move to level 4 or lower, so that any new infringements will be caught. A small cosmetic piece of tidying of the pgperlcritic script is included. Mike Blackwell Discussion: https://postgr.es/m/CAESHdJpfFm_9wQnQ3koY3c91FoRQsO-fh02za9R3OEMndOn84A@mail.gmail.com
1 parent 8a56ff4 commit 3a7cc72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+208
-4
lines changed

contrib/bloom/t/001_wal.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ sub test_index_replay
3636
my $standby_result = $node_standby->safe_psql("postgres", $queries);
3737

3838
is($master_result, $standby_result, "$test_name: query result matches");
39+
return;
3940
}
4041

4142
# Initialize master node

contrib/intarray/bench/create_test.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ sub copytable
8383
while (<$fff>) { print; }
8484
close $fff;
8585
print "\\.\n";
86+
return;
8687
}

src/backend/catalog/Catalog.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ sub RenameTempFile
367367
{
368368
rename($temp_name, $final_name) || die "rename: $temp_name: $!";
369369
}
370+
return;
370371
}
371372

372373
# Find a symbol defined in a particular header file and extract the value.

src/backend/catalog/genbki.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ sub gen_pg_attribute
649649
}
650650
}
651651
}
652+
return;
652653
}
653654

654655
# Given $pgattr_schema (the pg_attribute schema for a catalog sufficient for
@@ -706,6 +707,7 @@ sub morph_row_for_pgattr
706707
}
707708

708709
Catalog::AddDefaultValues($row, $pgattr_schema, 'pg_attribute');
710+
return;
709711
}
710712

711713
# Write an entry to postgres.bki.
@@ -744,6 +746,7 @@ sub print_bki_insert
744746
push @bki_values, $bki_value;
745747
}
746748
printf $bki "insert %s( %s )\n", $oid, join(' ', @bki_values);
749+
return;
747750
}
748751

749752
# Given a row reference, modify it so that it becomes a valid entry for
@@ -786,6 +789,7 @@ sub morph_row_for_schemapg
786789
# Only the fixed-size portions of the descriptors are ever used.
787790
delete $row->{$attname} if $column->{is_varlen};
788791
}
792+
return;
789793
}
790794

791795
# Perform OID lookups on an array of OID names.

src/backend/parser/check_keywords.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ sub error
1818
{
1919
print STDERR @_;
2020
$errors = 1;
21+
return;
2122
}
2223

2324
$, = ' '; # set output field separator

src/backend/utils/mb/Unicode/convutils.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ sub print_conversion_tables
9999
$charset);
100100
print_conversion_tables_direction($this_script, $csname, TO_UNICODE,
101101
$charset);
102+
return;
102103
}
103104

104105
#############################################################################
@@ -160,6 +161,7 @@ sub print_conversion_tables_direction
160161
}
161162

162163
close($out);
164+
return;
163165
}
164166

165167
sub print_from_utf8_combined_map
@@ -194,6 +196,7 @@ sub print_from_utf8_combined_map
194196
}
195197
print $out "\t/* $last_comment */" if ($verbose && $last_comment ne "");
196198
print $out "\n};\n";
199+
return;
197200
}
198201

199202
sub print_to_utf8_combined_map
@@ -230,6 +233,7 @@ sub print_to_utf8_combined_map
230233
}
231234
print $out "\t/* $last_comment */" if ($verbose && $last_comment ne "");
232235
print $out "\n};\n";
236+
return;
233237
}
234238

235239
#######################################################################
@@ -625,6 +629,7 @@ sub print_radix_table
625629
if ($off != $tblsize) { die "table size didn't match!"; }
626630

627631
print $out "};\n";
632+
return;
628633
}
629634

630635
###

src/backend/utils/sort/gen_qsort_tuple.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ sub emit_qsort_boilerplate
130130
#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n)
131131
132132
EOM
133+
134+
return;
133135
}
134136

135137
sub emit_qsort_implementation
@@ -263,4 +265,6 @@ sub emit_qsort_implementation
263265
}
264266
}
265267
EOM
268+
269+
return;
266270
}

src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ sub create_files
2121
print $file 'CONTENT';
2222
close $file;
2323
}
24+
return;
2425
}
2526

2627
create_files();
@@ -89,6 +90,7 @@ sub run_check
8990
"$test_name: newer WAL file was not cleaned up");
9091
ok(-f "$tempdir/unrelated_file",
9192
"$test_name: unrelated file was not cleaned up");
93+
return;
9294
}
9395

9496
run_check('', 'pg_archivecleanup');

src/bin/pg_rewind/RewindTest.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ sub master_psql
7171

7272
system_or_bail 'psql', '-q', '--no-psqlrc', '-d',
7373
$node_master->connstr('postgres'), '-c', "$cmd";
74+
return;
7475
}
7576

7677
sub standby_psql
@@ -79,6 +80,7 @@ sub standby_psql
7980

8081
system_or_bail 'psql', '-q', '--no-psqlrc', '-d',
8182
$node_standby->connstr('postgres'), '-c', "$cmd";
83+
return;
8284
}
8385

8486
# Run a query against the master, and check that the output matches what's
@@ -112,6 +114,7 @@ sub check_query
112114
$stdout =~ s/\r//g if $Config{osname} eq 'msys';
113115
is($stdout, $expected_stdout, "$test_name: query result matches");
114116
}
117+
return;
115118
}
116119

117120
sub setup_cluster
@@ -130,6 +133,7 @@ sub setup_cluster
130133
'postgresql.conf', qq(
131134
wal_keep_segments = 20
132135
));
136+
return;
133137
}
134138

135139
sub start_master
@@ -138,6 +142,8 @@ sub start_master
138142

139143
#### Now run the test-specific parts to initialize the master before setting
140144
# up standby
145+
146+
return;
141147
}
142148

143149
sub create_standby
@@ -162,6 +168,8 @@ recovery_target_timeline='latest'
162168

163169
# The standby may have WAL to apply before it matches the primary. That
164170
# is fine, because no test examines the standby before promotion.
171+
172+
return;
165173
}
166174

167175
sub promote_standby
@@ -183,6 +191,8 @@ sub promote_standby
183191
# after promotion so quickly that when pg_rewind runs, the standby has not
184192
# performed a checkpoint after promotion yet.
185193
standby_psql("checkpoint");
194+
195+
return;
186196
}
187197

188198
sub run_pg_rewind
@@ -266,13 +276,16 @@ recovery_target_timeline='latest'
266276
$node_master->start;
267277

268278
#### Now run the test-specific parts to check the result
279+
280+
return;
269281
}
270282

271283
# Clean up after the test. Stop both servers, if they're still running.
272284
sub clean_rewind_test
273285
{
274286
$node_master->teardown_node if defined $node_master;
275287
$node_standby->teardown_node if defined $node_standby;
288+
return;
276289
}
277290

278291
1;

src/bin/pg_rewind/t/001_basic.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ sub run_test
9797
}
9898

9999
RewindTest::clean_rewind_test();
100+
return;
100101
}
101102

102103
# Run the test in both modes

src/bin/pg_rewind/t/002_databases.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ sub run_test
5353
}
5454

5555
RewindTest::clean_rewind_test();
56+
return;
5657
}
5758

5859
# Run the test in both modes.

src/bin/pg_rewind/t/003_extrafiles.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ sub run_test
8181
"file lists match");
8282

8383
RewindTest::clean_rewind_test();
84+
return;
8485
}
8586

8687
# Run the test in both modes.

src/bin/pg_rewind/t/004_pg_xlog_symlink.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ sub run_test
7272
'table content');
7373

7474
RewindTest::clean_rewind_test();
75+
return;
7576
}
7677

7778
# Run the test in both modes

src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ sub pgbench
4242

4343
# cleanup?
4444
#unlink @filenames or die "cannot unlink files (@filenames): $!";
45+
46+
return;
4547
}
4648

4749
# Test concurrent insertion into table with UNIQUE oid column. DDL expects
@@ -817,6 +819,7 @@ sub check_pgbench_logs
817819
};
818820
}
819821
ok(unlink(@logs), "remove log files");
822+
return;
820823
}
821824

822825
my $bdir = $node->basedir;

src/bin/pgbench/t/002_pgbench_no_server.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ sub pgbench
2424
print STDERR "opts=$opts, stat=$stat, out=$out, err=$err, name=$name";
2525
command_checks_all([ 'pgbench', split(/\s+/, $opts) ],
2626
$stat, $out, $err, $name);
27+
return;
2728
}
2829

2930
# invoke pgbench with scripts
@@ -48,6 +49,7 @@ sub pgbench_scripts
4849
}
4950
}
5051
command_checks_all(\@cmd, $stat, $out, $err, $name);
52+
return;
5153
}
5254

5355
#

src/include/catalog/reformat_dat_file.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ sub strip_default_values
207207
{
208208
delete $row->{pronargs} if defined $row->{proargtypes};
209209
}
210+
return;
210211
}
211212

212213
# Format the individual elements of a Perl hash into a valid string

src/interfaces/ecpg/preproc/parse.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ sub main
415415
}
416416
}
417417
}
418+
return;
418419
}
419420

420421

@@ -431,6 +432,7 @@ sub include_file
431432
add_to_buffer($buffer, $_);
432433
}
433434
close($fh);
435+
return;
434436
}
435437

436438
sub include_addon
@@ -472,6 +474,7 @@ sub include_addon
472474
sub add_to_buffer
473475
{
474476
push(@{ $buff{ $_[0] } }, "$_[1]\n");
477+
return;
475478
}
476479

477480
sub dump_buffer
@@ -480,6 +483,7 @@ sub dump_buffer
480483
print '/* ', $buffer, ' */', "\n";
481484
my $ref = $buff{$buffer};
482485
print @$ref;
486+
return;
483487
}
484488

485489
sub dump_fields
@@ -582,6 +586,7 @@ sub dump_fields
582586
add_to_buffer('rules', ' { $$ = NULL; }');
583587
}
584588
}
589+
return;
585590
}
586591

587592

@@ -673,4 +678,5 @@ sub preload_addons
673678
push(@{ $x->{lines} }, @code);
674679
}
675680
}
681+
return;
676682
}

src/pl/plperl/plc_perlboot.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ sub ::encode_array_constructor
6262
(my $msg = shift) =~ s/\(eval \d+\) //g;
6363
chomp $msg;
6464
&::elog(&::WARNING, $msg);
65+
return;
6566
}
6667
$SIG{__WARN__} = \&plperl_warn;
6768

src/pl/plperl/text2macro.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ sub selftest
9999
warn "Test string: $string\n";
100100
warn "Result : $result";
101101
die "Failed!" if $result ne "$string\n";
102+
return;
102103
}

src/test/authentication/t/001_password.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ sub reset_pg_hba
3131
unlink($node->data_dir . '/pg_hba.conf');
3232
$node->append_conf('pg_hba.conf', "local all all $hba_method");
3333
$node->reload;
34+
return;
3435
}
3536

3637
# Test access for a single role, useful to wrap all tests into one.
@@ -47,6 +48,7 @@ sub test_role
4748
my $res = $node->psql('postgres', undef, extra_params => [ '-U', $role ]);
4849
is($res, $expected_res,
4950
"authentication $status_string for method $method, role $role");
51+
return;
5052
}
5153

5254
# Initialize master node

src/test/authentication/t/002_saslprep.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sub reset_pg_hba
2727
unlink($node->data_dir . '/pg_hba.conf');
2828
$node->append_conf('pg_hba.conf', "local all all $hba_method");
2929
$node->reload;
30+
return;
3031
}
3132

3233
# Test access for a single role, useful to wrap all tests into one.
@@ -45,6 +46,7 @@ sub test_login
4546
is($res, $expected_res,
4647
"authentication $status_string for role $role with password $password"
4748
);
49+
return;
4850
}
4951

5052
# Initialize master node. Force UTF-8 encoding, so that we can use non-ASCII

src/test/kerberos/t/001_auth.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ sub test_access
164164
'-U', $role
165165
]);
166166
is($res, $expected_res, $test_name);
167+
return;
167168
}
168169

169170
unlink($node->data_dir . '/pg_hba.conf');

src/test/ldap/t/001_auth.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ sub test_access
144144
my $res =
145145
$node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]);
146146
is($res, $expected_res, $test_name);
147+
return;
147148
}
148149

149150
note "simple bind";

0 commit comments

Comments
 (0)