[PATCH] compile warnings (was Re: Smoke 14756 /pro/3gl/CPAN/perl-current)

2002-02-25 Thread Nicholas Clark

On Fri, Feb 22, 2002 at 09:35:22AM +, Nick Ing-Simmons wrote:
 Jarkko Hietaniemi [EMAIL PROTECTED] writes:
 On Tue, Feb 19, 2002 at 02:31:11PM +, Nicholas Clark wrote:
  On Tue, Feb 19, 2002 at 02:22:24PM +0100, H.Merijn Brand wrote:
   U2235 is 879A and 81E6
   : : :
   : : : Lots of these (intended?)
 
 I think they are kind of intended, but I also think we could certainly
 live without them, too, they are kind of noisy.

I agree. I can't foresee that many people compiling the module are in
a position to do anything about the warnings.
Attached patch adds a -Q flag to compile to silence the warnings, and
makes Makefile.PL default to using this flag.
(I think that this is a reasonable way round, because it means anyone running
compile by hand gets the warnings, but anyone just building the module
doesn't)

Of course, I don't have an ulterior motive. On my 16M RAM system
before:
  808.51 real   344.32 user19.12 sys
after:
  411.80 real   285.01 user12.38 sys

[for touch compile; make test]

On a somewhat faster machine (colon.colondon.net) that goes from this:
   39.03 real35.29 user 2.13 sys
to this:
   36.87 real34.14 user 2.08 sys

(which is *still* 3.3% total CPU time saved for the whole make
 even on a fast machine with loadaRAM. If my figures are correct)

On Fri, Feb 22, 2002 at 09:34:18AM +, Nick Ing-Simmons wrote:
 Nicholas Clark [EMAIL PROTECTED] writes:
 On Tue, Feb 19, 2002 at 02:22:24PM +0100, H.Merijn Brand wrote:
  U2235 is 879A and 81E6
  : : :
  : : : Lots of these (intended?)
  : : :
  U9D70 is FC47 and EEE8
 
 IIRC from whay back there were problems with various encodings
 having code points which did not exist as distinct points in Unicode.
 Hence they would not round-trip. I believe modern Unicode added
 a slew of new points to fix this.

So does that mean if we obtain newer conversion tables, they will use those
code points, and the underlying cause of the warnings will be removed?

Nicholas Clark
-- 
EMCFT http://www.ccl4.org/~nick/CV.html

--- ext/Encode/compile.orig Fri Feb 22 19:11:30 2002
+++ ext/Encode/compile  Mon Feb 25 21:14:18 2002
@@ -118,23 +118,43 @@
 eval \@ARGV = map(glob(\$_),\@ARGV) if ($^O eq 'MSWin32');
 
 my %opt;
-getopts('qOo:f:n:',\%opt);
+# I think these are:
+# -Q to disable the duplicate codepoint test
+# -q to remove comments written to output files
+# -O to enable the (brute force) substring optimiser
+# -o output to specify the output file name (else it's the first arg)
+# -f inlist to give a file with a list of input files (else use the args)
+# -n name to name the encoding (else use the basename of the input file.
+getopts('QqOo:f:n:',\%opt);
+
+# This really should go first, else the die here causes empty (non-erroneous)
+# output files to be written.
+my @encfiles;
+if (exists $opt{'f'}) {
+# -F is followed by name of file containing list of filenames
+my $flist = $opt{'f'};
+open(FLIST,$flist) || die Cannot open $flist:$!;
+chomp(@encfiles = FLIST);
+close(FLIST);
+} else {
+@encfiles = @ARGV;
+}
+
 my $cname = (exists $opt{'o'}) ? $opt{'o'} : shift(@ARGV);
 chmod(0666,$cname) if -f $cname  !-w $cname;
 open(C,$cname) || die Cannot open $cname:$!;
 
-
 my $dname = $cname;
-$dname =~ s/(\.[^\.]*)?$/_def.h/;
+my $hname = $cname;
 
 my ($doC,$doEnc,$doUcm,$doPet);
 
 if ($cname =~ /\.(c|xs)$/)
  {
   $doC = 1;
+  $dname =~ s/(\.[^\.]*)?$/_def.h/;
   chmod(0666,$dname) if -f $cname  !-w $dname;
   open(D,$dname) || die Cannot open $dname:$!;
-  my $hname = $cname;
   $hname =~ s/(\.[^\.]*)?$/.h/;
   chmod(0666,$hname) if -f $cname  !-w $hname;
   open(H,$hname) || die Cannot open $hname:$!;
@@ -173,20 +193,6 @@
   $doPet = 1;
  }
 
-my @encfiles;
-if (exists $opt{'f'})
- {
-  # -F is followed by name of file containing list of filenames
-  my $flist = $opt{'f'};
-  open(FLIST,$flist) || die Cannot open $flist:$!;
-  chomp(@encfiles = FLIST);
-  close(FLIST);
- }
-else
- {
-  @encfiles = @ARGV;
- }
-
 my %encoding;
 my %strings;
 my $saved = 0;
@@ -288,8 +294,9 @@
 print C #include \$dname\\n;
 print C }\n;
}
-  close(D);
-  close(H);
+  # Close in void context is bad, m'kay
+  close(D) or warn Error closing '$dname': $!;
+  close(H) or warn Error closing '$hname': $!;
 
   my $perc_saved= $strings/($strings + $saved) * 100;
   my $perc_subsaved = $strings/($strings + $subsave) * 100;
