Thanks to visit codestin.com
Credit goes to github.com

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

0 commit comments

Comments
 (0)