Use perl warnings pragma consistently
We've had a mixture of the warnings pragma, the -w switch on the shebang line, and no warnings at all. This patch removes the -w swicth and add the warnings pragma to all perl sources missing it. It raises the severity of the TestingAndDebugging::RequireUseWarnings perlcritic policy to level 5, so that we catch any future violations. Discussion: https://postgr.es/m/20200412074245.GB623763@rfd.leadboat.com
This commit is contained in:
parent
8930e43ecd
commit
7be5d8df1f
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
# make sure we are in a sane environment.
|
# make sure we are in a sane environment.
|
||||||
use DBI();
|
use DBI();
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# contrib/intarray/bench/create_test.pl
|
# contrib/intarray/bench/create_test.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
print <<EOT;
|
print <<EOT;
|
||||||
create table message (
|
create table message (
|
||||||
mid int not null,
|
mid int not null,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my $integer = '[+-]?[0-9]+';
|
my $integer = '[+-]?[0-9]+';
|
||||||
my $real = '[+-]?[0-9]+\.[0-9]+';
|
my $real = '[+-]?[0-9]+\.[0-9]+';
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# this script will sort any table with the segment data type in its last column
|
# this script will sort any table with the segment data type in its last column
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my @rows;
|
my @rows;
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# /usr/bin/perl -w
|
# /usr/bin/perl
|
||||||
|
|
||||||
# doc/src/sgml/mk_feature_tables.pl
|
# doc/src/sgml/mk_feature_tables.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my $yesno = $ARGV[0];
|
my $yesno = $ARGV[0];
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# genbki.pl
|
# genbki.pl
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Gen_fmgrtab.pl
|
# Gen_fmgrtab.pl
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
# # and Unicode name (not used in this script)
|
# # and Unicode name (not used in this script)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_BIG5.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_BIG5.pl';
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
# and the "b" field is the hex byte sequence for GB18030
|
# and the "b" field is the hex byte sequence for GB18030
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl';
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
# "euc-jis-2004-std.txt" (http://x0213.org)
|
# "euc-jis-2004-std.txt" (http://x0213.org)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl';
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
# organization's ftp site.
|
# organization's ftp site.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl';
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
# # and Unicode name (not used in this script)
|
# # and Unicode name (not used in this script)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl';
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
# # and Unicode name (not used in this script)
|
# # and Unicode name (not used in this script)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl';
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
# and the "b" field is the hex byte sequence for GB18030
|
# and the "b" field is the hex byte sequence for GB18030
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_GB18030.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_GB18030.pl';
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# # and Unicode name (not used in this script)
|
# # and Unicode name (not used in this script)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl';
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
# "sjis-0213-2004-std.txt" (http://x0213.org)
|
# "sjis-0213-2004-std.txt" (http://x0213.org)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
# first generate UTF-8 --> SHIFT_JIS_2004 table
|
# first generate UTF-8 --> SHIFT_JIS_2004 table
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# ftp site.
|
# ftp site.
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_SJIS.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_SJIS.pl';
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
# and the "b" field is the hex byte sequence for UHC
|
# and the "b" field is the hex byte sequence for UHC
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_UHC.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_UHC.pl';
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
# # and Unicode name (not used in this script)
|
# # and Unicode name (not used in this script)
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use convutils;
|
use convutils;
|
||||||
|
|
||||||
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_most.pl';
|
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_most.pl';
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
package convutils;
|
package convutils;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use Carp;
|
use Carp;
|
||||||
use Exporter 'import';
|
use Exporter 'import';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
|
|
||||||
#
|
#
|
||||||
# gen_qsort_tuple.pl
|
# gen_qsort_tuple.pl
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my $SUFFIX;
|
my $SUFFIX;
|
||||||
my $EXTRAARGS;
|
my $EXTRAARGS;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
# create_help.pl -- converts SGML docs to internal psql help
|
# create_help.pl -- converts SGML docs to internal psql help
|
||||||
@ -20,6 +20,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my $docdir = $ARGV[0] or die "$0: missing required argument: docdir\n";
|
my $docdir = $ARGV[0] or die "$0: missing required argument: docdir\n";
|
||||||
my $hfile = $ARGV[1] . '.h'
|
my $hfile = $ARGV[1] . '.h'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
# use of SRCDIR/SUBDIR is required for supporting VPath builds
|
# use of SRCDIR/SUBDIR is required for supporting VPath builds
|
||||||
my $srcdir = $ENV{'SRCDIR'} or die 'SRCDIR environment variable is not set';
|
my $srcdir = $ENV{'SRCDIR'} or die 'SRCDIR environment variable is not set';
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# src/pl/plperl/plc_perlboot.pl
|
# src/pl/plperl/plc_perlboot.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use 5.008001;
|
use 5.008001;
|
||||||
use vars qw(%_SHARED $_TD);
|
use vars qw(%_SHARED $_TD);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!perl -w
|
#!perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/perl
|
#! /usr/bin/perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
use locale;
|
use locale;
|
||||||
|
|
||||||
open(my $in_fh, '<', $ARGV[0]) || die;
|
open(my $in_fh, '<', $ARGV[0]) || die;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package SimpleTee;
|
package SimpleTee;
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
sub TIEHANDLE
|
sub TIEHANDLE
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# fix-old-flex-code.pl
|
# fix-old-flex-code.pl
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# src/tools/msvc/build.pl
|
# src/tools/msvc/build.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# src/tools/msvc/pgbison.pl
|
# src/tools/msvc/pgbison.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
|
||||||
# assume we are in the postgres source root
|
# assume we are in the postgres source root
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# src/tools/msvc/pgflex.pl
|
# src/tools/msvc/pgflex.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
|
||||||
# silence flex bleatings about file path style
|
# silence flex bleatings about file path style
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# src/tools/msvc/vcregress.pl
|
# src/tools/msvc/vcregress.pl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
our $config;
|
our $config;
|
||||||
|
|
||||||
|
@ -19,6 +19,10 @@ verbose = %f: %m at line %l, column %c. %e. ([%p] Severity: %s)\n
|
|||||||
# allow octal constants with leading zeros
|
# allow octal constants with leading zeros
|
||||||
[-ValuesAndExpressions::ProhibitLeadingZeros]
|
[-ValuesAndExpressions::ProhibitLeadingZeros]
|
||||||
|
|
||||||
|
# insist on use of the warnings pragma
|
||||||
|
[TestingAndDebugging::RequireUseWarnings]
|
||||||
|
severity = 5
|
||||||
|
|
||||||
# for now raise severity of this to level 5
|
# for now raise severity of this to level 5
|
||||||
[Subroutines::RequireFinalReturn]
|
[Subroutines::RequireFinalReturn]
|
||||||
severity = 5
|
severity = 5
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl
|
||||||
|
|
||||||
#
|
#
|
||||||
# This script looks for symbols that are referenced in #ifdef or defined()
|
# This script looks for symbols that are referenced in #ifdef or defined()
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
use Cwd;
|
use Cwd;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
# version_stamp.pl -- update version stamps throughout the source tree
|
# version_stamp.pl -- update version stamps throughout the source tree
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
# Major version is hard-wired into the script. We update it when we branch
|
# Major version is hard-wired into the script. We update it when we branch
|
||||||
# a new development version.
|
# a new development version.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user