Fix compile-time warnings on all perl code

This patch does two things. First, it silences a number of compile-time
warnings in the msvc tools files, mainly those due to the fact that in
some cases we have more than one package per file. Second it supplies a
dummy Perl library with just enough of the Windows API referred to in
our code to let it run these checks cleanly, even on Unix machines where
the code is never supposed to run. The dummy library should only be used
for that purpose, as its README notes.
This commit is contained in:
Andrew Dunstan 2018-05-31 08:13:02 -04:00
parent d3b10f0d64
commit 0039049fb1
9 changed files with 81 additions and 0 deletions

View File

@ -11,6 +11,8 @@ use strict;
use warnings;
use base qw(Project);
no warnings qw(redefine); ## no critic
sub _new
{
my $classname = shift;
@ -399,6 +401,8 @@ use strict;
use warnings;
use base qw(MSBuildProject);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -420,6 +424,8 @@ use strict;
use warnings;
use base qw(MSBuildProject);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -464,6 +470,8 @@ use strict;
use warnings;
use base qw(VC2012Project);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -487,6 +495,8 @@ use strict;
use warnings;
use base qw(VC2012Project);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -510,6 +520,8 @@ use strict;
use warnings;
use base qw(VC2012Project);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;

View File

@ -229,6 +229,7 @@ sub AddDir
if ($filter eq "LIBOBJS")
{
no warnings qw(once);
if (grep(/$p/, @main::pgportfiles, @main::pgcommonfiles)
== 1)
{

View File

@ -10,6 +10,8 @@ use strict;
use warnings;
use VSObjectFactory;
no warnings qw(redefine); ## no critic
sub _new
{
my $classname = shift;
@ -768,6 +770,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -791,6 +795,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -815,6 +821,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -839,6 +847,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -863,6 +873,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -889,6 +901,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -915,6 +929,8 @@ use strict;
use warnings;
use base qw(Solution);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;

View File

@ -11,6 +11,8 @@ use strict;
use warnings;
use base qw(Project);
no warnings qw(redefine); ## no critic
sub _new
{
my $classname = shift;
@ -268,6 +270,8 @@ use strict;
use warnings;
use base qw(VCBuildProject);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;
@ -289,6 +293,8 @@ use strict;
use warnings;
use base qw(VCBuildProject);
no warnings qw(redefine); ## no critic
sub new
{
my $classname = shift;

View File

@ -20,6 +20,8 @@ our (@ISA, @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(CreateSolution CreateProject DetermineVisualStudioVersion);
no warnings qw(redefine); ## no critic
sub CreateSolution
{
my $visualStudioVersion = shift;

View File

@ -0,0 +1,13 @@
src/tools/msvc/dummylib
This directory contains just enough of a dummy library to allow checking of
the programs in src/tools/msvc and src/tools/win32tzlist.pl with
perl -cw, even on machines that lack the Win32 perl infrastructure.
invoke via:
PERL5LIB=src/tools/msvc/dummylib perl -cw $file
This is the only use that should be made of this directory. Attempting actually
running of any programs using this library will result in a lot of grief.

View File

@ -0,0 +1,4 @@
package Win32;
use strict;
use warnings;
1;

View File

@ -0,0 +1,13 @@
package Win32::Registry;
use strict;
use warnings;
use vars qw($HKEY_LOCAL_MACHINE);
use Exporter ();
our (@EXPORT,@ISA);
@ISA = qw(Exporter);
@EXPORT = qw($HKEY_LOCAL_MACHINE);
1;

View File

@ -0,0 +1,14 @@
package Win32API::File;
use strict;
use warnings;
use constant { SEM_FAILCRITICALERRORS => 1, SEM_NOGPFAULTERRORBOX => 2 };
sub SetErrormode {};
use Exporter;
our(@ISA,@EXPORT_OK,%EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT_OK = qw(SetErrorMode SEM_FAILCRITICALERRORS SEM_NOGPFAULTERRORBOX);
%EXPORT_TAGS = (SEM_ => [qw(SEM_FAILCRITICALERRORS SEM_NOGPFAULTERRORBOX)]);
1;