@@ -316,9 +323,11 @@
}
  }
 
-close(C);
-
+# writing half meg files and then not checking to see if you just filled the
+# disk is bad, m'kay
+close(C) or die Error closing '$cname': $!;
 
+# End of the main program.
 
 sub compile_ucm
 {
@@ -432,7 +441,9 @@
   my $v = hex($def);
   $rep = $type_func($v  0xFF, ($v  8)  0xffe);
  }
- my %seen;
+ my $seen;
+ # use -Q to silence the seen test. Makefile.PL uses this by default.
+ $seen = {} unless $opt{Q};
  do
   {
my $line = $fh;
@@ -463,18 +474,21 @@
  $max_el = $el if $el  $max_el;
 

[PATCH Glossary configpm] cleanups

2002-02-25 Thread Rafael Garcia-Suarez

These are small fixes to configpm and to the Glossary, to
generate cleaner POD.


--- configpm.orig   Wed Feb 20 17:02:52 2002
+++ configpmMon Feb 25 23:11:12 2002
@@ -451,8 +451,14 @@
  (?! e \. g \. )   # Not e.g.
  (?! \. \. \. )# Not ...
  (?! \d )  # Not 5.004
- ( [\w./]* [./] [\w./]* )  # Require . or / inside
- (?! \. (?= \s ) )# Do not include trailing dot
+ (?! read/ )   # Not read/write
+ (?! etc\. )   # Not etc.
+ (?! I/O ) # Not I/O
+ (
+   \$ ?# Allow leading $
+   [\w./]* [./] [\w./]*# Require . or / inside
+ )
+ (?! \. (?= [\s)] ) ) # Do not include trailing dot
  (?! [\w/] )   # Include all of it
}
(F$1)xg;  # /usr/local
--- Porting/Glossary.orig   Wed Feb 20 17:07:56 2002
+++ Porting/GlossaryMon Feb 25 23:17:53 2002
@@ -1019,7 +1019,7 @@
 d_mkdir (d_mkdir.U):
This variable conditionally defines the HAS_MKDIR symbol, which
indicates to the C program that the mkdir() routine is available
-   to create directories..
+   to create directories.
 
 d_mkdtemp (d_mkdtemp.U):
This variable conditionally defines the HAS_MKDTEMP symbol, which
@@ -2546,8 +2546,8 @@
suitable for use in the PERL_INC_VERSION_LIST initialization.
 
 incpath (usrinc.U):
-   This variable must preceed the normal include path to get hte
-   right one, as in $incpath/usr/include or $incpath/usr/lib.
+   This variable must preceed the normal include path to get the
+   right one, as in $incpath/usr/include or $incpath/usr/lib.
Value can be  or /bsd43 on mips.
 
 inews (Loc.U):
@@ -2754,7 +2754,7 @@
This variable contains the libraries needed by large file builds
and added to ldflags by hints files.  It is a space separated list
of the library names without the lib prefix or any suffix, just
-   like libswanted..
+   like libswanted.
 
 line (Loc.U):
This variable is defined but not used by Configure.
@@ -3271,7 +3271,7 @@
This variable holds the return code from read() when no data is
present. It should be -1, but some systems return 0 when O_NDELAY is
used, which is a shame because you cannot make the difference between
-   no data and an EOF.. Sigh!
+   no data and an EOF. Sigh!
 
 revision (patchlevel.U):
The value of revision comes from the patchlevel.h file.



ithreads problems

2002-02-25 Thread Andy Bussey

Arthur,

Here's a quick look at the problems I'm having with ithreads on
bleadperl.  I hope this provides a useful starting point.

Summary:
- unlock doesn't work (threads::shared::unlock_enabled is
  undefined)
- if the 'parent' thread exits before one of its 'children',
  Perl seems very unhappy (aside: do we talk about parents
  and children in the world of ithreads?)

I've included:
- my test script, lock.t (no, it's not written like a proper
  Perl test script, but I'm sure that can be arranged).
  Supplying the cmd line arg 20 means that the parent thread
  will exit before the 2nd child on my system; supplying 30
  means the 2nd child exits first.
- output from this script
- perlbug5.7.2 -d output for my system

Andy

==
#!/opt/bleadperl/bin/perl5.7.2 -w

# lock.t

# A test of perl threads

$sleep_length = $ARGV[0]; # 20 causes a problem, 30 is OK

use Config;
use threads;
use threads::shared;

if($Config{'useithreads'}  $threads::threads) {
print \nWe've got threads...\n;
} else {
print \nWe've NOT got threads.\n;
exit;
}

our $lockv = 0;
share($lockv);

sub thrd {
my($me) = shift;
sleep $me;
print This is thread ${me}. lockv=$lockv\n;
sleep 5;
lock($lockv);
$lockv++;
print Thread $me has the lock! lockv=$lockv\n;
sleep 5;
print Thread $me has just slept for 5 sec since it got it's lock.\n;
$lockv++;
sleep 5;
print Thread $me has slept another 5 sec since it got it's lock.  .
lockv=$lockv\n;
# this causes a problem
unlock($lockv);
print Thread $me exiting.\n;
}

print \nMain thread. lockv=$lockv\n;

my $t1 = threads-create('thrd', '1');
# The 'detach's seem to make no difference
#$t1-detach();
my $t2 = threads-create('thrd', '2');
#$t2-detach();

print Main thread just started other threads. lockv=$lockv\n;

# if this is 20, then seg fault,
# if it is 30, then no seg fault
sleep $sleep_length;
print Main thread last's line. lockv=$lockv\n\n;

==

$ lock.t 20
v-string in use/require non-portable at 
/opt/bleadperl/lib/5.7.2/i686-linux-thread-multi/threads.pm line 3.
Unquoted string threads may clash with future reserved word at ./lock.t line 44.
Unquoted string threads may clash with future reserved word at ./lock.t line 47.

We've got threads...

Main thread. lockv=0
Died:Undefined subroutine threads::shared::unlock_enabled called at ./lock.t line 38.
Main thread just started other threads. lockv=0
This is thread 1. lockv=0
This is thread 2. lockv=0
Thread 1 has the lock! lockv=1
Thread 1 has just slept for 5 sec since it got it's lock.
Thread 1 has slept another 5 sec since it got it's lock. lockv=2
Unbalanced scopes: 3 more ENTERs than LEAVEs
Unbalanced saves: 8 more saves than restores
Unbalanced context: 2 more PUSHes than POPs
Segmentation fault


$ lock.t 30
v-string in use/require non-portable at 
/opt/bleadperl/lib/5.7.2/i686-linux-thread-multi/threads.pm line 3.
Unquoted string threads may clash with future reserved word at ./lock.t line 44.
Unquoted string threads may clash with future reserved word at ./lock.t line 47.

We've got threads...

Main thread. lockv=0
Died:Undefined subroutine threads::shared::unlock_enabled called at ./lock.t line 38.
Main thread just started other threads. lockv=0
This is thread 1. lockv=0
This is thread 2. lockv=0
Thread 1 has the lock! lockv=1
Thread 1 has just slept for 5 sec since it got it's lock.
Thread 1 has slept another 5 sec since it got it's lock. lockv=2
Died:Undefined subroutine threads::shared::unlock_enabled called at ./lock.t line 38.
Thread 2 has the lock! lockv=3
Thread 2 has just slept for 5 sec since it got it's lock.
Thread 2 has slept another 5 sec since it got it's lock. lockv=4
Main thread last's line. lockv=4

==

Site configuration information for perl v5.7.2:

Configured by andy at Mon Feb 25 20:38:45 GMT 2002.

Summary of my perl5 (revision 5.0 version 7 subversion 2 patch 14868) configuration:
  Platform:
osname=linux, osvers=2.4.2-2, archname=i686-linux-thread-multi
uname='linux localhost.localdomain 2.4.2-2 #1 sun apr 8 20:41:30 edt 2001 i686 
unknown '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='cc', ccflags ='-D_REENTRANT -fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2',
cppflags='-D_REENTRANT -fno-strict-aliasing -I/usr/include/gdbm'
ccversion='', gccversion='2.96 2731 (Red Hat Linux 7.1 2.96-81)', 
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8,