diff options
| author | Andrew Dunstan | 2018-05-27 13:08:42 +0000 |
|---|---|---|
| committer | Andrew Dunstan | 2018-05-27 13:08:42 +0000 |
| commit | 3a7cc727c7c502353dbb730a0db793abec4de44b (patch) | |
| tree | c140b2974559d0a13d98c132ae52f7d0992aff95 /src/tools | |
| parent | 8a56ff484808e9c05df9656cf4244229e8c7960d (diff) | |
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
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/copyright.pl | 1 | ||||
| -rwxr-xr-x | src/tools/git_changelog | 3 | ||||
| -rw-r--r-- | src/tools/msvc/Install.pm | 13 | ||||
| -rw-r--r-- | src/tools/msvc/MSBuildProject.pm | 11 | ||||
| -rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 5 | ||||
| -rw-r--r-- | src/tools/msvc/Project.pm | 15 | ||||
| -rw-r--r-- | src/tools/msvc/Solution.pm | 5 | ||||
| -rw-r--r-- | src/tools/msvc/VCBuildProject.pm | 5 | ||||
| -rw-r--r-- | src/tools/msvc/builddoc.pl | 2 | ||||
| -rw-r--r-- | src/tools/msvc/gendef.pl | 3 | ||||
| -rw-r--r-- | src/tools/msvc/vcregress.pl | 14 | ||||
| -rwxr-xr-x | src/tools/pginclude/pgcheckdefines | 2 | ||||
| -rwxr-xr-x | src/tools/pgindent/pgindent | 7 | ||||
| -rw-r--r-- | src/tools/pgperlcritic/perlcriticrc | 5 | ||||
| -rwxr-xr-x | src/tools/pgperlcritic/pgperlcritic | 2 | ||||
| -rwxr-xr-x | src/tools/version_stamp.pl | 1 |
16 files changed, 92 insertions, 2 deletions
diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl index 41cb93d658a..08b9e5b42e3 100755 --- a/src/tools/copyright.pl +++ b/src/tools/copyright.pl @@ -62,6 +62,7 @@ sub wanted $line =~ s/$cc (\d{4}), $pgdg/$ccliteral $1-$year, $pgdg/i; } untie @lines; + return; } print "Manually update:\n"; diff --git a/src/tools/git_changelog b/src/tools/git_changelog index 1262bc104c2..af9afcf1f0f 100755 --- a/src/tools/git_changelog +++ b/src/tools/git_changelog @@ -333,6 +333,7 @@ sub push_commit push @{ $all_commits_by_branch{ $c->{'branch'} } }, $cc; $cc->{'branch_position'}{ $c->{'branch'} } = -1 + @{ $all_commits_by_branch{ $c->{'branch'} } }; + return; } sub hash_commit @@ -355,6 +356,7 @@ sub parse_datetime sub output_str { ($oldest_first) ? ($output_line .= sprintf(shift, @_)) : printf(@_); + return; } sub output_details @@ -395,6 +397,7 @@ sub output_details } } output_str("\n"); + return; } sub usage diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm index 67124bb109a..6f1c30546ae 100644 --- a/src/tools/msvc/Install.pm +++ b/src/tools/msvc/Install.pm @@ -40,6 +40,7 @@ sub lcopy copy($src, $target) || confess "Could not copy $src to $target\n"; + return; } sub Install @@ -173,6 +174,7 @@ sub Install GenerateNLSFiles($target, $config->{nls}, $majorver) if ($config->{nls}); print "Installation complete.\n"; + return; } sub EnsureDirectories @@ -183,6 +185,7 @@ sub EnsureDirectories { mkdir $target . '/' . $d unless -d ($target . '/' . $d); } + return; } sub CopyFiles @@ -200,6 +203,7 @@ sub CopyFiles lcopy($f, $target . basename($f)); } print "\n"; + return; } sub CopySetOfFiles @@ -215,6 +219,7 @@ sub CopySetOfFiles lcopy($_, $tgt) || croak "Could not copy $_: $!\n"; } print "\n"; + return; } sub CopySolutionOutput @@ -340,6 +345,7 @@ sub CopySolutionOutput print "."; } print "\n"; + return; } sub GenerateConversionScript @@ -377,6 +383,7 @@ sub GenerateConversionScript print $F $sql; close($F); print "\n"; + return; } sub GenerateTimezoneFiles @@ -408,6 +415,7 @@ sub GenerateTimezoneFiles system(@args); print "\n"; + return; } sub GenerateTsearchFiles @@ -449,6 +457,7 @@ sub GenerateTsearchFiles } close($F); print "\n"; + return; } sub CopyContribFiles @@ -475,6 +484,7 @@ sub CopyContribFiles } } print "\n"; + return; } sub CopySubdirFiles @@ -561,6 +571,7 @@ sub CopySubdirFiles print '.'; } } + return; } sub ParseAndCleanRule @@ -676,6 +687,7 @@ sub CopyIncludeFiles $target . '/include/informix/esql/', 'src/interfaces/ecpg/include/', split /\s+/, $1); + return; } sub GenerateNLSFiles @@ -719,6 +731,7 @@ sub GenerateNLSFiles } } print "\n"; + return; } sub DetermineMajorVersion diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index 2726d603afd..27397ba3fb1 100644 --- a/src/tools/msvc/MSBuildProject.pm +++ b/src/tools/msvc/MSBuildProject.pm @@ -80,6 +80,7 @@ EOF strpool => 'true', runtime => 'MultiThreadedDLL' }); + return; } sub AddDefine @@ -87,6 +88,7 @@ sub AddDefine my ($self, $def) = @_; $self->{defines} .= $def . ';'; + return; } sub WriteReferences @@ -112,6 +114,7 @@ EOF </ItemGroup> EOF } + return; } sub WriteFiles @@ -223,6 +226,7 @@ EOF </ItemGroup> EOF } + return; } sub WriteConfigurationHeader @@ -234,6 +238,7 @@ sub WriteConfigurationHeader <Platform>$self->{platform}</Platform> </ProjectConfiguration> EOF + return; } sub WriteConfigurationPropertyGroup @@ -252,6 +257,7 @@ sub WriteConfigurationPropertyGroup <WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization> </PropertyGroup> EOF + return; } sub WritePropertySheetsPropertyGroup @@ -262,6 +268,7 @@ sub WritePropertySheetsPropertyGroup <Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> EOF + return; } sub WriteAdditionalProperties @@ -272,6 +279,7 @@ sub WriteAdditionalProperties <IntDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</IntDir> <LinkIncremental Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">false</LinkIncremental> EOF + return; } sub WriteItemDefinitionGroup @@ -364,6 +372,7 @@ EOF print $f <<EOF; </ItemDefinitionGroup> EOF + return; } sub Footer @@ -377,6 +386,7 @@ sub Footer </ImportGroup> </Project> EOF + return; } package VC2010Project; @@ -441,6 +451,7 @@ sub WriteConfigurationPropertyGroup <PlatformToolset>$self->{PlatformToolset}</PlatformToolset> </PropertyGroup> EOF + return; } package VC2013Project; diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index d0d7d464952..4543d87d83b 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -964,6 +964,7 @@ sub AddContrib # Are there any output data files to build? GenerateContribSqlFiles($n, $mf); + return; } sub GenerateContribSqlFiles @@ -1010,6 +1011,7 @@ sub GenerateContribSqlFiles } } } + return; } sub AdjustContribProj @@ -1020,6 +1022,7 @@ sub AdjustContribProj \@contrib_uselibpq, \@contrib_uselibpgport, \@contrib_uselibpgcommon, $contrib_extralibs, $contrib_extrasource, $contrib_extraincludes); + return; } sub AdjustFrontendProj @@ -1030,6 +1033,7 @@ sub AdjustFrontendProj \@frontend_uselibpq, \@frontend_uselibpgport, \@frontend_uselibpgcommon, $frontend_extralibs, $frontend_extrasource, $frontend_extraincludes); + return; } sub AdjustModule @@ -1086,6 +1090,7 @@ sub AdjustModule $proj->AddFile($i); } } + return; } END diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index 46c680d5367..261c913ea07 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -45,6 +45,7 @@ sub AddFile my ($self, $filename) = @_; $self->{files}->{$filename} = 1; + return; } sub AddFiles @@ -56,6 +57,7 @@ sub AddFiles { $self->{files}->{ $dir . "/" . $f } = 1; } + return; } sub ReplaceFile @@ -110,6 +112,7 @@ sub RelocateFiles $self->AddFile($targetdir . '/' . basename($f)); } } + return; } sub AddReference @@ -122,6 +125,7 @@ sub AddReference $self->AddLibrary( "__CFGNAME__/" . $ref->{name} . "/" . $ref->{name} . ".lib"); } + return; } sub AddLibrary @@ -138,6 +142,7 @@ sub AddLibrary { push @{ $self->{suffixlib} }, $lib; } + return; } sub AddIncludeDir @@ -149,6 +154,7 @@ sub AddIncludeDir $self->{includes} .= ';'; } $self->{includes} .= $inc; + return; } sub AddPrefixInclude @@ -156,6 +162,7 @@ sub AddPrefixInclude my ($self, $inc) = @_; $self->{prefixincludes} = $inc . ';' . $self->{prefixincludes}; + return; } sub AddDefine @@ -164,6 +171,7 @@ sub AddDefine $def =~ s/"/""/g; $self->{defines} .= $def . ';'; + return; } sub FullExportDLL @@ -173,6 +181,7 @@ sub FullExportDLL $self->{builddef} = 1; $self->{def} = "./__CFGNAME__/$self->{name}/$self->{name}.def"; $self->{implib} = "__CFGNAME__/$self->{name}/$libname"; + return; } sub UseDef @@ -180,6 +189,7 @@ sub UseDef my ($self, $def) = @_; $self->{def} = $def; + return; } sub AddDir @@ -284,6 +294,7 @@ sub AddDir } $self->AddDirResourceFile($reldir); + return; } # If the directory's Makefile bears a description string, add a resource file. @@ -299,6 +310,7 @@ sub AddDirResourceFile if ($mf =~ /^PGAPPICON\s*=\s*(.*)$/m) { $ico = $1; } $self->AddResourceFile($reldir, $desc, $ico); } + return; } sub AddResourceFile @@ -332,6 +344,7 @@ sub AddResourceFile close($i); } $self->AddFile("$dir/win32ver.rc"); + return; } sub DisableLinkerWarnings @@ -341,6 +354,7 @@ sub DisableLinkerWarnings $self->{disablelinkerwarnings} .= ',' unless ($self->{disablelinkerwarnings} eq ''); $self->{disablelinkerwarnings} .= $warnings; + return; } sub Save @@ -366,6 +380,7 @@ sub Save $self->WriteFiles($f); $self->Footer($f); close($f); + return; } sub GetAdditionalLinkerDependencies diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index a33e68eccf0..8f0b355fc0e 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -75,6 +75,7 @@ sub DeterminePlatform $? >> 8 == 0 or die "cl command not found"; $self->{platform} = ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32'; print "Detected hardware platform: $self->{platform}\n"; + return; } # Return 1 if $oldfile is newer than $newfile, or if $newfile doesn't exist. @@ -112,6 +113,7 @@ sub copyFile } close($i); close($o); + return; } sub GenerateFiles @@ -533,6 +535,7 @@ EOF <!ENTITY majorversion "$self->{majorver}"> EOF close($o); + return; } sub GenerateDefFile @@ -555,6 +558,7 @@ sub GenerateDefFile close($of); close($if); } + return; } sub AddProject @@ -727,6 +731,7 @@ EOF EndGlobal EOF close($sln); + return; } sub GetFakeConfigure diff --git a/src/tools/msvc/VCBuildProject.pm b/src/tools/msvc/VCBuildProject.pm index 57b8525f3fe..03b890b9b74 100644 --- a/src/tools/msvc/VCBuildProject.pm +++ b/src/tools/msvc/VCBuildProject.pm @@ -56,6 +56,7 @@ EOF </Configurations> EOF $self->WriteReferences($f); + return; } sub WriteFiles @@ -152,6 +153,7 @@ EOF print $f <<EOF; </Files> EOF + return; } sub Footer @@ -162,6 +164,7 @@ sub Footer <Globals/> </VisualStudioProject> EOF + return; } sub WriteConfiguration @@ -227,6 +230,7 @@ EOF print $f <<EOF; </Configuration> EOF + return; } sub WriteReferences @@ -239,6 +243,7 @@ sub WriteReferences " <ProjectReference ReferencedProjectIdentifier=\"$ref->{guid}\" Name=\"$ref->{name}\" />\n"; } print $f " </References>\n"; + return; } sub GenerateCustomTool diff --git a/src/tools/msvc/builddoc.pl b/src/tools/msvc/builddoc.pl index 8ab7385b9e8..f6eb73db212 100644 --- a/src/tools/msvc/builddoc.pl +++ b/src/tools/msvc/builddoc.pl @@ -107,7 +107,7 @@ sub renamefiles move $f, $nf; } chdir $savedir; - + return; } sub missing diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl index 9f0cf76fb35..77c3a775b05 100644 --- a/src/tools/msvc/gendef.pl +++ b/src/tools/msvc/gendef.pl @@ -20,6 +20,7 @@ sub dumpsyms system("dumpbin /symbols /out:$tmpfile $_ >NUL") && die "Could not call dumpbin"; rename($tmpfile, $symfile); + return; } # Given a symbol file path, loops over its contents @@ -116,6 +117,7 @@ sub extract_syms $def->{ $pieces[6] } = $pieces[3]; } close($f); + return; } sub writedef @@ -143,6 +145,7 @@ sub writedef } } close($fh); + return; } diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index a74adbaf998..4dc051aa628 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -111,6 +111,7 @@ sub installcheck system(@args); my $status = $? >> 8; exit $status if $status; + return; } sub check @@ -132,6 +133,7 @@ sub check system(@args); my $status = $? >> 8; exit $status if $status; + return; } sub ecpgcheck @@ -157,6 +159,7 @@ sub ecpgcheck system(@args); $status = $? >> 8; exit $status if $status; + return; } sub isolationcheck @@ -173,6 +176,7 @@ sub isolationcheck system(@args); my $status = $? >> 8; exit $status if $status; + return; } sub tap_check @@ -224,6 +228,7 @@ sub bincheck $mstat ||= $status; } exit $mstat if $mstat; + return; } sub taptest @@ -244,6 +249,7 @@ sub taptest InstallTemp(); my $status = tap_check(@args); exit $status if $status; + return; } sub mangle_plpython3 @@ -365,6 +371,7 @@ sub plcheck } chdir "$topdir"; + return; } sub subdircheck @@ -413,6 +420,7 @@ sub subdircheck print join(' ', @args), "\n"; system(@args); chdir ".."; + return; } sub contribcheck @@ -434,6 +442,7 @@ sub contribcheck $mstat ||= $status; } exit $mstat if $mstat; + return; } sub modulescheck @@ -447,6 +456,7 @@ sub modulescheck $mstat ||= $status; } exit $mstat if $mstat; + return; } sub recoverycheck @@ -457,6 +467,7 @@ sub recoverycheck my $dir = "$topdir/src/test/recovery"; my $status = tap_check($dir); exit $status if $status; + return; } # Run "initdb", then reconfigure authentication. @@ -501,6 +512,7 @@ sub generate_db system('createdb', quote_system_arg($dbname)); my $status = $? >> 8; exit $status if $status; + return; } sub upgradecheck @@ -586,6 +598,7 @@ sub upgradecheck print "dumps not identical!\n"; exit(1); } + return; } sub fetchRegressOpts @@ -680,6 +693,7 @@ sub InstallTemp Install("$tmp_installdir", "all", $config); } $ENV{PATH} = "$tmp_installdir/bin;$ENV{PATH}"; + return; } sub usage diff --git a/src/tools/pginclude/pgcheckdefines b/src/tools/pginclude/pgcheckdefines index c547df45ea5..4edf7fc56e8 100755 --- a/src/tools/pginclude/pgcheckdefines +++ b/src/tools/pginclude/pgcheckdefines @@ -297,4 +297,6 @@ sub checkit print "$file references $symbol, defined in @places\n"; # print "includes: @includes\n"; + + return; } diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index fc616e7a08c..2d81672e158 100755 --- a/src/tools/pgindent/pgindent +++ b/src/tools/pgindent/pgindent @@ -93,6 +93,8 @@ sub check_indent "You appear to have GNU indent rather than BSD indent.\n"; exit 1; } + + return; } @@ -162,6 +164,7 @@ sub process_exclude } close($eh); } + return; } @@ -189,6 +192,7 @@ sub write_source || die "cannot open file \"$source_filename\": $!\n"; print $src_fh $source; close($src_fh); + return; } @@ -316,6 +320,7 @@ sub diff . $pre_fh->filename . " " . $post_fh->filename . " >&2"); + return; } @@ -361,6 +366,7 @@ sub run_build $ENV{PGINDENT} = abs_path('pg_bsd_indent'); chdir $save_dir; + return; } @@ -382,6 +388,7 @@ sub build_clean system("rm -rf src/tools/pgindent/pg_bsd_indent"); system("rm -f src/tools/pgindent/tmp_typedefs.list"); + return; } diff --git a/src/tools/pgperlcritic/perlcriticrc b/src/tools/pgperlcritic/perlcriticrc index 1059002ad50..c831086ae92 100644 --- a/src/tools/pgperlcritic/perlcriticrc +++ b/src/tools/pgperlcritic/perlcriticrc @@ -12,3 +12,8 @@ theme = core # allow octal constants with leading zeros [-ValuesAndExpressions::ProhibitLeadingZeros] + +# for now raise severity of this to level 5 +[Subroutines::RequireFinalReturn] +severity = 5 + diff --git a/src/tools/pgperlcritic/pgperlcritic b/src/tools/pgperlcritic/pgperlcritic index 40d006bef6e..28264b1a242 100755 --- a/src/tools/pgperlcritic/pgperlcritic +++ b/src/tools/pgperlcritic/pgperlcritic @@ -15,7 +15,7 @@ PERLCRITIC=${PERLCRITIC:-perlcritic} # locate all Perl files in the tree { # take all .pl and .pm files - find . -type f -a \( -name '*.pl' -o -name '*.pm' \) -print + find . -type f -name '*.p[lm]' -print # take executable files that file(1) thinks are perl files find . -type f -perm -100 -exec file {} \; -print | egrep -i ':.*perl[0-9]*\>' | diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl index 392fd4ae541..499e3deb3ae 100755 --- a/src/tools/version_stamp.pl +++ b/src/tools/version_stamp.pl @@ -141,4 +141,5 @@ sub sed_file or die "mv failed: $?"; $fixedfiles .= "\t$filename\n"; + return; } |
