Commit 0039049f authored by Andrew Dunstan's avatar Andrew Dunstan

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.
parent d3b10f0d
......@@ -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;
......
......@@ -229,6 +229,7 @@ sub AddDir
if ($filter eq "LIBOBJS")
{
no warnings qw(once);
if (grep(/$p/, @main::pgportfiles, @main::pgcommonfiles)
== 1)
{
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
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.
package Win32;
use strict;
use warnings;
1;
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;
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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment