git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8930e43)
Use perl warnings pragma consistently
2020年4月13日 15:55:45 +0000 (11:55 -0400)
2020年4月13日 15:55:45 +0000 (11:55 -0400)
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

35 files changed:

diff --git a/contrib/intarray/bench/bench.pl b/contrib/intarray/bench/bench.pl
index 92035d6c06ab7375a7bc5fa313a0947de21ddfb4..daf3febc804a1dc558528cb09e4ade7dd851551a 100755 (executable)
--- a/contrib/intarray/bench/bench.pl
+++ b/contrib/intarray/bench/bench.pl
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use strict;
+use warnings;
# make sure we are in a sane environment.
use DBI();
diff --git a/contrib/intarray/bench/create_test.pl b/contrib/intarray/bench/create_test.pl
index d2c678bb53c3fcb257aa6e24898a4cd44195584d..3f2a6e4da2a1eef2845ea645f864b9876612b6e6 100755 (executable)
--- a/contrib/intarray/bench/create_test.pl
+++ b/contrib/intarray/bench/create_test.pl
@@ -3,6 +3,8 @@
# contrib/intarray/bench/create_test.pl
use strict;
+use warnings;
+
print <<EOT;
create table message (
mid int not null,
diff --git a/contrib/seg/seg-validate.pl b/contrib/seg/seg-validate.pl
index b8957ed984a01ba20cb87a645fdc71f63585dcf9..9fa0887e7102a315a330c04a7d76868021316406 100755 (executable)
--- a/contrib/seg/seg-validate.pl
+++ b/contrib/seg/seg-validate.pl
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use strict;
+use warnings;
my $integer = '[+-]?[0-9]+';
my $real = '[+-]?[0-9]+\.[0-9]+';
diff --git a/contrib/seg/sort-segments.pl b/contrib/seg/sort-segments.pl
index 04eafd92f21fe7185ffaebfaf9df43a8e7f3555b..2e3c9734a94decc88d9017a38a66519c3f287657 100755 (executable)
--- a/contrib/seg/sort-segments.pl
+++ b/contrib/seg/sort-segments.pl
@@ -3,6 +3,7 @@
# this script will sort any table with the segment data type in its last column
use strict;
+use warnings;
my @rows;
diff --git a/doc/src/sgml/mk_feature_tables.pl b/doc/src/sgml/mk_feature_tables.pl
index 476e50e66d0cf2433345f39ae48b6ed88c0b314c..ee158cb1969fa7637b169eab6252fa4e76d1d943 100644 (file)
--- a/doc/src/sgml/mk_feature_tables.pl
+++ b/doc/src/sgml/mk_feature_tables.pl
@@ -1,8 +1,9 @@
-# /usr/bin/perl -w
+# /usr/bin/perl
# doc/src/sgml/mk_feature_tables.pl
use strict;
+use warnings;
my $yesno = $ARGV[0];
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index ad24f4dcb93aba172210a67abe51728bbc0f6339..da3412459542082b17f4e220de2a674295c6c955 100644 (file)
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#----------------------------------------------------------------------
#
# genbki.pl
diff --git a/src/backend/utils/Gen_fmgrtab.pl b/src/backend/utils/Gen_fmgrtab.pl
index 7c68dbec22ac94ce3c317ca93787b7e770c21e63..b7c7b4c8fae17c88fb6ae4696182a1bedbc622b8 100644 (file)
--- a/src/backend/utils/Gen_fmgrtab.pl
+++ b/src/backend/utils/Gen_fmgrtab.pl
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#-------------------------------------------------------------------------
#
# Gen_fmgrtab.pl
diff --git a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
index 4c8aaf751ca7bff9a55cdf407dd4a09aea8eff68..84c9c5354130a4dc0e8380f3023bd3ff5f6bbd77 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
@@ -25,6 +25,8 @@
# # 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
index b493a13838b471774cec423dab9fa855681a3e8f..1596b64238f1253d7870ceb06a902f261ea129c0 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
@@ -14,6 +14,8 @@
# 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
index 4faf59727118a8f79f7210337a884da627c3d9da..092a5b44f558e4b5c20af30b7a046ae7ee2cf8e3 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
@@ -8,6 +8,8 @@
# "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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
index 86743a40741a5ada982615b4c657222b98591313..1d88c0296ee23b1eb95c37b68d7a55066817cbfd 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
@@ -12,6 +12,8 @@
# organization's ftp site.
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
index a81a7d61cee693ba5eb898fa3be1126d7dde7ce1..b560f9f37eaf35401436a15594562dca0086a6e1 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
@@ -17,6 +17,8 @@
# # 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
index b9ec01dd8522c7c41bf22929205a63dbf5e9cdee..0f52183ff5fa5a4858719d54c92a0efb11d97487 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
@@ -18,6 +18,8 @@
# # 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
index 779e3f7f01095f59d3e838001bc24850b94b4a93..57e63b4004a2c961ca8eef7b7aa59e9de58519ca 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
@@ -14,6 +14,8 @@
# 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
index c1967e00da24589b052579161669f18a8649a4da..0bcea9e0d4f303a2309397a77b1d4fa6d962c0fb 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
@@ -16,6 +16,8 @@
# # 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
index cac9a9c87dcb7974dab9b87129128a90d6affff5..b516e91306f51bda24b44b08a79f995cbc3a5bf7 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
@@ -8,6 +8,8 @@
# "sjis-0213-2004-std.txt" (http://x0213.org)
use strict;
+use warnings;
+
use convutils;
# first generate UTF-8 --> SHIFT_JIS_2004 table
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
index c65091159bb61a0a4713800eb64b61d1b4fabd43..5f4512ec87ed5b727f79585d615097fc5abdff0e 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
@@ -11,6 +11,8 @@
# ftp site.
use strict;
+use warnings;
+
use convutils;
my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_SJIS.pl';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
index 78b982a22e683aab6b10e4d4ebce458321b203b9..3282106d7f07b8d9d9cc6474b86127002241653e 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_UHC.pl
@@ -14,6 +14,8 @@
# 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';
diff --git a/src/backend/utils/mb/Unicode/UCS_to_most.pl b/src/backend/utils/mb/Unicode/UCS_to_most.pl
index 7ff724558d3158168ac03f7ee43230cf8a89e2f3..8a7b26a5c5f3ce53900f1a6640d38849a7698500 100755 (executable)
--- a/src/backend/utils/mb/Unicode/UCS_to_most.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_most.pl
@@ -16,6 +16,8 @@
# # 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';
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm
index 1903b345cbf77b6e0b059f2d7cbd3499af3eb89c..2f64a12ea1492f28372e47d60cacf77bea3f8f0f 100644 (file)
--- a/src/backend/utils/mb/Unicode/convutils.pm
+++ b/src/backend/utils/mb/Unicode/convutils.pm
@@ -6,6 +6,7 @@
package convutils;
use strict;
+use warnings;
use Carp;
use Exporter 'import';
diff --git a/src/backend/utils/sort/gen_qsort_tuple.pl b/src/backend/utils/sort/gen_qsort_tuple.pl
index b6b2ffa7d0be161a0b474034dd247c6bd111ddb3..9ed6cfc7eaa76d530cdecea9d36afe3e2abbb489 100644 (file)
--- a/src/backend/utils/sort/gen_qsort_tuple.pl
+++ b/src/backend/utils/sort/gen_qsort_tuple.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# gen_qsort_tuple.pl
@@ -26,6 +26,7 @@
#
use strict;
+use warnings;
my $SUFFIX;
my $EXTRAARGS;
diff --git a/src/bin/psql/create_help.pl b/src/bin/psql/create_help.pl
index a3b34603efe777985dc7523ee6e459c6c7713c3c..ee82e645832e07ac9a17ad4143e98508bd81942d 100644 (file)
--- a/src/bin/psql/create_help.pl
+++ b/src/bin/psql/create_help.pl
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#################################################################
# create_help.pl -- converts SGML docs to internal psql help
@@ -20,6 +20,7 @@
#
use strict;
+use warnings;
my $docdir = $ARGV[0] or die "0ドル: missing required argument: docdir\n";
my $hfile = $ARGV[1] . '.h'
diff --git a/src/interfaces/libpq/test/regress.pl b/src/interfaces/libpq/test/regress.pl
index 3ad638a91b7a37a63604d3d32cb3897c6e9bcb7e..54db4f1abfcc9ca49f9a822328ecfd56690b2873 100644 (file)
--- a/src/interfaces/libpq/test/regress.pl
+++ b/src/interfaces/libpq/test/regress.pl
@@ -1,6 +1,7 @@
-#!/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';
diff --git a/src/pl/plperl/plc_perlboot.pl b/src/pl/plperl/plc_perlboot.pl
index f41aa80e80b062943d155494c32f5ff24dd1ec04..ee1b9bf4634bab7440ddbd342c793b322869f823 100644 (file)
--- a/src/pl/plperl/plc_perlboot.pl
+++ b/src/pl/plperl/plc_perlboot.pl
@@ -1,6 +1,7 @@
# src/pl/plperl/plc_perlboot.pl
use strict;
+use warnings;
use 5.008001;
use vars qw(%_SHARED $_TD);
diff --git a/src/pl/plperl/plperl_opmask.pl b/src/pl/plperl/plperl_opmask.pl
index e4e64b843f2d3712bcea435b3816172dcb35f379..3b33112ff945609b75fccd39d6821995093fa23f 100644 (file)
--- a/src/pl/plperl/plperl_opmask.pl
+++ b/src/pl/plperl/plperl_opmask.pl
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl
use strict;
use warnings;
diff --git a/src/test/locale/sort-test.pl b/src/test/locale/sort-test.pl
index b8fc93aab18583670edce598c65ad3d24f2ed762..b61968b7e0a55ad8ad925c5004c90ec19a6466df 100755 (executable)
--- a/src/test/locale/sort-test.pl
+++ b/src/test/locale/sort-test.pl
@@ -1,6 +1,7 @@
#! /usr/bin/perl
use strict;
+use warnings;
use locale;
open(my $in_fh, '<', $ARGV[0]) || die;
diff --git a/src/test/perl/SimpleTee.pm b/src/test/perl/SimpleTee.pm
index 9de7b1ac323a1484eabf3e29ac769fa03352eed4..74409bde6d7bed03f2d111641c55a8214641524e 100644 (file)
--- a/src/test/perl/SimpleTee.pm
+++ b/src/test/perl/SimpleTee.pm
@@ -9,6 +9,7 @@
package SimpleTee;
use strict;
+use warnings;
sub TIEHANDLE
{
diff --git a/src/tools/fix-old-flex-code.pl b/src/tools/fix-old-flex-code.pl
index 2954cf5a72662ca84d4967b6a5450613f5b82328..1bbb7cdb841631f4542fb1d0e22db9e30916cc2a 100644 (file)
--- a/src/tools/fix-old-flex-code.pl
+++ b/src/tools/fix-old-flex-code.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#----------------------------------------------------------------------
#
# fix-old-flex-code.pl
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
index 2e47f24783ff2203e5112af02a246ab1ad6d81e1..3c886fcd4991f37255c4123b2b64f83b95c0f307 100644 (file)
--- a/src/tools/msvc/build.pl
+++ b/src/tools/msvc/build.pl
@@ -3,6 +3,7 @@
# src/tools/msvc/build.pl
use strict;
+use warnings;
use File::Basename;
use File::Spec;
diff --git a/src/tools/msvc/pgbison.pl b/src/tools/msvc/pgbison.pl
index 490df833673b05ffe3a70f72e1630edece48e785..774d5be059582a159ce4783390ee3cb601a850d5 100644 (file)
--- a/src/tools/msvc/pgbison.pl
+++ b/src/tools/msvc/pgbison.pl
@@ -3,6 +3,8 @@
# src/tools/msvc/pgbison.pl
use strict;
+use warnings;
+
use File::Basename;
# assume we are in the postgres source root
diff --git a/src/tools/msvc/pgflex.pl b/src/tools/msvc/pgflex.pl
index aceed5ffd6c52efc437b4f5204f167fda15af1ef..26c73dbfade278b91f07a2178e2a5f33d6cbc9a6 100644 (file)
--- a/src/tools/msvc/pgflex.pl
+++ b/src/tools/msvc/pgflex.pl
@@ -3,6 +3,8 @@
# src/tools/msvc/pgflex.pl
use strict;
+use warnings;
+
use File::Basename;
# silence flex bleatings about file path style
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 82dca29a61669589841becf50f9b8c6f9783c652..c39178a93ca5bf97b093617ae8522455c5f1a414 100644 (file)
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -3,6 +3,7 @@
# src/tools/msvc/vcregress.pl
use strict;
+use warnings;
our $config;
diff --git a/src/tools/perlcheck/perlcriticrc b/src/tools/perlcheck/perlcriticrc
index bd848a9a6532ac0e72d125a434f019c29383d403..314c83c6a59a425b58aaceb7db300dbadf7e7065 100644 (file)
--- a/src/tools/perlcheck/perlcriticrc
+++ b/src/tools/perlcheck/perlcriticrc
@@ -19,6 +19,10 @@ verbose = %f: %m at line %l, column %c. %e. ([%p] Severity: %s)\n
# 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
diff --git a/src/tools/pginclude/pgcheckdefines b/src/tools/pginclude/pgcheckdefines
index 4edf7fc56e82109757d7c9bb4f98ae26aa5d81a1..0a760d6ecadf25938baafc1b704f61d55b153713 100755 (executable)
--- a/src/tools/pginclude/pgcheckdefines
+++ b/src/tools/pginclude/pgcheckdefines
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#
# This script looks for symbols that are referenced in #ifdef or defined()
@@ -21,6 +21,7 @@
#
use strict;
+use warnings;
use Cwd;
use File::Basename;
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index cb59ad234ab558e179efdb1d4d8de944aacce07d..fcd3f180487ca542c95a7c1767d5118c0aede62b 100755 (executable)
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl
#################################################################
# version_stamp.pl -- update version stamps throughout the source tree
@@ -21,6 +21,7 @@
#
use strict;
+use warnings;
# Major version is hard-wired into the script. We update it when we branch
# a new development version.
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /