Thread: pgsql: Use perl warnings pragma consistently

pgsql: Use perl warnings pragma consistently

From
Andrew Dunstan
Date:
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7be5d8df1f74b78620167d3abf32ee607e728919

Modified Files
--------------
contrib/intarray/bench/bench.pl                       | 1 +
contrib/intarray/bench/create_test.pl                 | 2 ++
contrib/seg/seg-validate.pl                           | 1 +
contrib/seg/sort-segments.pl                          | 1 +
doc/src/sgml/mk_feature_tables.pl                     | 3 ++-
src/backend/catalog/genbki.pl                         | 2 +-
src/backend/utils/Gen_fmgrtab.pl                      | 2 +-
src/backend/utils/mb/Unicode/UCS_to_BIG5.pl           | 2 ++
src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl         | 2 ++
src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl   | 2 ++
src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl         | 2 ++
src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl         | 2 ++
src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl         | 2 ++
src/backend/utils/mb/Unicode/UCS_to_GB18030.pl        | 2 ++
src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl          | 2 ++
src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl | 2 ++
src/backend/utils/mb/Unicode/UCS_to_SJIS.pl           | 2 ++
src/backend/utils/mb/Unicode/UCS_to_UHC.pl            | 2 ++
src/backend/utils/mb/Unicode/UCS_to_most.pl           | 2 ++
src/backend/utils/mb/Unicode/convutils.pm             | 1 +
src/backend/utils/sort/gen_qsort_tuple.pl             | 3 ++-
src/bin/psql/create_help.pl                           | 3 ++-
src/interfaces/libpq/test/regress.pl                  | 3 ++-
src/pl/plperl/plc_perlboot.pl                         | 1 +
src/pl/plperl/plperl_opmask.pl                        | 2 +-
src/test/locale/sort-test.pl                          | 1 +
src/test/perl/SimpleTee.pm                            | 1 +
src/tools/fix-old-flex-code.pl                        | 2 +-
src/tools/msvc/build.pl                               | 1 +
src/tools/msvc/pgbison.pl                             | 2 ++
src/tools/msvc/pgflex.pl                              | 2 ++
src/tools/msvc/vcregress.pl                           | 1 +
src/tools/perlcheck/perlcriticrc                      | 4 ++++
src/tools/pginclude/pgcheckdefines                    | 3 ++-
src/tools/version_stamp.pl                            | 3 ++-
35 files changed, 59 insertions(+), 10 deletions(-)


Re: pgsql: Use perl warnings pragma consistently

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> Use perl warnings pragma consistently

This seems to have broken something or other, as I now get a bunch of
warnings while building the docs:

...
Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 522. 
Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 524. 
Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 526. 
Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 528. 
Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 529. 
...

            regards, tom lane



Re: pgsql: Use perl warnings pragma consistently

From
Alvaro Herrera
Date:
On 2020-Apr-13, Tom Lane wrote:

> Andrew Dunstan <andrew@dunslane.net> writes:
> > Use perl warnings pragma consistently
> 
> This seems to have broken something or other, as I now get a bunch of
> warnings while building the docs:
> 
> ...
> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 522.
 
> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 524.
 
> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 526.
 
> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 528.
 
> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line 57,
<$feat>line 529.
 

This should fix it.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

Re: pgsql: Use perl warnings pragma consistently

From
Andrew Dunstan
Date:
On 4/13/20 5:49 PM, Alvaro Herrera wrote:
> On 2020-Apr-13, Tom Lane wrote:
>
>> Andrew Dunstan <andrew@dunslane.net> writes:
>>> Use perl warnings pragma consistently
>> This seems to have broken something or other, as I now get a bunch of
>> warnings while building the docs:
>>
>> ...
>> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line
57,<$feat> line 522.
 
>> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line
57,<$feat> line 524.
 
>> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line
57,<$feat> line 526.
 
>> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line
57,<$feat> line 528.
 
>> Use of uninitialized value within %feature_packages in concatenation (.) or string at ./mk_feature_tables.pl line
57,<$feat> line 529.
 



Oops. Well, I guess that's why warnings are a good idea :-)


> This should fix it.
>

Right.


cheers


andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services