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
#!/usr/bin/perl
use strict;
+use warnings;
# make sure we are in a sane environment.
use DBI();
# contrib/intarray/bench/create_test.pl
use strict;
+use warnings;
+
print <<EOT;
create table message (
mid int not null,
#!/usr/bin/perl
use strict;
+use warnings;
my $integer = '[+-]?[0-9]+';
my $real = '[+-]?[0-9]+\.[0-9]+';
# this script will sort any table with the segment data type in its last column
use strict;
+use warnings;
my @rows;
-# /usr/bin/perl -w
+# /usr/bin/perl
# doc/src/sgml/mk_feature_tables.pl
use strict;
+use warnings;
my $yesno = $ARGV[0];
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#----------------------------------------------------------------------
#
# genbki.pl
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#-------------------------------------------------------------------------
#
# Gen_fmgrtab.pl
# # and Unicode name (not used in this script)
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_BIG5.pl';
# and the "b" field is the hex byte sequence for GB18030
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl';
# "euc-jis-2004-std.txt" (http://x0213.org)
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl';
# organization's ftp site.
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl';
# # and Unicode name (not used in this script)
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl';
# # and Unicode name (not used in this script)
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl';
# and the "b" field is the hex byte sequence for GB18030
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_GB18030.pl';
# # and Unicode name (not used in this script)
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl';
# "sjis-0213-2004-std.txt" (http://x0213.org)
use strict;
+use warnings;
+
use convutils;
# first generate UTF-8 --> SHIFT_JIS_2004 table
# ftp site.
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_SJIS.pl';
# and the "b" field is the hex byte sequence for UHC
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_UHC.pl';
# # and Unicode name (not used in this script)
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_most.pl';
package convutils;
use strict;
+use warnings;
use Carp;
use Exporter 'import';
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# gen_qsort_tuple.pl
#
use strict;
+use warnings;
my $SUFFIX;
my $EXTRAARGS;
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#################################################################
# create_help.pl -- converts SGML docs to internal psql help
#
use strict;
+use warnings;
my $docdir = $ARGV[0] or die "$0: missing required argument: docdir\n";
my $hfile = $ARGV[1] . '.h'
-#!/usr/bin/perl -w
+#!/usr/bin/perl
use strict;
+use warnings;
# use of SRCDIR/SUBDIR is required for supporting VPath builds
my $srcdir = $ENV{'SRCDIR'} or die 'SRCDIR environment variable is not set';
# src/pl/plperl/plc_perlboot.pl
use strict;
+use warnings;
use 5.008001;
use vars qw(%_SHARED $_TD);
-#!perl -w
+#!perl
use strict;
use warnings;
#! /usr/bin/perl
use strict;
+use warnings;
use locale;
open(my $in_fh, '<', $ARGV[0]) || die;
package SimpleTee;
use strict;
+use warnings;
sub TIEHANDLE
{
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#----------------------------------------------------------------------
#
# fix-old-flex-code.pl
# src/tools/msvc/build.pl
use strict;
+use warnings;
use File::Basename;
use File::Spec;
# src/tools/msvc/pgbison.pl
use strict;
+use warnings;
+
use File::Basename;
# assume we are in the postgres source root
# src/tools/msvc/pgflex.pl
use strict;
+use warnings;
+
use File::Basename;
# silence flex bleatings about file path style
# src/tools/msvc/vcregress.pl
use strict;
+use warnings;
our $config;
# allow octal constants with leading zeros
[-ValuesAndExpressions::ProhibitLeadingZeros]
+# insist on use of the warnings pragma
+[TestingAndDebugging::RequireUseWarnings]
+severity = 5
+
# for now raise severity of this to level 5
[Subroutines::RequireFinalReturn]
severity = 5
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#
# This script looks for symbols that are referenced in #ifdef or defined()
#
use strict;
+use warnings;
use Cwd;
use File::Basename;
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#################################################################
# version_stamp.pl -- update version stamps throughout the source tree
#
use strict;
+use warnings;
# Major version is hard-wired into the script. We update it when we branch
# a new development version.