From: Marcus Holland-Moritz Date: Sun, 12 Aug 2007 23:17:42 +0000 (+0000) Subject: Upgrade to Devel::PPPort 3.11_02 X-Git-Tag: accepted/trunk/20130322.191538~14777 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=679ad62ddea1877bd96eafca271767acf6241fd7;p=platform%2Fupstream%2Fperl.git Upgrade to Devel::PPPort 3.11_02 p4raw-id: //depot/perl@31705 --- diff --git a/MANIFEST b/MANIFEST index 06d4cb3..129294f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -287,6 +287,7 @@ ext/Devel/PPPort/parts/inc/uv Devel::PPPort include ext/Devel/PPPort/parts/inc/variables Devel::PPPort include ext/Devel/PPPort/parts/inc/version Devel::PPPort include ext/Devel/PPPort/parts/inc/warn Devel::PPPort include +ext/Devel/PPPort/parts/ppport.fnc Devel::PPPort API listing ext/Devel/PPPort/parts/ppptools.pl Devel::PPPort various utilities ext/Devel/PPPort/parts/todo/5004000 Devel::PPPort todo file ext/Devel/PPPort/parts/todo/5004010 Devel::PPPort todo file diff --git a/ext/Devel/PPPort/Changes b/ext/Devel/PPPort/Changes index 0a7b8ba..222774c 100755 --- a/ext/Devel/PPPort/Changes +++ b/ext/Devel/PPPort/Changes @@ -1,3 +1,49 @@ +3.11_02 - 2007-08-13 + + * fix cpan #25372: special case sv_magic(sv, obj, how, name, 0) + * fix cpan #27906: [PATCH] add UTF8_MAXBYTES + (thanks to Steve Peters for providing a patch) + * added support for the following API + sv_2pv_flags + sv_2pvbyte_nolen + SV_CONST_RETURN + SV_COW_DROP_PV + SV_COW_SHARED_HASH_KEYS + SV_GMAGIC + SV_HAS_TRAILING_NUL + SV_IMMEDIATE_UNREF + sv_magic_portable + SV_MUTABLE_RETURN + SV_NOSTEAL + sv_pvn_force_flags + SV_SMAGIC + SV_UTF8_NO_ENCODING + SvPV_const + SvPV_flags + SvPV_flags_const + SvPV_flags_const_nolen + SvPV_flags_mutable + SvPV_force + SvPV_force_flags + SvPV_force_flags_mutable + SvPV_force_flags_nolen + SvPV_force_mutable + SvPV_force_nolen + SvPV_force_nomg_nolen + SvPV_mutable + SvPV_nolen_const + SvPV_nomg_const + SvPV_nomg_const_nolen + SvUOK + UTF8_MAXBYTES + * provide compatibility macros for vanished variables + PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters + * add warnings support to ppport.h + * update ppport.h file searching logic + * add -c.inc and -xs.inc to the list of supported extensions + * document that --copy doesn't include the dot + * improve soak script and devel/buildperl.pl + 3.11_01 - 2007-03-23 * added support for the following API diff --git a/ext/Devel/PPPort/HACKERS b/ext/Devel/PPPort/HACKERS index f68101c..4590809 100644 --- a/ext/Devel/PPPort/HACKERS +++ b/ext/Devel/PPPort/HACKERS @@ -45,9 +45,11 @@ and linked with C. This C file has the purpose of using each of the public API functions/macros once. The required information is derived from C (just -a copy of bleadperl's C) and C (which +a copy of bleadperl's C), C (which is generated by F and simply collects the rest -of the apidoc entries spread over the Perl source code). +of the apidoc entries spread over the Perl source code) and +C (which lists all API provided purely by +Devel::PPPort). The generated C file C is currently about 500k in size and takes quite a while to compile. diff --git a/ext/Devel/PPPort/PPPort_pm.PL b/ext/Devel/PPPort/PPPort_pm.PL index 77356ad..0712ab1 100644 --- a/ext/Devel/PPPort/PPPort_pm.PL +++ b/ext/Devel/PPPort/PPPort_pm.PL @@ -4,9 +4,9 @@ # ################################################################################ # -# $Revision: 52 $ +# $Revision: 54 $ # $Author: mhx $ -# $Date: 2007/03/23 16:27:19 +0100 $ +# $Date: 2007/08/13 00:03:11 +0200 $ # ################################################################################ # @@ -27,7 +27,7 @@ my $INCLUDE = 'parts/inc'; my $DPPP = 'DPPP_'; my %embed = map { ( $_->{name} => $_ ) } - parse_embed(qw(parts/embed.fnc parts/apidoc.fnc)); + parse_embed(qw(parts/embed.fnc parts/apidoc.fnc parts/ppport.fnc)); my(%provides, %prototypes, %explicit); @@ -125,7 +125,7 @@ $data =~ s{^__UNSUPPORTED_API__(\s*?)^} {join "\n", @todo}gem; $data =~ s{__MIN_PERL__}{5.003}g; -$data =~ s{__MAX_PERL__}{5.9.4}g; +$data =~ s{__MAX_PERL__}{5.9.5}g; open FH, ">PPPort.pm" or die "PPPort.pm: $!\n"; print FH $data; @@ -344,9 +344,9 @@ __DATA__ # ################################################################################ # -# $Revision: 52 $ +# $Revision: 54 $ # $Author: mhx $ -# $Date: 2007/03/23 16:27:19 +0100 $ +# $Date: 2007/08/13 00:03:11 +0200 $ # ################################################################################ # @@ -507,7 +507,7 @@ package Devel::PPPort; use strict; use vars qw($VERSION $data); -$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; +$VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11_02 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; sub _init_data { diff --git a/ext/Devel/PPPort/TODO b/ext/Devel/PPPort/TODO index 336e942..ce07d8a 100644 --- a/ext/Devel/PPPort/TODO +++ b/ext/Devel/PPPort/TODO @@ -1,5 +1,33 @@ TODO: +* > 3. In several cases, "perl ppport.h --copy=.new" output a new file in + > which the only change was the addition of "#include "ppport.h"". In each + > case, that actually wasn't necessary because the source file in question + > already #included another source file which #included ppport.h itself. + > Would it be possible for the analyzer to follow #include directives to + > spot cases like this? + + Uh, well, I guess it would be possible. But I have some concerns: + + 1. ppport.h is already too big. :-) + + 2. There is code in ppport.h to actually remove an + + #include "ppport.h" + + if it appears not to be needed. If it's not needed in your + included file, it might be dropped from there and moved to + the other file that included the first one. This would make + the logic much more complicated. + + 3. As ppport.h is configurable, it's not (always) a good idea + to put it into a file that's included from another file. + + I guess I'll have to think about this a little more. Maybe I can + come up with a fancy solution that doesn't increase the code size + too much. + + * On 14/12/06, Nicholas Clark wrote: > On Thu, Dec 14, 2006 at 05:03:24AM +0100, Andreas J. Koenig wrote: > @@ -14,6 +42,8 @@ TODO: 2. anyway, if we remove it from the core, it might appear in Devel::PPPort :) +* maybe backport bytes_from_utf8() for 5.6.0 (or even before)? + * check which of the following we need to support: amagic_generation diff --git a/ext/Devel/PPPort/devel/buildperl.pl b/ext/Devel/PPPort/devel/buildperl.pl index 64a9541..a85ad4f 100644 --- a/ext/Devel/PPPort/devel/buildperl.pl +++ b/ext/Devel/PPPort/devel/buildperl.pl @@ -5,13 +5,13 @@ # ################################################################################ # -# $Revision: 10 $ +# $Revision: 12 $ # $Author: mhx $ -# $Date: 2006/12/02 09:58:34 +0100 $ +# $Date: 2007/08/12 15:06:31 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # @@ -32,6 +32,12 @@ use Cwd; # TODO: - extra arguments to Configure +# +# --test-archives=1 check if archives can be read +# --test-archives=2 like 1, but also extract archives +# --test-archives=3 like 2, but also apply patches +# + my %opt = ( prefix => '/tmp/perl/install//', build => '/tmp/perl/build/', @@ -92,12 +98,39 @@ my @patch = ( }, { perl => [ - qr/^5\.004_0[1234]/, + qr/^5\.004_0[1234]$/, ], subs => [ [ \&patch_doio ], ], }, + { + perl => [ + qw/ + 5.005 + 5.005_01 + 5.005_02 + /, + ], + subs => [ + [ \&patch_sysv, old_format => 1 ], + ], + }, + { + perl => [ + qw/ + 5.005_03 + 5.005_04 + /, + qr/^5\.6\.[0-2]$/, + qr/^5\.7\.[0-3]$/, + qr/^5\.8\.[0-8]$/, + qr/^5\.9\.[0-5]$/ + ], + subs => [ + [ \&patch_sysv ], + ], + }, ); my(%perl, @perls); @@ -111,7 +144,7 @@ GetOptions(\%opt, qw( force test install! - test-archives+ + test-archives=i )) or pod2usage(2); if (exists $opt{config}) { @@ -149,6 +182,12 @@ if ($opt{'test-archives'}) { for my $perl (@perls) { eval { my $d = extract_source($perl{$perl}); + if ($opt{'test-archives'} > 2) { + my $cwd2 = cwd; + chdir $d or die "chdir $d: $!\n"; + patch_source($perl{$perl}{version}); + chdir $cwd2 or die "chdir $cwd2:$!\n" + } rmtree($d) if -e $d; }; warn $@ if $@; @@ -296,13 +335,13 @@ sub build_and_install sub patch_db { my $ver = shift; - print "patching DB_File\n"; + print "patching ext/DB_File/DB_File.xs\n"; run_or_die("sed -i -e 's///' ext/DB_File/DB_File.xs"); } sub patch_doio { - patch('doio.c', <<'END'); + patch(<<'END'); --- doio.c.org 2004-06-07 23:14:45.000000000 +0200 +++ doio.c 2003-11-04 08:03:03.000000000 +0100 @@ -75,6 +75,16 @@ @@ -325,11 +364,52 @@ sub patch_doio END } +sub patch_sysv +{ + my %opt = @_; + + # check if patching is required + return if $^O ne 'linux' or -f '/usr/include/asm/page.h'; + + if ($opt{old_format}) { + patch(<<'END'); +--- ext/IPC/SysV/SysV.xs.org 1998-07-20 10:20:07.000000000 +0200 ++++ ext/IPC/SysV/SysV.xs 2007-08-12 10:51:06.000000000 +0200 +@@ -3,9 +3,6 @@ + #include "XSUB.h" + + #include +-#ifdef __linux__ +-#include +-#endif + #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) + #include + #ifdef HAS_MSG +END + } + else { + patch(<<'END'); +--- ext/IPC/SysV/SysV.xs.org 2007-08-11 00:12:46.000000000 +0200 ++++ ext/IPC/SysV/SysV.xs 2007-08-11 00:10:51.000000000 +0200 +@@ -3,9 +3,6 @@ + #include "XSUB.h" + + #include +-#ifdef __linux__ +-# include +-#endif + #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) + #ifndef HAS_SEM + # include +END + } +} + sub patch { - my($file, $patch) = @_; - print "patching $file\n"; - my $diff = "$file.diff"; + my($patch) = @_; + print "patching $_\n" for $patch =~ /^\+{3}\s+(\S+)/gm; + my $diff = 'tmp.diff'; write_or_die($diff, $patch); run_or_die("patch -s -p0 <$diff"); unlink $diff or die "unlink $diff: $!\n"; @@ -418,7 +498,7 @@ and don't install them, run: =head1 COPYRIGHT -Copyright (c) 2004-2006, Marcus Holland-Moritz. +Copyright (c) 2004-2007, Marcus Holland-Moritz. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/ext/Devel/PPPort/devel/devtools.pl b/ext/Devel/PPPort/devel/devtools.pl index 076fa6f..7574136 100644 --- a/ext/Devel/PPPort/devel/devtools.pl +++ b/ext/Devel/PPPort/devel/devtools.pl @@ -4,13 +4,13 @@ # ################################################################################ # -# $Revision: 2 $ +# $Revision: 3 $ # $Author: mhx $ -# $Date: 2006/05/28 19:33:35 +0200 $ +# $Date: 2007/08/12 08:45:38 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # diff --git a/ext/Devel/PPPort/devel/mkapidoc.sh b/ext/Devel/PPPort/devel/mkapidoc.sh index 356ff51..ea53d0b 100644 --- a/ext/Devel/PPPort/devel/mkapidoc.sh +++ b/ext/Devel/PPPort/devel/mkapidoc.sh @@ -5,13 +5,13 @@ # ################################################################################ # -# $Revision: 8 $ +# $Revision: 10 $ # $Author: mhx $ -# $Date: 2006/01/14 22:41:14 +0100 $ +# $Date: 2007/08/12 11:50:36 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # @@ -62,9 +62,26 @@ else fi if isperlroot $PERLROOT; then + cat >$OUTPUT < file that came with this distribution. +: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +: +: This file lists all API functions/macros that are documented in the Perl +: source code, but are not contained in F. +: + +EOF grep -hr '^=for apidoc' $PERLROOT | sed -e 's/=for apidoc //' | grep '|' | sort | uniq \ | perl -e'$f=pop;open(F,$f)||die"$f:$!";while(){(split/\|/)[2]=~/(\w+)/;$h{$1}++} - while(<>){s/[ \t]+$//;(split/\|/)[2]=~/(\w+)/;$h{$1}||print}' $EMBED >$OUTPUT + while(<>){s/[ \t]+$//;(split/\|/)[2]=~/(\w+)/;$h{$1}||print}' $EMBED >>$OUTPUT else usage fi diff --git a/ext/Devel/PPPort/devel/mktodo b/ext/Devel/PPPort/devel/mktodo index 4dda017..1ba7065 100644 --- a/ext/Devel/PPPort/devel/mktodo +++ b/ext/Devel/PPPort/devel/mktodo @@ -5,13 +5,13 @@ # ################################################################################ # -# $Revision: 13 $ +# $Revision: 14 $ # $Author: mhx $ -# $Date: 2006/05/28 19:36:03 +0200 $ +# $Date: 2007/08/12 08:45:40 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # diff --git a/ext/Devel/PPPort/devel/mktodo.pl b/ext/Devel/PPPort/devel/mktodo.pl index 326923d..773badc 100644 --- a/ext/Devel/PPPort/devel/mktodo.pl +++ b/ext/Devel/PPPort/devel/mktodo.pl @@ -5,13 +5,13 @@ # ################################################################################ # -# $Revision: 13 $ +# $Revision: 14 $ # $Author: mhx $ -# $Date: 2006/05/28 19:39:10 +0200 $ +# $Date: 2007/08/12 08:45:39 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # diff --git a/ext/Devel/PPPort/devel/regenerate b/ext/Devel/PPPort/devel/regenerate index bdbda8b..4a40d84 100644 --- a/ext/Devel/PPPort/devel/regenerate +++ b/ext/Devel/PPPort/devel/regenerate @@ -5,13 +5,13 @@ # ################################################################################ # -# $Revision: 5 $ +# $Revision: 6 $ # $Author: mhx $ -# $Date: 2006/05/28 20:43:04 +0200 $ +# $Date: 2007/08/12 08:45:39 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # @@ -148,7 +148,7 @@ regenerate - Automatically regeneate Devel::PPPort's API information =head1 COPYRIGHT -Copyright (c) 2006, Marcus Holland-Moritz. +Copyright (c) 2006-2007, Marcus Holland-Moritz. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/ext/Devel/PPPort/devel/scanprov b/ext/Devel/PPPort/devel/scanprov index fb5bc79..66f207c 100644 --- a/ext/Devel/PPPort/devel/scanprov +++ b/ext/Devel/PPPort/devel/scanprov @@ -5,13 +5,13 @@ # ################################################################################ # -# $Revision: 6 $ +# $Revision: 7 $ # $Author: mhx $ -# $Date: 2006/01/14 22:41:14 +0100 $ +# $Date: 2007/08/12 08:45:15 +0200 $ # ################################################################################ # -# Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz. +# Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. # Version 2.x, Copyright (C) 2001, Paul Marquess. # Version 1.x, Copyright (C) 1999, Kenneth Albanowski. # @@ -27,7 +27,7 @@ die "Usage: $0 [check|write]\n" unless @ARGV && $ARGV[0] =~ /^(check|write)$/; my $mode = $1; my %embed = map { ( $_->{name} => 1 ) } - parse_embed(qw(parts/embed.fnc parts/apidoc.fnc)); + parse_embed(qw(parts/embed.fnc parts/apidoc.fnc parts/ppport.fnc )); my @provided = grep { !exists $embed{$_} } map { /^(\w+)/ ? $1 : () } diff --git a/ext/Devel/PPPort/parts/apicheck.pl b/ext/Devel/PPPort/parts/apicheck.pl index 215e568..41ac35a 100644 --- a/ext/Devel/PPPort/parts/apicheck.pl +++ b/ext/Devel/PPPort/parts/apicheck.pl @@ -5,9 +5,9 @@ # ################################################################################ # -# $Revision: 22 $ +# $Revision: 25 $ # $Author: mhx $ -# $Date: 2007/01/02 12:32:28 +0100 $ +# $Date: 2007/08/12 23:23:40 +0200 $ # ################################################################################ # @@ -31,7 +31,7 @@ else { *OUT = \*STDOUT; } -my @f = parse_embed(qw( parts/embed.fnc parts/apidoc.fnc )); +my @f = parse_embed(qw( parts/embed.fnc parts/apidoc.fnc parts/ppport.fnc )); my %todo = %{&parse_todo}; @@ -141,23 +141,27 @@ print OUT < 2 +IV +SvPV_const(sv) + SV *sv + PREINIT: + const char *str; + STRLEN len; + CODE: + str = SvPV_const(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 40 : 0); + OUTPUT: + RETVAL + +IV +SvPV_mutable(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_mutable(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 41 : 0); + OUTPUT: + RETVAL + +IV +SvPV_flags(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_flags(sv, len, SV_GMAGIC); + RETVAL = len + (strEQ(str, "mhx") ? 42 : 0); + OUTPUT: + RETVAL + +IV +SvPV_flags_const(sv) + SV *sv + PREINIT: + const char *str; + STRLEN len; + CODE: + str = SvPV_flags_const(sv, len, SV_GMAGIC); + RETVAL = len + (strEQ(str, "mhx") ? 43 : 0); + OUTPUT: + RETVAL + +IV +SvPV_flags_const_nolen(sv) + SV *sv + PREINIT: + const char *str; + CODE: + str = SvPV_flags_const_nolen(sv, SV_GMAGIC); + RETVAL = strEQ(str, "mhx") ? 47 : 0; + OUTPUT: + RETVAL + +IV +SvPV_flags_mutable(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_flags_mutable(sv, len, SV_GMAGIC); + RETVAL = len + (strEQ(str, "mhx") ? 45 : 0); + OUTPUT: + RETVAL + +IV +SvPV_force(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_force(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 46 : 0); + OUTPUT: + RETVAL + +IV +SvPV_force_nolen(sv) + SV *sv + PREINIT: + char *str; + CODE: + str = SvPV_force_nolen(sv); + RETVAL = strEQ(str, "mhx") ? 50 : 0; + OUTPUT: + RETVAL + +IV +SvPV_force_mutable(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_force_mutable(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 48 : 0); + OUTPUT: + RETVAL + +IV +SvPV_force_nomg(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_force_nomg(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 49 : 0); + OUTPUT: + RETVAL + +IV +SvPV_force_nomg_nolen(sv) + SV *sv + PREINIT: + char *str; + CODE: + str = SvPV_force_nomg_nolen(sv); + RETVAL = strEQ(str, "mhx") ? 53 : 0; + OUTPUT: + RETVAL + +IV +SvPV_force_flags(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_force_flags(sv, len, SV_GMAGIC); + RETVAL = len + (strEQ(str, "mhx") ? 51 : 0); + OUTPUT: + RETVAL + +IV +SvPV_force_flags_nolen(sv) + SV *sv + PREINIT: + char *str; + CODE: + str = SvPV_force_flags_nolen(sv, SV_GMAGIC); + RETVAL = strEQ(str, "mhx") ? 55 : 0; + OUTPUT: + RETVAL + +IV +SvPV_force_flags_mutable(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_force_flags_mutable(sv, len, SV_GMAGIC); + RETVAL = len + (strEQ(str, "mhx") ? 53 : 0); + OUTPUT: + RETVAL + +IV +SvPV_nolen_const(sv) + SV *sv + PREINIT: + const char *str; + CODE: + str = SvPV_nolen_const(sv); + RETVAL = strEQ(str, "mhx") ? 57 : 0; + OUTPUT: + RETVAL + +IV +SvPV_nomg(sv) + SV *sv + PREINIT: + char *str; + STRLEN len; + CODE: + str = SvPV_nomg(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 55 : 0); + OUTPUT: + RETVAL + +IV +SvPV_nomg_const(sv) + SV *sv + PREINIT: + const char *str; + STRLEN len; + CODE: + str = SvPV_nomg_const(sv, len); + RETVAL = len + (strEQ(str, "mhx") ? 56 : 0); + OUTPUT: + RETVAL + +IV +SvPV_nomg_const_nolen(sv) + SV *sv + PREINIT: + const char *str; + CODE: + str = SvPV_nomg_const_nolen(sv); + RETVAL = strEQ(str, "mhx") ? 60 : 0; + OUTPUT: + RETVAL + + +=tests plan => 20 + +my $mhx = "mhx"; + +ok(&Devel::PPPort::SvPVbyte($mhx), 3); + +my $i = 42; + +ok(&Devel::PPPort::SvPV_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_const($mhx), $i++); +ok(&Devel::PPPort::SvPV_mutable($mhx), $i++); +ok(&Devel::PPPort::SvPV_flags($mhx), $i++); +ok(&Devel::PPPort::SvPV_flags_const($mhx), $i++); + +ok(&Devel::PPPort::SvPV_flags_const_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_flags_mutable($mhx), $i++); +ok(&Devel::PPPort::SvPV_force($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_mutable($mhx), $i++); + +ok(&Devel::PPPort::SvPV_force_nomg($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_nomg_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_flags($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_flags_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_flags_mutable($mhx), $i++); -ok(&Devel::PPPort::SvPVbyte("mhx"), 3); -ok(&Devel::PPPort::SvPV_nolen("mhx"), 42); +ok(&Devel::PPPort::SvPV_nolen_const($mhx), $i++); +ok(&Devel::PPPort::SvPV_nomg($mhx), $i++); +ok(&Devel::PPPort::SvPV_nomg_const($mhx), $i++); +ok(&Devel::PPPort::SvPV_nomg_const_nolen($mhx), $i++); diff --git a/ext/Devel/PPPort/parts/inc/call b/ext/Devel/PPPort/parts/inc/call index 0b19ae4..daba216 100644 --- a/ext/Devel/PPPort/parts/inc/call +++ b/ext/Devel/PPPort/parts/inc/call @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 12 $ +## $Revision: 14 $ ## $Author: mhx $ -## $Date: 2007/03/23 17:57:58 +0100 $ +## $Date: 2007/08/12 23:57:09 +0200 $ ## ################################################################################ ## @@ -43,7 +43,6 @@ __UNDEFINED__ PERL_LOADMOD_IMPORT_OPS 0x4 /* Replace: 0 */ /* Replace perl_eval_pv with eval_pv */ -/* eval_pv depends on eval_sv */ #ifndef eval_pv #if { NEED eval_pv } @@ -130,8 +129,6 @@ vload_module(U32 flags, SV *name, SV *ver, va_list *args) #endif #endif -/* load_module depends on vload_module */ - #ifndef load_module #if { NEED load_module } @@ -276,9 +273,8 @@ load_module(flags, name, version, ...) CODE: /* Both SV parameters are donated to the ops built inside load_module, so we need to bump the refcounts. */ - SvREFCNT_inc(name); - SvREFCNT_inc(version); - Perl_load_module(aTHX_ flags, name, version, NULL); + Perl_load_module(aTHX_ flags, SvREFCNT_inc_simple(name), + SvREFCNT_inc_simple(version), NULL); =tests plan => 46 diff --git a/ext/Devel/PPPort/parts/inc/grok b/ext/Devel/PPPort/parts/inc/grok index 33fb14de..dce2467 100644 --- a/ext/Devel/PPPort/parts/inc/grok +++ b/ext/Devel/PPPort/parts/inc/grok @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 11 $ +## $Revision: 13 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:34 +0100 $ +## $Date: 2007/08/12 23:57:10 +0200 $ ## ################################################################################ ## @@ -38,7 +38,6 @@ __UNDEFINED__ IS_NUMBER_NEG 0x08 __UNDEFINED__ IS_NUMBER_INFINITY 0x10 __UNDEFINED__ IS_NUMBER_NAN 0x20 -/* GROK_NUMERIC_RADIX depends on grok_numeric_radix */ __UNDEFINED__ GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) __UNDEFINED__ PERL_SCAN_GREATER_THAN_UV_MAX 0x02 @@ -89,8 +88,6 @@ grok_numeric_radix(pTHX_ const char **sp, const char *send) #endif #endif -/* grok_number depends on grok_numeric_radix */ - #ifndef grok_number #if { NEED grok_number } int diff --git a/ext/Devel/PPPort/parts/inc/magic b/ext/Devel/PPPort/parts/inc/magic index dff0a48..b6358cb 100644 --- a/ext/Devel/PPPort/parts/inc/magic +++ b/ext/Devel/PPPort/parts/inc/magic @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 11 $ +## $Revision: 13 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:34 +0100 $ +## $Date: 2007/08/12 23:24:34 +0200 $ ## ################################################################################ ## @@ -19,6 +19,7 @@ __UNDEFINED__ /sv_\w+_mg/ +sv_magic_portable =implementation @@ -65,8 +66,6 @@ __UNDEFINED__ PERL_MAGIC_backref '<' __UNDEFINED__ PERL_MAGIC_ext '~' /* That's the best we can do... */ -__UNDEFINED__ SvPV_force_nomg SvPV_force -__UNDEFINED__ SvPV_nomg SvPV __UNDEFINED__ sv_catpvn_nomg sv_catpvn __UNDEFINED__ sv_catsv_nomg sv_catsv __UNDEFINED__ sv_setsv_nomg sv_setsv @@ -166,6 +165,44 @@ __UNDEFINED__ SvUV_nomg SvUV __UNDEFINED__ SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) +/* Hint: sv_magic_portable + * This is a compatibility function that is only available with + * Devel::PPPort. It is NOT in the perl core. + * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when + * it is being passed a name pointer with namlen == 0. In that + * case, perl 5.8.0 and later store the pointer, not a copy of it. + * The compatibility can be provided back to perl 5.004. With + * earlier versions, the code will not compile. + */ + +#if { VERSION < 5.004 } + + /* code that uses sv_magic_portable will not compile */ + +#elif { VERSION < 5.8.0 } + +# define sv_magic_portable(sv, obj, how, name, namlen) \ + STMT_START { \ + if (name && namlen == 0) \ + { \ + MAGIC *mg; \ + sv_magic(sv, obj, how, 0, 0); \ + mg = SvMAGIC(sv); \ + mg->mg_len = -42; /* XXX: this is the tricky part */ \ + mg->mg_ptr = name; \ + } \ + else \ + { \ + sv_magic(sv, obj, how, name, namlen); \ + } \ + } STMT_END + +#else + +# define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) + +#endif + =xsubs void @@ -260,7 +297,27 @@ SvVSTRING_mg(sv) OUTPUT: RETVAL -=tests plan => 13 +int +sv_magic_portable(sv) + SV *sv + PREINIT: + MAGIC *mg; + const char *foo = "foo"; + CODE: +#if { VERSION >= 5.004 } + sv_magic_portable(sv, 0, '~', foo, 0); + mg = mg_find(sv, '~'); + RETVAL = mg->mg_ptr == foo; +#else + sv_magic(sv, 0, '~', foo, strlen(foo)); + mg = mg_find(sv, '~'); + RETVAL = strEQ(mg->mg_ptr, foo); +#endif + sv_unmagic(sv, '~'); + OUTPUT: + RETVAL + +=tests plan => 15 use Tie::Hash; my %h; @@ -303,3 +360,7 @@ ok($[ < 5.009 || $@ eq ''); ok($@ || Devel::PPPort::SvVSTRING_mg($ver)); ok(!Devel::PPPort::SvVSTRING_mg(4711)); +my $foo = 'bar'; +ok(Devel::PPPort::sv_magic_portable($foo)); +ok($foo eq 'bar'); + diff --git a/ext/Devel/PPPort/parts/inc/misc b/ext/Devel/PPPort/parts/inc/misc index 72a1085..847445e 100644 --- a/ext/Devel/PPPort/parts/inc/misc +++ b/ext/Devel/PPPort/parts/inc/misc @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 38 $ +## $Revision: 39 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:34 +0100 $ +## $Date: 2007/07/18 13:09:15 +0200 $ ## ################################################################################ ## @@ -37,6 +37,7 @@ END_EXTERN_C EXTERN_C STMT_START STMT_END +UTF8_MAXBYTES XSRETURN =implementation @@ -213,6 +214,8 @@ __UNDEFINED__ dVAR dNOOP __UNDEFINED__ SVf "_" +__UNDEFINED__ UTF8_MAXBYTES UTF8_MAXLEN + =xsmisc XS(XS_Devel__PPPort_dXSTARG); /* prototype */ diff --git a/ext/Devel/PPPort/parts/inc/ppphbin b/ext/Devel/PPPort/parts/inc/ppphbin index e10a71e..d1b4dc5 100644 --- a/ext/Devel/PPPort/parts/inc/ppphbin +++ b/ext/Devel/PPPort/parts/inc/ppphbin @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 35 $ +## $Revision: 40 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:33 +0100 $ +## $Date: 2007/08/12 23:58:21 +0200 $ ## ################################################################################ ## @@ -102,21 +102,55 @@ if (exists $opt{'list-unsupported'}) { # Scan for possible replacement candidates -my(%replace, %need, %hints, %depends); +my(%replace, %need, %hints, %warnings, %depends); my $replace = 0; -my $hint = ''; +my($hint, $define, $function); while () { if ($hint) { + my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; if (m{^\s*\*\s(.*?)\s*$}) { - $hints{$hint} ||= ''; # suppress warning with older perls - $hints{$hint} .= "$1\n"; + for (@{$hint->[1]}) { + $h->{$_} ||= ''; # suppress warning with older perls + $h->{$_} .= "$1\n"; + } + } + else { + undef $hint; + } + } + + $hint = [$1, [split /,?\s+/, $2]] if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; + + if ($define) { + if ($define->[1] =~ /\\$/) { + $define->[1] .= $_; + } + else { + if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { + my @n = grep { exists $API{$_} } $define->[1] =~ /(\w+)/mg; + push @{$depends{$define->[0]}}, @n if @n + } + undef $define; + } + } + + $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; + + if ($function) { + if (/^}/) { + if (exists $API{$function->[0]}) { + my @n = grep { exists $API{$_} } $function->[1] =~ /(\w+)/mg; + push @{$depends{$function->[0]}}, @n if @n + } + undef $define; } else { - $hint = ''; + $function->[1] .= $_; } } - $hint = $1 if m{^\s*$rccs\sHint:\s+(\w+)\s*$}; + + $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; @@ -130,6 +164,11 @@ while () { $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; } +for (values %depends) { + my %s; + $_ = [sort grep !$s{$_}++, @$_]; +} + if (exists $opt{'api-info'}) { my $f; my $count = 0; @@ -148,7 +187,8 @@ if (exists $opt{'api-info'}) { print "Support by $ppport provided back to perl-$todo.\n"; print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; - print "$hints{$f}" if exists $hints{$f}; + print "\n$hints{$f}" if exists $hints{$f}; + print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; $info++; } unless ($info) { @@ -173,6 +213,7 @@ if (exists $opt{'list-provided'}) { push @flags, 'explicit' if exists $need{$f}; push @flags, 'depend' if exists $depends{$f}; push @flags, 'hint' if exists $hints{$f}; + push @flags, 'warning' if exists $warnings{$f}; my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; print "$f$flags\n"; } @@ -180,23 +221,35 @@ if (exists $opt{'list-provided'}) { } my @files; -my @srcext = qw( xs c h cc cpp ); -my $srcext = join '|', @srcext; +my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); +my $srcext = join '|', map { quotemeta $_ } @srcext; if (@ARGV) { my %seen; - @files = grep { -f && !exists $seen{$_} } map { glob $_ } @ARGV; + for (@ARGV) { + if (-e) { + if (-f) { + push @files, $_ unless $seen{$_}++; + } + else { warn "'$_' is not a file.\n" } + } + else { + my @new = grep { -f } glob $_ + or warn "'$_' does not exist.\n"; + push @files, grep { !$seen{$_}++ } @new; + } + } } else { eval { require File::Find; File::Find::find(sub { - $File::Find::name =~ /\.($srcext)$/i + $File::Find::name =~ /($srcext)$/i and push @files, $File::Find::name; }, '.'); }; if ($@) { - @files = map { glob "*.$_" } @srcext; + @files = map { glob "*$_" } @srcext; } } @@ -204,7 +257,7 @@ if (!@ARGV || $opt{filter}) { my(@in, @out); my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; for (@files) { - my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/\.($srcext)$/i; + my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; push @{ $out ? \@out : \@in }, $_; } if (@ARGV && @out) { @@ -269,6 +322,7 @@ for $filename (@files) { $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; if (exists $API{$func}{provided}) { + $file{uses_provided}{$func}++; if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { $file{uses}{$func}++; my @deps = rec_depend($func); @@ -336,6 +390,7 @@ for $filename (@files) { my %file = %{$files{$filename}}; my $func; my $c = $file{code}; + my $warnings = 0; for $func (sort keys %{$file{uses_Perl}}) { if ($API{$func}{varargs}) { @@ -358,24 +413,24 @@ for $filename (@files) { $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); } - for $func (sort keys %{$file{uses}}) { - next unless $file{uses}{$func}; # if it's only a dependency - if (exists $file{uses_deps}{$func}) { - diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); - } - elsif (exists $replace{$func}) { - warning("Uses $func instead of $replace{$func}"); - $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); - } - else { - diag("Uses $func"); + for $func (sort keys %{$file{uses_provided}}) { + if ($file{uses}{$func}) { + if (exists $file{uses_deps}{$func}) { + diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); + } + else { + diag("Uses $func"); + } } - hint($func); + $warnings += hint($func); } - for $func (sort keys %{$file{uses_todo}}) { - warning("Uses $func, which may not be portable below perl ", - format_version($API{$func}{todo})); + unless ($opt{quiet}) { + for $func (sort keys %{$file{uses_todo}}) { + print "*** WARNING: Uses $func, which may not be portable below perl ", + format_version($API{$func}{todo}), ", even with '$ppport'\n"; + $warnings++; + } } for $func (sort keys %{$file{needed_static}}) { @@ -474,6 +529,10 @@ for $filename (@files) { warning("Uses $cppc C++ style comment$s, which is not portable"); } + my $s = $warnings != 1 ? 's' : ''; + my $warn = $warnings ? " ($warnings warning$s)" : ''; + info("Analysis completed$warn"); + if ($file{changes}) { if (exists $opt{copy}) { my $newfile = "$filename$opt{copy}"; @@ -689,16 +748,24 @@ sub error } my %given_hints; +my %given_warnings; sub hint { $opt{quiet} and return; - $opt{hints} or return; my $func = shift; - exists $hints{$func} or return; - $given_hints{$func}++ and return; - my $hint = $hints{$func}; - $hint =~ s/^/ /mg; - print " --- hint for $func ---\n", $hint; + my $rv = 0; + if (exists $warnings{$func} && !$given_warnings{$func}++) { + my $warn = $warnings{$func}; + $warn =~ s!^!*** !mg; + print "*** WARNING: $func\n", $warn; + $rv++; + } + if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { + my $hint = $hints{$func}; + $hint =~ s/^/ /mg; + print " --- hint for $func ---\n", $hint; + } + $rv; } sub usage diff --git a/ext/Devel/PPPort/parts/inc/ppphdoc b/ext/Devel/PPPort/parts/inc/ppphdoc index 1da2931..4154c7c 100644 --- a/ext/Devel/PPPort/parts/inc/ppphdoc +++ b/ext/Devel/PPPort/parts/inc/ppphdoc @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 28 $ +## $Revision: 30 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:32 +0100 $ +## $Date: 2007/05/22 21:26:46 +0200 $ ## ################################################################################ ## @@ -88,7 +88,10 @@ to be installed on your system. If this option is given, a copy of each file will be saved with the given suffix that contains the suggested changes. This does -not require any external programs. +not require any external programs. Note that this does not +automagially add a dot between the original filename and the +suffix. If you want the dot, you have to include it in the option +argument. If neither C<--patch> or C<--copy> are given, the default is to simply print the diffs for each file. This requires either @@ -127,7 +130,7 @@ alerts will be printed. =head2 --nohints Don't output any hints. Hints often contain useful portability -notes. +notes. Warnings will still be displayed. =head2 --nochanges @@ -154,7 +157,7 @@ module is installed. Lists the API elements for which compatibility is provided by F. Also lists if it must be explicitly requested, -if it has dependencies, and if there are hints for it. +if it has dependencies, and if there are hints or warnings for it. =head2 --list-unsupported @@ -271,6 +274,10 @@ the C<--diff> option: This would output context diffs with 10 lines of context. +If you want to create patched copies of your files instead, use: + + perl ppport.h --copy=.new + To display portability information for the C function, use: diff --git a/ext/Devel/PPPort/parts/inc/ppphtest b/ext/Devel/PPPort/parts/inc/ppphtest index c176474..9534508 100644 --- a/ext/Devel/PPPort/parts/inc/ppphtest +++ b/ext/Devel/PPPort/parts/inc/ppphtest @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 34 $ +## $Revision: 38 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:32 +0100 $ +## $Date: 2007/08/12 23:58:29 +0200 $ ## ################################################################################ ## @@ -15,11 +15,11 @@ ## ################################################################################ -=tests plan => 203 +=tests plan => 221 BEGIN { if ($ENV{'SKIP_SLOW_TESTS'}) { - for (1 .. 203) { + for (1 .. 221) { skip("skip: SKIP_SLOW_TESTS", 0); } exit 0; @@ -270,9 +270,9 @@ ok($o =~ /^Scanning.*file1\.xs/mi); ok($o =~ /Analyzing.*file1\.xs/mi); ok($o !~ /^Scanning.*file2\.xs/mi); ok($o =~ /^Uses newCONSTSUB/m); -ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_nolen/m); +ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_flags/m); +ok($o =~ /WARNING: PL_expect/m); ok($o =~ /hint for newCONSTSUB/m); -ok($o !~ /hint for sv_2pv_nolen/m); ok($o =~ /^Looks good/m); $o = ppport(qw(--nochanges --nohints file1.xs)); @@ -280,9 +280,9 @@ ok($o =~ /^Scanning.*file1\.xs/mi); ok($o =~ /Analyzing.*file1\.xs/mi); ok($o !~ /^Scanning.*file2\.xs/mi); ok($o =~ /^Uses newCONSTSUB/m); -ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_nolen/m); +ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_flags/m); +ok($o =~ /WARNING: PL_expect/m); ok($o !~ /hint for newCONSTSUB/m); -ok($o !~ /hint for sv_2pv_nolen/m); ok($o =~ /^Looks good/m); $o = ppport(qw(--nochanges --nohints --nodiag file1.xs)); @@ -291,8 +291,8 @@ ok($o =~ /Analyzing.*file1\.xs/mi); ok($o !~ /^Scanning.*file2\.xs/mi); ok($o !~ /^Uses newCONSTSUB/m); ok($o !~ /^Uses SvPV_nolen/m); +ok($o =~ /WARNING: PL_expect/m); ok($o !~ /hint for newCONSTSUB/m); -ok($o !~ /hint for sv_2pv_nolen/m); ok($o =~ /^Looks good/m); $o = ppport(qw(--nochanges --quiet file1.xs)); @@ -331,11 +331,12 @@ ok($o =~ /^\s*$/); ---------------------------- file1.xs ----------------------------------------- #define NEED_newCONSTSUB -#define NEED_sv_2pv_nolen +#define NEED_sv_2pv_flags #include "ppport.h" newCONSTSUB(); SvPV_nolen(); +PL_expect = 0; ---------------------------- file2.xs ----------------------------------------- @@ -673,12 +674,14 @@ ok(not ref $p{call_sv}); ok(exists $p{grok_bin}); ok(ref $p{grok_bin}, 'HASH'); -ok(scalar keys %{$p{grok_bin}}, 1); +ok(scalar keys %{$p{grok_bin}}, 2); ok($p{grok_bin}{explicit}); +ok($p{grok_bin}{depend}); ok(exists $p{gv_stashpvn}); ok(ref $p{gv_stashpvn}, 'HASH'); -ok(scalar keys %{$p{gv_stashpvn}}, 1); +ok(scalar keys %{$p{gv_stashpvn}}, 2); +ok($p{gv_stashpvn}{depend}); ok($p{gv_stashpvn}{hint}); ok(exists $p{sv_catpvf_mg}); @@ -687,6 +690,11 @@ ok(scalar keys %{$p{sv_catpvf_mg}}, 2); ok($p{sv_catpvf_mg}{explicit}); ok($p{sv_catpvf_mg}{depend}); +ok(exists $p{PL_signals}); +ok(ref $p{PL_signals}, 'HASH'); +ok(scalar keys %{$p{PL_signals}}, 1); +ok($p{PL_signals}{explicit}); + =============================================================================== # check --list-unsupported option @@ -775,3 +783,26 @@ PL_signals = 123; if (PL_signals == 42) foo(); +=============================================================================== + +my $o = ppport(qw(--nochanges file.xs)); +ok($o =~ /^Uses PL_copline/m); +ok($o =~ /WARNING: PL_copline/m); +ok($o =~ /^Uses SvUOK/m); +ok($o =~ /WARNING: Uses SvUOK, which may not be portable/m); +ok($o =~ /^Analysis completed \(2 warnings\)/m); +ok($o =~ /^Looks good/m); + +$o = ppport(qw(--nochanges --compat-version=5.8.0 file.xs)); +ok($o =~ /^Uses PL_copline/m); +ok($o =~ /WARNING: PL_copline/m); +ok($o !~ /WARNING: Uses SvUOK, which may not be portable/m); +ok($o =~ /^Analysis completed \(1 warning\)/m); +ok($o =~ /^Looks good/m); + +---------------------------- file.xs ----------------------------------------- + +#include "ppport.h" +SvUOK +PL_copline + diff --git a/ext/Devel/PPPort/parts/inc/pvs b/ext/Devel/PPPort/parts/inc/pvs index e87d24a..85ab27b 100644 --- a/ext/Devel/PPPort/parts/inc/pvs +++ b/ext/Devel/PPPort/parts/inc/pvs @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 4 $ +## $Revision: 5 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:29 +0100 $ +## $Date: 2007/07/18 14:19:44 +0200 $ ## ################################################################################ ## @@ -69,7 +69,7 @@ hv_stores(hv, sv) SV *hv SV *sv PPCODE: - hv_stores((HV *) SvRV(hv), "hv_stores", SvREFCNT_inc(sv)); + hv_stores((HV *) SvRV(hv), "hv_stores", SvREFCNT_inc_simple(sv)); =tests plan => 7 diff --git a/ext/Devel/PPPort/parts/inc/sv_xpvf b/ext/Devel/PPPort/parts/inc/sv_xpvf index ffee948..7a4d588 100644 --- a/ext/Devel/PPPort/parts/inc/sv_xpvf +++ b/ext/Devel/PPPort/parts/inc/sv_xpvf @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 5 $ +## $Revision: 7 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:32 +0100 $ +## $Date: 2007/08/12 23:57:10 +0200 $ ## ################################################################################ ## @@ -45,17 +45,14 @@ vnewSVpvf(pTHX_ const char *pat, va_list *args) #endif #endif -/* sv_vcatpvf depends on sv_vcatpvfn */ #if { VERSION >= 5.004 } && !defined(sv_vcatpvf) # define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif -/* sv_vsetpvf depends on sv_vsetpvfn */ #if { VERSION >= 5.004 } && !defined(sv_vsetpvf) # define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) #endif -/* sv_catpvf_mg depends on sv_vcatpvfn, sv_catpvf_mg_nocontext */ #if { VERSION >= 5.004 } && !defined(sv_catpvf_mg) #if { NEED sv_catpvf_mg } @@ -72,7 +69,6 @@ sv_catpvf_mg(pTHX_ SV *sv, const char *pat, ...) #endif #endif -/* sv_catpvf_mg_nocontext depends on sv_vcatpvfn */ #ifdef PERL_IMPLICIT_CONTEXT #if { VERSION >= 5.004 } && !defined(sv_catpvf_mg_nocontext) #if { NEED sv_catpvf_mg_nocontext } @@ -92,6 +88,7 @@ sv_catpvf_mg_nocontext(SV *sv, const char *pat, ...) #endif #endif +/* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ #ifndef sv_catpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext @@ -100,7 +97,6 @@ sv_catpvf_mg_nocontext(SV *sv, const char *pat, ...) # endif #endif -/* sv_vcatpvf_mg depends on sv_vcatpvfn */ #if { VERSION >= 5.004 } && !defined(sv_vcatpvf_mg) # define sv_vcatpvf_mg(sv, pat, args) \ STMT_START { \ @@ -109,7 +105,6 @@ sv_catpvf_mg_nocontext(SV *sv, const char *pat, ...) } STMT_END #endif -/* sv_setpvf_mg depends on sv_vsetpvfn, sv_setpvf_mg_nocontext */ #if { VERSION >= 5.004 } && !defined(sv_setpvf_mg) #if { NEED sv_setpvf_mg } @@ -126,7 +121,6 @@ sv_setpvf_mg(pTHX_ SV *sv, const char *pat, ...) #endif #endif -/* sv_setpvf_mg_nocontext depends on sv_vsetpvfn */ #ifdef PERL_IMPLICIT_CONTEXT #if { VERSION >= 5.004 } && !defined(sv_setpvf_mg_nocontext) #if { NEED sv_setpvf_mg_nocontext } @@ -146,6 +140,7 @@ sv_setpvf_mg_nocontext(SV *sv, const char *pat, ...) #endif #endif +/* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ #ifndef sv_setpvf_mg # ifdef PERL_IMPLICIT_CONTEXT # define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext @@ -154,7 +149,6 @@ sv_setpvf_mg_nocontext(SV *sv, const char *pat, ...) # endif #endif -/* sv_vsetpvf_mg depends on sv_vsetpvfn */ #if { VERSION >= 5.004 } && !defined(sv_vsetpvf_mg) # define sv_vsetpvf_mg(sv, pat, args) \ STMT_START { \ diff --git a/ext/Devel/PPPort/parts/inc/uv b/ext/Devel/PPPort/parts/inc/uv index d11c40a..5e85503 100644 --- a/ext/Devel/PPPort/parts/inc/uv +++ b/ext/Devel/PPPort/parts/inc/uv @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 13 $ +## $Revision: 15 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:33 +0100 $ +## $Date: 2007/08/12 15:53:17 +0200 $ ## ################################################################################ ## @@ -18,6 +18,7 @@ =provides __UNDEFINED__ +SvUOK =implementation @@ -43,6 +44,10 @@ __UNDEFINED__ SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) */ __UNDEFINED__ sv_uv(sv) SvUVx(sv) +#if !defined(SvUOK) && defined(SvIOK_UV) +# define SvUOK(sv) SvIOK_UV(sv) +#endif + __UNDEFINED__ XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) __UNDEFINED__ XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END diff --git a/ext/Devel/PPPort/parts/inc/variables b/ext/Devel/PPPort/parts/inc/variables index be1625b..d34b9c5 100644 --- a/ext/Devel/PPPort/parts/inc/variables +++ b/ext/Devel/PPPort/parts/inc/variables @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 8 $ +## $Revision: 11 $ ## $Author: mhx $ -## $Date: 2007/03/23 16:24:34 +0100 $ +## $Date: 2007/08/13 00:31:48 +0200 $ ## ################################################################################ ## @@ -17,7 +17,43 @@ =provides -/PL_\w+/ +PL_ppaddr +PL_no_modify +PL_DBsignal +PL_DBsingle +PL_DBsub +PL_DBtrace +PL_Sv +PL_compiling +PL_copline +PL_curcop +PL_curstash +PL_debstash +PL_defgv +PL_diehook +PL_dirty +PL_dowarn +PL_errgv +PL_expect +PL_hexdigit +PL_hints +PL_laststatval +PL_na +PL_perl_destruct_level +PL_perldb +PL_rsfp_filters +PL_rsfp +PL_stack_base +PL_stack_sp +PL_statcache +PL_stdingv +PL_sv_arenaroot +PL_sv_no +PL_sv_undef +PL_sv_yes +PL_tainted +PL_tainting +PL_signals PERL_SIGNALS_UNSAFE_FLAG =dontwarn @@ -93,12 +129,18 @@ __NEED_VAR__ U32 PL_signals = D_PPP_PERL_SIGNALS_INIT; /* Replace: 0 */ #endif +/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters + * Do not use this variable. It is internal to the perl parser + * and may change or even be removed in the future. Note that + * as of perl 5.9.5 you cannot assign to this variable anymore. + */ + +/* TODO: cannot assign to these vars; is it worth fixing? */ #if { VERSION >= 5.9.5 } -# define PL_PARSER_EXISTS -# define PL_expect (PL_parser ? PL_parser->expect : 0) -# define PL_copline (PL_parser ? PL_parser->copline : 0) -# define PL_rsfp (PL_parser ? PL_parser->rsfp : 0) -# define PL_rsfp_filters (PL_parser ? PL_parser->rsfp_filters : 0) +# define PL_expect (PL_parser ? PL_parser->expect : 0) +# define PL_copline (PL_parser ? PL_parser->copline : 0) +# define PL_rsfp (PL_parser ? PL_parser->rsfp : (PerlIO *) 0) +# define PL_rsfp_filters (PL_parser ? PL_parser->rsfp_filters : (AV *) 0) #endif =xsinit @@ -175,6 +217,27 @@ PL_copline() RETVAL SV * +PL_expect() + CODE: + RETVAL = newSViv((IV) PL_expect); + OUTPUT: + RETVAL + +SV * +PL_rsfp() + CODE: + RETVAL = newSViv(PL_rsfp != 0); + OUTPUT: + RETVAL + +SV * +PL_rsfp_filters() + CODE: + RETVAL = newSViv(PL_rsfp_filters != 0); + OUTPUT: + RETVAL + +SV * PL_hexdigit() CODE: RETVAL = newSVpv(PL_hexdigit, 0); @@ -219,22 +282,10 @@ other_variables() ppp_TESTVAR(PL_dirty); ppp_TESTVAR(PL_dowarn); ppp_TESTVAR(PL_errgv); -#ifdef PL_PARSER_EXISTS - ppp_TESTVAR(PL_parser); /* just any var that isn't PL_expect */ -#else - ppp_TESTVAR(PL_expect); -#endif ppp_TESTVAR(PL_laststatval); ppp_TESTVAR(PL_no_modify); ppp_TESTVAR(PL_perl_destruct_level); ppp_TESTVAR(PL_perldb); -#ifdef PL_PARSER_EXISTS - ppp_TESTVAR(PL_parser); /* just any var that isn't PL_expect */ - ppp_TESTVAR(PL_parser); -#else - ppp_TESTVAR(PL_rsfp); - ppp_TESTVAR(PL_rsfp_filters); -#endif ppp_TESTVAR(PL_stack_base); ppp_TESTVAR(PL_stack_sp); ppp_TESTVAR(PL_statcache); @@ -254,6 +305,9 @@ ok(!&Devel::PPPort::PL_sv_no()); ok(&Devel::PPPort::PL_na("abcd"), 4); ok(&Devel::PPPort::PL_Sv(), "mhx"); ok(defined &Devel::PPPort::PL_copline()); +ok(defined &Devel::PPPort::PL_expect()); +ok(defined &Devel::PPPort::PL_rsfp()); +ok(defined &Devel::PPPort::PL_rsfp_filters()); ok(&Devel::PPPort::PL_hexdigit() =~ /^[0-9a-zA-Z]+$/); ok(defined &Devel::PPPort::PL_hints()); ok(&Devel::PPPort::PL_ppaddr("mhx"), "MHX"); diff --git a/ext/Devel/PPPort/parts/inc/warn b/ext/Devel/PPPort/parts/inc/warn index 8f000d4..eda8f2c 100644 --- a/ext/Devel/PPPort/parts/inc/warn +++ b/ext/Devel/PPPort/parts/inc/warn @@ -1,8 +1,8 @@ ################################################################################ ## -## $Revision: 3 $ +## $Revision: 5 $ ## $Author: mhx $ -## $Date: 2007/01/02 12:32:29 +0100 $ +## $Date: 2007/08/12 23:57:10 +0200 $ ## ################################################################################ ## @@ -83,7 +83,6 @@ __UNDEFINED__ packWARN(a) (a) # endif #endif -/* warner depends on vnewSVpvf */ #if { VERSION >= 5.004 } && !defined(warner) #if { NEED warner } @@ -104,7 +103,6 @@ warner(U32 err, const char *pat, ...) #define warner Perl_warner -/* Perl_warner_nocontext depends on warner */ #define Perl_warner_nocontext Perl_warner #endif diff --git a/ext/Devel/PPPort/parts/ppport.fnc b/ext/Devel/PPPort/parts/ppport.fnc new file mode 100644 index 0000000..0a8495a --- /dev/null +++ b/ext/Devel/PPPort/parts/ppport.fnc @@ -0,0 +1,29 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: +: Perl/Pollution/Portability +: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: +: $Revision: 1 $ +: $Author: mhx $ +: $Date: 2007/08/12 15:02:00 +0200 $ +: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: +: Version 3.x, Copyright (C) 2004-2007, Marcus Holland-Moritz. +: Version 2.x, Copyright (C) 2001, Paul Marquess. +: Version 1.x, Copyright (C) 1999, Kenneth Albanowski. +: +: This program is free software; you can redistribute it and/or +: modify it under the same terms as Perl itself. +: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +: +: This file lists all API functions/macros that are provided purely +: by Devel::PPPort. It is in the same format as the F that +: ships with the Perl source code. +: + +Am |void |sv_magic_portable|NN SV* sv|NULLOK SV* obj|int how|NULLOK const char* name \ + |I32 namlen diff --git a/ext/Devel/PPPort/parts/ppptools.pl b/ext/Devel/PPPort/parts/ppptools.pl index 64a4cf8..6bd9a07 100644 --- a/ext/Devel/PPPort/parts/ppptools.pl +++ b/ext/Devel/PPPort/parts/ppptools.pl @@ -107,7 +107,7 @@ sub parse_partspec } unless (exists $data{provides}) { - $data{provides} = ($file =~ /(\w+)\.?$/)[0]; + $data{provides} = ($file =~ /(\w+)$/)[0]; } $data{provides} = [$data{provides} =~ /(\S+)/g]; diff --git a/ext/Devel/PPPort/parts/todo/5004000 b/ext/Devel/PPPort/parts/todo/5004000 index 4d33a77..1382ea7 100644 --- a/ext/Devel/PPPort/parts/todo/5004000 +++ b/ext/Devel/PPPort/parts/todo/5004000 @@ -51,6 +51,7 @@ sv_catpvf_mg # U sv_cmp_locale # U sv_derived_from # U sv_gets # E (Perl_sv_gets) +sv_magic_portable # U sv_setpvf # U sv_setpvf_mg # U sv_taint # U diff --git a/ext/Devel/PPPort/parts/todo/5006000 b/ext/Devel/PPPort/parts/todo/5006000 index e16d27b..146fb5f 100644 --- a/ext/Devel/PPPort/parts/todo/5006000 +++ b/ext/Devel/PPPort/parts/todo/5006000 @@ -11,6 +11,7 @@ SvPVutf8_force # U SvPVutf8_nolen # U SvPVutf8x # U SvPVutf8x_force # U +SvUOK # U SvUTF8 # U SvUTF8_off # U SvUTF8_on # U @@ -91,7 +92,6 @@ my_atof # U my_fflush_all # U newANONATTRSUB # U newATTRSUB # U -newPADOP # U newXS # E (Perl_newXS) newXSproto # E new_collate # U (perl_new_collate) @@ -101,7 +101,6 @@ op_dump # U perl_parse # E (perl_parse) pmop_dump # U pv_display # U -re_intuit_start # U re_intuit_string # U reginitcolors # U require_pv # U (perl_require_pv) diff --git a/ext/Devel/PPPort/parts/todo/5007001 b/ext/Devel/PPPort/parts/todo/5007001 index d9dc66f..d630ba6 100644 --- a/ext/Devel/PPPort/parts/todo/5007001 +++ b/ext/Devel/PPPort/parts/todo/5007001 @@ -1,6 +1,5 @@ 5.007001 POPpbytex # E -SvUOK # U bytes_from_utf8 # U despatch_signals # U do_openn # U diff --git a/ext/Devel/PPPort/parts/todo/5007002 b/ext/Devel/PPPort/parts/todo/5007002 index f4f4b8d..2fba735 100644 --- a/ext/Devel/PPPort/parts/todo/5007002 +++ b/ext/Devel/PPPort/parts/todo/5007002 @@ -9,10 +9,8 @@ my_atof2 # U my_strftime # U op_null # U realloc # U -sv_2pv_flags # U sv_catpvn_flags # U sv_catsv_flags # U -sv_pvn_force_flags # U sv_setsv_flags # U sv_utf8_upgrade_flags # U swash_fetch # E (Perl_swash_fetch) diff --git a/ext/Devel/PPPort/parts/todo/5008001 b/ext/Devel/PPPort/parts/todo/5008001 index b0a018c..ddc9d09 100644 --- a/ext/Devel/PPPort/parts/todo/5008001 +++ b/ext/Devel/PPPort/parts/todo/5008001 @@ -1,11 +1,11 @@ 5.008001 SvVOK # U doing_taint # U +find_runcv # U is_utf8_string_loc # U packlist # U save_bool # U savestack_grow_cnt # U -scan_vstring # U seed # U sv_cat_decode # U sv_compile_2op # E (Perl_sv_compile_2op) diff --git a/ext/Devel/PPPort/parts/todo/5009000 b/ext/Devel/PPPort/parts/todo/5009000 index 3b2ffc3..28bc859 100644 --- a/ext/Devel/PPPort/parts/todo/5009000 +++ b/ext/Devel/PPPort/parts/todo/5009000 @@ -1,7 +1,6 @@ 5.009000 new_version # U save_set_svflags # U -upg_version # U vcmp # U vnumify # U vstringify # U diff --git a/ext/Devel/PPPort/parts/todo/5009005 b/ext/Devel/PPPort/parts/todo/5009005 index 5f1a0a2..f124d26 100644 --- a/ext/Devel/PPPort/parts/todo/5009005 +++ b/ext/Devel/PPPort/parts/todo/5009005 @@ -2,6 +2,39 @@ MULTICALL # E POP_MULTICALL # E PUSH_MULTICALL # E +Perl_signbit # U +SvRX # U +SvRXOK # U +av_create_and_push # U +av_create_and_unshift_one # U +get_cvn_flags # U +gv_fetchfile_flags # U hv_assert # U +mro_get_linear_isa # U +mro_get_linear_isa_c3 # U +mro_get_linear_isa_dfs # U +mro_method_changed_in # U +my_dirfd # U +newSV_type # U pad_sv # U +pregcomp # E (Perl_pregcomp) +ptr_table_clear # U +ptr_table_fetch # U +ptr_table_free # U +ptr_table_new # U +ptr_table_split # U +ptr_table_store # U +re_compile # U +re_intuit_start # E (Perl_re_intuit_start) +reg_named_buff_all # U +reg_named_buff_exists # U +reg_named_buff_fetch # U +reg_named_buff_firstkey # U +reg_named_buff_nextkey # U +reg_named_buff_scalar # U +reg_stringify # U +regfree_internal # U +savesharedpvn # U +scan_vstring # E (Perl_scan_vstring) stashpv_hvname_match # U +upg_version # E (Perl_upg_version) diff --git a/ext/Devel/PPPort/soak b/ext/Devel/PPPort/soak index 26b7299..937e486 100644 --- a/ext/Devel/PPPort/soak +++ b/ext/Devel/PPPort/soak @@ -7,9 +7,9 @@ # ################################################################################ # -# $Revision: 15 $ +# $Revision: 16 $ # $Author: mhx $ -# $Date: 2007/01/02 12:32:28 +0100 $ +# $Date: 2007/08/12 23:25:33 +0200 $ # ################################################################################ # @@ -33,7 +33,7 @@ use File::Find; use List::Util qw(max); use Config; -my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; +my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.11_02 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; $| = 1; my %OPT = ( @@ -207,7 +207,7 @@ sub perl_version { my $perl = shift; my $ver = `$perl -e 'print \$]' 2>&1`; - return $? == 0 && $ver >= 5 ? $ver : 0; + return $? == 0 && $ver =~ /^\d+\.\d+/ && $ver >= 5 ? $ver : 0; } sub parse_version diff --git a/ext/Devel/PPPort/t/SvPV.t b/ext/Devel/PPPort/t/SvPV.t index 55eaa99..2484c5b 100644 --- a/ext/Devel/PPPort/t/SvPV.t +++ b/ext/Devel/PPPort/t/SvPV.t @@ -30,9 +30,9 @@ BEGIN { require 'testutil.pl' if $@; } - if (2) { + if (20) { load(); - plan(tests => 2); + plan(tests => 20); } } @@ -48,6 +48,32 @@ bootstrap Devel::PPPort; package main; -ok(&Devel::PPPort::SvPVbyte("mhx"), 3); -ok(&Devel::PPPort::SvPV_nolen("mhx"), 42); +my $mhx = "mhx"; + +ok(&Devel::PPPort::SvPVbyte($mhx), 3); + +my $i = 42; + +ok(&Devel::PPPort::SvPV_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_const($mhx), $i++); +ok(&Devel::PPPort::SvPV_mutable($mhx), $i++); +ok(&Devel::PPPort::SvPV_flags($mhx), $i++); +ok(&Devel::PPPort::SvPV_flags_const($mhx), $i++); + +ok(&Devel::PPPort::SvPV_flags_const_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_flags_mutable($mhx), $i++); +ok(&Devel::PPPort::SvPV_force($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_mutable($mhx), $i++); + +ok(&Devel::PPPort::SvPV_force_nomg($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_nomg_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_flags($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_flags_nolen($mhx), $i++); +ok(&Devel::PPPort::SvPV_force_flags_mutable($mhx), $i++); + +ok(&Devel::PPPort::SvPV_nolen_const($mhx), $i++); +ok(&Devel::PPPort::SvPV_nomg($mhx), $i++); +ok(&Devel::PPPort::SvPV_nomg_const($mhx), $i++); +ok(&Devel::PPPort::SvPV_nomg_const_nolen($mhx), $i++); diff --git a/ext/Devel/PPPort/t/magic.t b/ext/Devel/PPPort/t/magic.t index 37ccfcc..c782da4 100644 --- a/ext/Devel/PPPort/t/magic.t +++ b/ext/Devel/PPPort/t/magic.t @@ -30,9 +30,9 @@ BEGIN { require 'testutil.pl' if $@; } - if (13) { + if (15) { load(); - plan(tests => 13); + plan(tests => 15); } } @@ -89,3 +89,7 @@ ok($[ < 5.009 || $@ eq ''); ok($@ || Devel::PPPort::SvVSTRING_mg($ver)); ok(!Devel::PPPort::SvVSTRING_mg(4711)); +my $foo = 'bar'; +ok(Devel::PPPort::sv_magic_portable($foo)); +ok($foo eq 'bar'); + diff --git a/ext/Devel/PPPort/t/ppphtest.t b/ext/Devel/PPPort/t/ppphtest.t index c70c684..e0af34f 100644 --- a/ext/Devel/PPPort/t/ppphtest.t +++ b/ext/Devel/PPPort/t/ppphtest.t @@ -30,9 +30,9 @@ BEGIN { require 'testutil.pl' if $@; } - if (203) { + if (221) { load(); - plan(tests => 203); + plan(tests => 221); } } @@ -50,7 +50,7 @@ package main; BEGIN { if ($ENV{'SKIP_SLOW_TESTS'}) { - for (1 .. 203) { + for (1 .. 221) { skip("skip: SKIP_SLOW_TESTS", 0); } exit 0; @@ -301,9 +301,9 @@ ok($o =~ /^Scanning.*file1\.xs/mi); ok($o =~ /Analyzing.*file1\.xs/mi); ok($o !~ /^Scanning.*file2\.xs/mi); ok($o =~ /^Uses newCONSTSUB/m); -ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_nolen/m); +ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_flags/m); +ok($o =~ /WARNING: PL_expect/m); ok($o =~ /hint for newCONSTSUB/m); -ok($o !~ /hint for sv_2pv_nolen/m); ok($o =~ /^Looks good/m); $o = ppport(qw(--nochanges --nohints file1.xs)); @@ -311,9 +311,9 @@ ok($o =~ /^Scanning.*file1\.xs/mi); ok($o =~ /Analyzing.*file1\.xs/mi); ok($o !~ /^Scanning.*file2\.xs/mi); ok($o =~ /^Uses newCONSTSUB/m); -ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_nolen/m); +ok($o =~ /^Uses SvPV_nolen.*depends.*sv_2pv_flags/m); +ok($o =~ /WARNING: PL_expect/m); ok($o !~ /hint for newCONSTSUB/m); -ok($o !~ /hint for sv_2pv_nolen/m); ok($o =~ /^Looks good/m); $o = ppport(qw(--nochanges --nohints --nodiag file1.xs)); @@ -322,8 +322,8 @@ ok($o =~ /Analyzing.*file1\.xs/mi); ok($o !~ /^Scanning.*file2\.xs/mi); ok($o !~ /^Uses newCONSTSUB/m); ok($o !~ /^Uses SvPV_nolen/m); +ok($o =~ /WARNING: PL_expect/m); ok($o !~ /hint for newCONSTSUB/m); -ok($o !~ /hint for sv_2pv_nolen/m); ok($o =~ /^Looks good/m); $o = ppport(qw(--nochanges --quiet file1.xs)); @@ -362,11 +362,12 @@ ok($o =~ /^\s*$/); ---------------------------- file1.xs ----------------------------------------- #define NEED_newCONSTSUB -#define NEED_sv_2pv_nolen +#define NEED_sv_2pv_flags #include "ppport.h" newCONSTSUB(); SvPV_nolen(); +PL_expect = 0; ---------------------------- file2.xs ----------------------------------------- @@ -704,12 +705,14 @@ ok(not ref $p{call_sv}); ok(exists $p{grok_bin}); ok(ref $p{grok_bin}, 'HASH'); -ok(scalar keys %{$p{grok_bin}}, 1); +ok(scalar keys %{$p{grok_bin}}, 2); ok($p{grok_bin}{explicit}); +ok($p{grok_bin}{depend}); ok(exists $p{gv_stashpvn}); ok(ref $p{gv_stashpvn}, 'HASH'); -ok(scalar keys %{$p{gv_stashpvn}}, 1); +ok(scalar keys %{$p{gv_stashpvn}}, 2); +ok($p{gv_stashpvn}{depend}); ok($p{gv_stashpvn}{hint}); ok(exists $p{sv_catpvf_mg}); @@ -718,6 +721,11 @@ ok(scalar keys %{$p{sv_catpvf_mg}}, 2); ok($p{sv_catpvf_mg}{explicit}); ok($p{sv_catpvf_mg}{depend}); +ok(exists $p{PL_signals}); +ok(ref $p{PL_signals}, 'HASH'); +ok(scalar keys %{$p{PL_signals}}, 1); +ok($p{PL_signals}{explicit}); + =============================================================================== # check --list-unsupported option @@ -806,3 +814,26 @@ PL_signals = 123; if (PL_signals == 42) foo(); +=============================================================================== + +my $o = ppport(qw(--nochanges file.xs)); +ok($o =~ /^Uses PL_copline/m); +ok($o =~ /WARNING: PL_copline/m); +ok($o =~ /^Uses SvUOK/m); +ok($o =~ /WARNING: Uses SvUOK, which may not be portable/m); +ok($o =~ /^Analysis completed \(2 warnings\)/m); +ok($o =~ /^Looks good/m); + +$o = ppport(qw(--nochanges --compat-version=5.8.0 file.xs)); +ok($o =~ /^Uses PL_copline/m); +ok($o =~ /WARNING: PL_copline/m); +ok($o !~ /WARNING: Uses SvUOK, which may not be portable/m); +ok($o =~ /^Analysis completed \(1 warning\)/m); +ok($o =~ /^Looks good/m); + +---------------------------- file.xs ----------------------------------------- + +#include "ppport.h" +SvUOK +PL_copline + diff --git a/ext/Devel/PPPort/t/variables.t b/ext/Devel/PPPort/t/variables.t index b616c5b..83444a7 100644 --- a/ext/Devel/PPPort/t/variables.t +++ b/ext/Devel/PPPort/t/variables.t @@ -56,6 +56,9 @@ ok(!&Devel::PPPort::PL_sv_no()); ok(&Devel::PPPort::PL_na("abcd"), 4); ok(&Devel::PPPort::PL_Sv(), "mhx"); ok(defined &Devel::PPPort::PL_copline()); +ok(defined &Devel::PPPort::PL_expect()); +ok(defined &Devel::PPPort::PL_rsfp()); +ok(defined &Devel::PPPort::PL_rsfp_filters()); ok(&Devel::PPPort::PL_hexdigit() =~ /^[0-9a-zA-Z]+$/); ok(defined &Devel::PPPort::PL_hints()); ok(&Devel::PPPort::PL_ppaddr("mhx"), "MHX");