These two small patches allow us to run "perl -cw" cleanly on all our perl code.


One patch silences a warning from convutils.pl about the unportability of the literal 0x100000000. We've run for many years without this giving us a problem, so I think we can turn the warning off pretty safely.


The other patch provides a dummy library that emulates just enough of the Win32 perl infrastructure to allow us to run these checks. That means that Unix-based developers who might want to make changes in the msvc code can actually run a check against their code without having to put it on a Windows machine. The invocation goes like this (to check Mkvcbuild.pl for example):


   PERL5LIB=src/tools/msvc/dummylib perl -cw src/tools/Mkvcbuild.pm


This also allows us to check src/tools/win32tzlist.pl.


In due course I'll submit a script to automate this syntax checking.


cheers


andrew

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

diff --git a/src/tools/msvc/dummylib/README b/src/tools/msvc/dummylib/README
new file mode 100644
index 0000000..6e9617d
--- /dev/null
+++ b/src/tools/msvc/dummylib/README
@@ -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/msvs 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.
diff --git a/src/tools/msvc/dummylib/Win32.pm b/src/tools/msvc/dummylib/Win32.pm
new file mode 100644
index 0000000..7849937
--- /dev/null
+++ b/src/tools/msvc/dummylib/Win32.pm
@@ -0,0 +1,2 @@
+package Win32;
+1;
diff --git a/src/tools/msvc/dummylib/Win32/Registry.pm b/src/tools/msvc/dummylib/Win32/Registry.pm
new file mode 100644
index 0000000..13895c9
--- /dev/null
+++ b/src/tools/msvc/dummylib/Win32/Registry.pm
@@ -0,0 +1,10 @@
+package Win32::Registry;
+
+use vars qw($HKEY_LOCAL_MACHINE);
+
+use Exporter ();
+our (@EXPORT,@ISA);
+@ISA    = qw(Exporter);
+@EXPORT = qw($HKEY_LOCAL_MACHINE);
+
+1;
diff --git a/src/tools/msvc/dummylib/Win32API/File.pm b/src/tools/msvc/dummylib/Win32API/File.pm
new file mode 100644
index 0000000..d2f1453
--- /dev/null
+++ b/src/tools/msvc/dummylib/Win32API/File.pm
@@ -0,0 +1,11 @@
+package Win32API::File;
+
+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;
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm
index 69ec099..e57342c 100644
--- a/src/backend/utils/mb/Unicode/convutils.pm
+++ b/src/backend/utils/mb/Unicode/convutils.pm
@@ -254,6 +254,9 @@ sub print_radix_table
 	my %b4map;
 	foreach my $in (keys %$c)
 	{
+		# silence perl diagnostic about portability of 0x100000000
+		no warnings qw(portable);
+
 		my $out = $c->{$in};
 
 		if ($in < 0x100)

Reply via email to