diff options
author | Nicolas R <nicolas@atoomic.org> | 2020-08-10 11:43:51 -0600 |
---|---|---|
committer | Nicolas R <nicolas@atoomic.org> | 2020-08-10 17:26:40 -0600 |
commit | c8799aff0116bda7147dbf4e7a01f814524ee6fe (patch) | |
tree | 64ef46ee94fcf432d2bb64ab235d7a4af56d5f9b /dist/Devel-PPPort/parts/inc | |
parent | 5b2d4421f503a2f8d092d0e49cc851e2f89a8a4d (diff) | |
download | perl-c8799aff0116bda7147dbf4e7a01f814524ee6fe.tar.gz |
Update Devel-PPPort to release 3.59
Note that test files are not under file version
control anymore as they are generated files.
Diffstat (limited to 'dist/Devel-PPPort/parts/inc')
-rw-r--r-- | dist/Devel-PPPort/parts/inc/call | 4 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/cop | 2 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/format | 2 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/gv | 17 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/locale | 19 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/magic | 12 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/mess | 26 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/misc | 13 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/newSVpv | 2 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/ppphbin | 45 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/ppphdoc | 64 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/ppphtest | 7 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/pv_tools | 2 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/sv_xpvf | 18 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/uv | 2 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/variables | 8 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/version | 139 | ||||
-rw-r--r-- | dist/Devel-PPPort/parts/inc/warn | 8 |
18 files changed, 283 insertions, 107 deletions
diff --git a/dist/Devel-PPPort/parts/inc/call b/dist/Devel-PPPort/parts/inc/call index 35258549f8..d1daa6fe3e 100644 --- a/dist/Devel-PPPort/parts/inc/call +++ b/dist/Devel-PPPort/parts/inc/call @@ -409,7 +409,7 @@ ok(!eval { $@ = 'string1'; Devel::PPPort::eval_pv('$@ = "string2"; die "string3" ok($@ =~ /^string3 at \(eval [0-9]+\) line 1\.\n$/); ok(!eval { Devel::PPPort::eval_pv('die False->new', 1); 1 }, 'check false value is rethrown'); -if ("$]" >= '5.007003' or ("$]" >= '5.006001' and "$]" < '5.007')) { +if (ivers($]) >= ivers('5.007003') or (ivers($]) >= ivers('5.006001') and ivers($]) < ivers('5.007'))) { my $hashref = { key => 'value' }; is(eval { Devel::PPPort::eval_pv('die $hashref', 1); 1 }, undef, 'check plain hashref is rethrown'); is(ref($@), 'HASH', 'check $@ is hashref') and @@ -436,7 +436,7 @@ ok(!eval { $@ = 'string1'; Devel::PPPort::eval_sv('$@ = "string2"; die "string3" ok($@ =~ /^string3 at \(eval [0-9]+\) line 1\.\n$/); ok(!eval { Devel::PPPort::eval_sv('die False->new', &Devel::PPPort::G_RETHROW); 1 }, 'check false value is rethrown'); -if ("$]" >= '5.007003' or ("$]" >= '5.006001' and "$]" < '5.007')) { +if (ivers($]) >= ivers('5.007003') or (ivers($]) >= ivers('5.006001') and ivers($]) < ivers('5.007'))) { my $hashref = { key => 'value' }; is(eval { Devel::PPPort::eval_sv('die $hashref', &Devel::PPPort::G_RETHROW); 1 }, undef, 'check plain hashref is rethrown'); is(ref($@), 'HASH', 'check $@ is hashref') and diff --git a/dist/Devel-PPPort/parts/inc/cop b/dist/Devel-PPPort/parts/inc/cop index c9a92ea3f7..a05865fd11 100644 --- a/dist/Devel-PPPort/parts/inc/cop +++ b/dist/Devel-PPPort/parts/inc/cop @@ -182,7 +182,7 @@ print "# $file\n"; ok($file =~ /cop/i); BEGIN { - if ("$]" < 5.006000) { + if (ivers($]) < ivers('5.006000')) { skip("Perl version too early", 8); exit; } diff --git a/dist/Devel-PPPort/parts/inc/format b/dist/Devel-PPPort/parts/inc/format index 094076febe..800e03a35f 100644 --- a/dist/Devel-PPPort/parts/inc/format +++ b/dist/Devel-PPPort/parts/inc/format @@ -93,7 +93,7 @@ OUTPUT: use Config; -if ("$]" < '5.004') { +if (ivers($]) < ivers('5.004')) { skip 'skip: No newSVpvf support', 5; exit; } diff --git a/dist/Devel-PPPort/parts/inc/gv b/dist/Devel-PPPort/parts/inc/gv index 6f7119a092..a0dc2ea410 100644 --- a/dist/Devel-PPPort/parts/inc/gv +++ b/dist/Devel-PPPort/parts/inc/gv @@ -11,13 +11,7 @@ =provides -GV_NOADD_MASK -gv_fetchpvn_flags -GvSVn -isGV_with_GP -gv_fetchsv -get_cvn_flags -gv_init_pvn +__UNDEFINED__ =implementation @@ -25,8 +19,13 @@ gv_init_pvn #undef gv_fetchpvn_flags #endif -__UNDEFINED__ GV_NOADD_MASK 0xE0 -__UNDEFINED__ gv_fetchpvn_flags(name, len, flags, sv_type) gv_fetchpv(SvPVX(sv_2mortal(newSVpvn((name), (len)))), ((flags) & GV_NOADD_MASK) ? FALSE : TRUE, (I32)(sv_type)) +#ifdef GV_NOADD_MASK +# define D_PPP_GV_NOADD_MASK GV_NOADD_MASK +#else +# define D_PPP_GV_NOADD_MASK 0xE0 +#endif + +__UNDEFINED__ gv_fetchpvn_flags(name, len, flags, sv_type) gv_fetchpv(SvPVX(sv_2mortal(newSVpvn((name), (len)))), ((flags) & D_PPP_GV_NOADD_MASK) ? FALSE : TRUE, (I32)(sv_type)) __UNDEFINED__ GvSVn(gv) GvSV(gv) __UNDEFINED__ isGV_with_GP(gv) isGV(gv) diff --git a/dist/Devel-PPPort/parts/inc/locale b/dist/Devel-PPPort/parts/inc/locale index 699adfdc39..41e73e34a7 100644 --- a/dist/Devel-PPPort/parts/inc/locale +++ b/dist/Devel-PPPort/parts/inc/locale @@ -4,8 +4,7 @@ __UNDEFINED__ =implementation - -/* If this doesn't exist, it's not needed, so noop */ +/* If this doesn't exist, it's not needed, so is void noop */ __UNDEFINED__ switch_to_global_locale() /* Originally, this didn't return a value, but in perls like that, the value @@ -17,7 +16,7 @@ __UNDEFINED__ switch_to_global_locale() # if { VERSION >= 5.21.3 } # undef sync_locale # define sync_locale() (Perl_sync_locale(aTHX), 1) -# elif defined(sync_locale) /* These should be the 5.20 maints*/ +# elif defined(sync_locale) /* These should only be the 5.20 maints*/ # undef sync_locale /* Just copy their defn and return 1 */ # define sync_locale() (new_ctype(setlocale(LC_CTYPE, NULL)), \ new_collate(setlocale(LC_COLLATE, NULL)), \ @@ -46,13 +45,13 @@ sync_locale() use Config; - # We don't know for sure that we are in the global locale for testing. But - # if this is unthreaded, it almost certainly is. But Configure can be called - # to force POSIX locales on unthreaded systems. If this becomes a problem - # this check could be beefed up. - if ($Config{usethreads}) { - ok(1); +# We don't know for sure that we are in the global locale for testing. But +# if this is unthreaded, it almost certainly is. But Configure can be called +# to force POSIX locales on unthreaded systems. If this becomes a problem +# this check could be beefed up. +if ($Config{usethreads}) { + ok(1, "ironically we have to skip testing sync_locale under threads"); } else { - ok(&Devel::PPPort::sync_locale()); + ok(&Devel::PPPort::sync_locale(), "sync_locale returns TRUE"); } diff --git a/dist/Devel-PPPort/parts/inc/magic b/dist/Devel-PPPort/parts/inc/magic index 3d3b740fc7..34e2b1db14 100644 --- a/dist/Devel-PPPort/parts/inc/magic +++ b/dist/Devel-PPPort/parts/inc/magic @@ -643,8 +643,8 @@ is($h{sv}, 'Perl'); # v1 is treated as a bareword in older perls... my $ver = do { local $SIG{'__WARN__'} = sub {}; eval qq[v1.2.0] }; -ok("$]" < 5.009 || $@ eq ''); -ok("$]" < 5.009 || Devel::PPPort::SvVSTRING_mg($ver)); +ok(ivers($]) < ivers("5.009") || $@ eq ''); +ok(ivers($]) < ivers("5.009") || Devel::PPPort::SvVSTRING_mg($ver)); ok(!Devel::PPPort::SvVSTRING_mg(4711)); my $foo = 'bar'; @@ -686,7 +686,7 @@ $fetch = $negative; is tied($negative)->{fetch}, 1; is tied($negative)->{store}, 0; is Devel::PPPort::magic_SvIV_nomg($negative), -1; -if (ivers($]) >= ivers(5.6)) { +if (ivers($]) >= ivers("5.6")) { ok !Devel::PPPort::SVf_IVisUV($negative); } else { skip 'SVf_IVisUV is unsupported', 1; @@ -694,7 +694,7 @@ if (ivers($]) >= ivers(5.6)) { is tied($negative)->{fetch}, 1; is tied($negative)->{store}, 0; Devel::PPPort::magic_SvUV_nomg($negative); -if (ivers($]) >= ivers(5.6)) { +if (ivers($]) >= ivers("5.6")) { ok !Devel::PPPort::SVf_IVisUV($negative); } else { skip 'SVf_IVisUV is unsupported', 1; @@ -708,7 +708,7 @@ $fetch = $big; is tied($big)->{fetch}, 1; is tied($big)->{store}, 0; Devel::PPPort::magic_SvIV_nomg($big); -if (ivers($]) >= ivers(5.6)) { +if (ivers($]) >= ivers("5.6")) { ok Devel::PPPort::SVf_IVisUV($big); } else { skip 'SVf_IVisUV is unsupported', 1; @@ -716,7 +716,7 @@ if (ivers($]) >= ivers(5.6)) { is tied($big)->{fetch}, 1; is tied($big)->{store}, 0; is Devel::PPPort::magic_SvUV_nomg($big), Devel::PPPort::above_IV_MAX(); -if (ivers($]) >= ivers(5.6)) { +if (ivers($]) >= ivers("5.6")) { ok Devel::PPPort::SVf_IVisUV($big); } else { skip 'SVf_IVisUV is unsupported', 1; diff --git a/dist/Devel-PPPort/parts/inc/mess b/dist/Devel-PPPort/parts/inc/mess index 14c7def17a..fccec70297 100644 --- a/dist/Devel-PPPort/parts/inc/mess +++ b/dist/Devel-PPPort/parts/inc/mess @@ -313,7 +313,7 @@ CODE: =tests plan => 102 -BEGIN { if ("$]" < '5.006') { $^W = 0; } } +BEGIN { if (ivers($]) < ivers('5.006')) { $^W = 0; } } my $warn; my $die; @@ -435,17 +435,17 @@ ok Devel::PPPort::mess_sv(do {my $tmp = "\xE1"}, 1) =~ /^\xE1 at \Q$0\E line /; ok Devel::PPPort::mess_sv("\xC3\xA1", 0) =~ /^\xC3\xA1 at \Q$0\E line /; ok Devel::PPPort::mess_sv(do {my $tmp = "\xC3\xA1"}, 1) =~ /^\xC3\xA1 at \Q$0\E line /; -if ("$]" >= '5.006') { - BEGIN { if ("$]" >= '5.006' && "$]" < '5.008') { require utf8; utf8->import(); } } +if (ivers($]) >= ivers('5.006')) { + BEGIN { if (ivers($]) >= ivers('5.006') && ivers($]) < ivers('5.008')) { require utf8; utf8->import(); } } undef $die; ok !defined eval { Devel::PPPort::croak_sv("\x{100}\n") }; - if ("$]" < '5.007001' || "$]" > '5.007003') { + if (ivers($]) < ivers('5.007001') || ivers($]) > ivers('5.007003')) { is $@, "\x{100}\n"; } else { skip 'skip: broken utf8 support in die hook', 1; } - if ("$]" < '5.007001' || "$]" > '5.008') { + if (ivers($]) < ivers('5.007001') || ivers($]) > ivers('5.008')) { is $die, "\x{100}\n"; } else { skip 'skip: broken utf8 support in die hook', 1; @@ -453,18 +453,18 @@ if ("$]" >= '5.006') { undef $die; ok !defined eval { Devel::PPPort::croak_sv("\x{100}") }; - if ("$]" < '5.007001' || "$]" > '5.007003') { + if (ivers($]) < ivers('5.007001') || ivers($]) > ivers('5.007003')) { ok $@ =~ /^\x{100} at \Q$0\E line /; } else { skip 'skip: broken utf8 support in die hook', 1; } - if ("$]" < '5.007001' || "$]" > '5.008') { + if (ivers($]) < ivers('5.007001') || ivers($]) > ivers('5.008')) { ok $die =~ /^\x{100} at \Q$0\E line /; } else { skip 'skip: broken utf8 support in die hook', 1; } - if ("$]" < '5.007001' || "$]" > '5.008') { + if (ivers($]) < ivers('5.007001') || ivers($]) > ivers('5.008')) { undef $warn; Devel::PPPort::warn_sv("\x{100}\n"); is $warn, "\x{100}\n"; @@ -487,9 +487,9 @@ if ("$]" >= '5.006') { if (ord('A') != 65) { skip 'skip: no ASCII support', 24; -} elsif ( "$]" >= '5.008' - && "$]" != '5.013000' # Broken in these ranges - && ! ("$]" >= '5.011005' && "$]" <= '5.012000')) +} elsif ( ivers($]) >= ivers('5.008') + && ivers($]) != ivers('5.013000') # Broken in these ranges + && ! (ivers($]) >= ivers('5.011005') && ivers($]) <= ivers('5.012000'))) { undef $die; ok !defined eval { Devel::PPPort::croak_sv(eval '"\N{U+E1}\n"') }; @@ -533,7 +533,7 @@ if (ord('A') != 65) { Devel::PPPort::warn_sv("\xC3\xA1"); ok $warn =~ eval 'qr/^\N{U+C3}\N{U+A1} at \Q$0\E line /'; - if ("$]" < '5.004') { + if (ivers($]) < ivers('5.004')) { skip 'skip: no support for mess_sv', 8; } else { @@ -553,7 +553,7 @@ if (ord('A') != 65) { skip 'skip: no support for \N{U+..} syntax', 24; } -if ("$]" >= '5.007003' or ("$]" >= '5.006001' and "$]" < '5.007')) { +if (ivers($]) >= ivers('5.007003') or (ivers($]) >= ivers('5.006001') and ivers($]) < ivers('5.007'))) { undef $die; ok !defined eval { Devel::PPPort::croak_sv($scalar_ref) }; ok $@ == $scalar_ref; diff --git a/dist/Devel-PPPort/parts/inc/misc b/dist/Devel-PPPort/parts/inc/misc index dce0b906f6..78f55edeb0 100644 --- a/dist/Devel-PPPort/parts/inc/misc +++ b/dist/Devel-PPPort/parts/inc/misc @@ -67,7 +67,6 @@ __UNDEF_NOT_PROVIDED__ withinCOUNT(c, l, n) \ (((WIDEST_UTYPE) (((c)) - ((l) | 0))) <= (((WIDEST_UTYPE) ((n) | 0)))) __UNDEF_NOT_PROVIDED__ inRANGE(c, l, u) \ ( (sizeof(c) == sizeof(U8)) ? withinCOUNT(((U8) (c)), (l), ((u) - (l))) \ - : (sizeof(c) == sizeof(U16)) ? withinCOUNT(((U16) (c)), (l), ((u) - (l))) \ : (sizeof(c) == sizeof(U32)) ? withinCOUNT(((U32) (c)), (l), ((u) - (l))) \ : (withinCOUNT(((WIDEST_UTYPE) (c)), (l), ((u) - (l))))) @@ -274,6 +273,7 @@ __UNDEFINED__ AvFILLp AvFILL __UNDEFINED__ av_tindex AvFILL __UNDEFINED__ av_top_index AvFILL +__UNDEFINED__ av_count(av) (AvFILL(av)+1) __UNDEFINED__ ERRSV get_sv("@",FALSE) @@ -2527,7 +2527,15 @@ av_top_index(av) OUTPUT: RETVAL -=tests plan => 26826 +STRLEN +av_count(av) + SV *av + CODE: + RETVAL = av_count((AV*)SvRV(av)); + OUTPUT: + RETVAL + +=tests plan => 26827 use vars qw($my_sv @my_av %my_hv); @@ -2973,3 +2981,4 @@ for $name (keys %case_changing) { is(&Devel::PPPort::av_top_index([1,2,3]), 2); is(&Devel::PPPort::av_tindex([1,2,3,4]), 3); +is(&Devel::PPPort::av_count([1,2,3,4]), 4); diff --git a/dist/Devel-PPPort/parts/inc/newSVpv b/dist/Devel-PPPort/parts/inc/newSVpv index 22e2fb6daa..c17b6c9f35 100644 --- a/dist/Devel-PPPort/parts/inc/newSVpv +++ b/dist/Devel-PPPort/parts/inc/newSVpv @@ -88,7 +88,7 @@ ok(!defined($s[4])); ok(@s == 1); is($s[0], "test"); -if ("$]" >= 5.008001) { +if (ivers($]) >= ivers("5.008001")) { require utf8; ok(utf8::is_utf8($s[0])); } diff --git a/dist/Devel-PPPort/parts/inc/ppphbin b/dist/Devel-PPPort/parts/inc/ppphbin index a9f6ff661d..5ac6ee8eae 100644 --- a/dist/Devel-PPPort/parts/inc/ppphbin +++ b/dist/Devel-PPPort/parts/inc/ppphbin @@ -18,7 +18,7 @@ use strict; BEGIN { require warnings if "$]" > '5.006' } # Disable broken TRIE-optimization -BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if "$]" >= 5.009004 && "$]" <= 5.009005 } +BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if "$]" >= "5.009004" && "$]" <= "5.009005"} my $VERSION = __VERSION__; @@ -92,7 +92,7 @@ my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ (index($4, 'V') >= 0 ? ( unverified => 1 ) : ()), } ) : die "invalid spec: $_" } qw( -__PERL_API__ +__ALL_ELEMENTS__ ); if (exists $opt{'list-unsupported'}) { @@ -104,7 +104,9 @@ if (exists $opt{'list-unsupported'}) { next if $API{$f}{experimental}; next unless $API{$f}{todo}; next if int_parse_version($API{$f}{todo}) <= $int_min_perl; - print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; + my $repeat = 40 - length($f); + $repeat = 0 if $repeat < 0; + print "$f ", '.'x $repeat, " ", format_version($API{$f}{todo}), "\n"; } exit 0; } @@ -117,7 +119,7 @@ my($hint, $define, $function); sub find_api { - BEGIN { 'warnings'->unimport('uninitialized') if "$]" > 5.006 } + BEGIN { 'warnings'->unimport('uninitialized') if "$]" > '5.006' } my $code = shift; $code =~ s{ / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) @@ -216,7 +218,6 @@ while (<DATA>) { # Set $replace to the number given for lines that look like # / * Replace: \d+ * / - # (blanks added to keep real C comments from appearing in this file) # Thus setting it to 1 starts a region where replacements are automatically # done, and setting it to 0 ends that region. $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; @@ -226,17 +227,14 @@ while (<DATA>) { $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; # Add bar => foo to %replace for lines like '#define foo bar / * Replace * / - # (blanks added to keep real C comments from appearing in this file) $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; # Add foo => bar to %replace for lines like / * Replace foo with bar * / - # (blanks added to keep real C comments from appearing in this file) - $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; + $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+.*?)\s+$rcce\s*$}; # For lines like / * foo, bar depends on baz, bat * / # create a list of the elements on the rhs, and make that list apply to each # element in the lhs, which becomes a key in \%depends. - # (blanks added to keep real C comments from appearing in this file) if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { my @deps = map { s/\s+//g; $_ } split /,/, $3; my $d; @@ -257,8 +255,29 @@ if (exists $opt{'api-info'}) { my $f; my $count = 0; my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; + + # Sort the names, and split into two classes; one for things that are part of + # the API; a second for things that aren't. + my @ok_to_use; + my @shouldnt_use; for $f (sort dictionary_order keys %API) { next unless $f =~ /$match/; + my $base = int_parse_version($API{$f}{base}) if $API{$f}{base}; + if ($base && ! $API{$f}{inaccessible} && ! $API{$f}{core_only}) { + push @ok_to_use, $f; + } + else { + push @shouldnt_use, $f; + } + } + + # We normally suppress non-API items. But if the search matched no API + # items, output the non-ones. This allows someone to get the info for an + # item if they ask for it specifically enough, but doesn't normally clutter + # the output with irrelevant results. + @ok_to_use = @shouldnt_use unless @ok_to_use; + + for $f (@ok_to_use) { print "\n=== $f ===\n"; my $info = 0; my $base; @@ -266,8 +285,8 @@ if (exists $opt{'api-info'}) { my $todo; $todo = int_parse_version($API{$f}{todo}) if $API{$f}{todo}; - # Output information if it is generally publicly usable - if ($base && ! $API{$f}{inaccessible} && ! $API{$f}{core_only}) { + # Output information + if ($base) { my $with_or= ""; if ( $base <= $int_min_perl || ( (! $API{$f}{provided} && ! $todo) @@ -275,7 +294,9 @@ if (exists $opt{'api-info'}) { { $with_or= " with or"; } - print "\nSupported at least since perl-", + + my $Supported = ($API{$f}{undocumented}) ? 'Available' : 'Supported'; + print "\n$Supported at least since perl-", format_version($base), ",$with_or without $ppport."; if ($API{$f}{unverified}) { print "\nThis information is based on inspection of the source code", diff --git a/dist/Devel-PPPort/parts/inc/ppphdoc b/dist/Devel-PPPort/parts/inc/ppphdoc index 57aa6ad594..eae4afc7d6 100644 --- a/dist/Devel-PPPort/parts/inc/ppphdoc +++ b/dist/Devel-PPPort/parts/inc/ppphdoc @@ -54,7 +54,8 @@ ppport.h - Perl/Pollution/Portability version __VERSION__ from ppport.h --list-provided list provided API - --list-unsupported list unsupported API + --list-unsupported list API that isn't supported all the way + back --api-info=name show Perl API portability information =head1 COMPATIBILITY @@ -155,16 +156,23 @@ if it has dependencies, and if there are hints or warnings for it. =head2 --list-unsupported -Lists the API elements that are known not to be supported by -F<ppport.h> and below which version of Perl they probably -won't be available or work. +Lists the API elements that are known not to be FULLY supported by F<ppport.h>, +and below which version of Perl they probably won't be available or work. +By FULLY, we mean that support isn't provided all the way back to the first +version of Perl that F<ppport.h> supports at all. =head2 --api-info=I<name> -Show portability information for API elements matching I<name>. +Show portability information for elements matching I<name>. If I<name> is surrounded by slashes, it is interpreted as a regular expression. +Normally, only API elements are shown, but if there are no matching API +elements but there are some other matching elements, those are shown. This +allows you to conveniently find when functions internal to the core +implementation were added; only people working on the core are likely to find +this last part useful. + =head1 DESCRIPTION In order for a Perl extension (XS) module to be as portable as possible @@ -192,6 +200,50 @@ will provide wrappers for older Perl versions. =item * +Although the purpose of F<ppport.h> is to keep you from having to concern +yourself with what version you are running under, there may arise instances +where you have to do so. These macros, the same ones as in base Perl, are +available to you in all versions, and are what you should use: + +=over 4 + +=item C<PERL_VERSION_I<xx>(major, minor, patch)> + +Returns whether or not the perl currently being compiled has the specified +relationship I<xx> to the perl given by the parameters. I<xx> is one of +C<EQ>, C<NE>, C<LT>, C<LE>, C<GT>, C<GE>. + +For example, + + #if PERL_VERSION_GT(5,24,2) + code that will only be compiled on perls after v5.24.2 + #else + fallback code + #endif + +Note that this is usable in making compile-time decisions + +You may use the special value '*' for the final number to mean ALL possible +values for it. Thus, + + #if PERL_VERSION_EQ(5,31,'*') + +means all perls in the 5.31 series. And + + #if PERL_VERSION_NE(5,24,'*') + +means all perls EXCEPT 5.24 ones. And + + #if PERL_VERSION_LE(5,9,'*') + +is effectively + + #if PERL_VERSION_LT(5,10,0) + +=back + +=item * + If you use one of a few functions or variables that were not present in earlier versions of Perl, and that can't be provided using a macro, you have to explicitly request support for these functions by adding one or @@ -301,7 +353,7 @@ before sending a bug report. If F<ppport.h> was generated using the latest version of C<Devel::PPPort> and is causing failure of this module, please -send a bug report to L<perlbug@perl.org|mailto:perlbug@perl.org>. +file a bug report at L<https://github.com/Dual-Life/Devel-PPPort/issues> Please include the following information: diff --git a/dist/Devel-PPPort/parts/inc/ppphtest b/dist/Devel-PPPort/parts/inc/ppphtest index 849eb16109..cf64ab0071 100644 --- a/dist/Devel-PPPort/parts/inc/ppphtest +++ b/dist/Devel-PPPort/parts/inc/ppphtest @@ -680,7 +680,10 @@ my %p; my $fail = 0; for (@o) { my($name, $flags) = /^(\w+)(?:\s+\[(\w+(?:,\s+\w+)*)\])?$/ or $fail++; - { exists $p{$name} and $fail++; } + { + 'warnings'->unimport('uninitialized') if ivers($]) > ivers('5.006'); + exists $p{$name} and $fail++; + } $p{$name} = defined $flags ? { map { ($_ => 1) } $flags =~ /(\w+)/g } : ''; } ok(@o > 100); @@ -720,7 +723,7 @@ my @o = ppport(qw(--list-unsupported)); my %p; my $fail = 0; for (@o) { - my($name, $ver) = /^(\w+)\s*\.+\s*([\d._]+)$/ or $fail++; + my($name, $ver) = /^(\w+)\s*\.*\s*([\d._]+)$/ or $fail++; { exists $p{$name} and $fail++; } $p{$name} = $ver; } diff --git a/dist/Devel-PPPort/parts/inc/pv_tools b/dist/Devel-PPPort/parts/inc/pv_tools index c523d1c59a..baa3732b8b 100644 --- a/dist/Devel-PPPort/parts/inc/pv_tools +++ b/dist/Devel-PPPort/parts/inc/pv_tools @@ -252,7 +252,7 @@ pv_display() my $uni = &Devel::PPPort::pv_escape_can_unicode(); # sanity check -ok($uni ? "$]" >= 5.006 : "$]" < 5.008); +ok($uni ? ivers($]) >= ivers("5.006") : ivers($]) < ivers("5.008")); my @r; diff --git a/dist/Devel-PPPort/parts/inc/sv_xpvf b/dist/Devel-PPPort/parts/inc/sv_xpvf index c71e805004..23b0da32c9 100644 --- a/dist/Devel-PPPort/parts/inc/sv_xpvf +++ b/dist/Devel-PPPort/parts/inc/sv_xpvf @@ -283,24 +283,24 @@ tie %h, 'Tie::StdHash'; $h{foo} = 'foo-'; $h{bar} = ''; -is(&Devel::PPPort::vnewSVpvf(), "$]" >= 5.004 ? 'Perl-42' : '%s-%d'); -is(&Devel::PPPort::sv_vcatpvf('1-2-3-'), "$]" >= 5.004 ? '1-2-3-Perl-42' : '1-2-3-%s-%d'); -is(&Devel::PPPort::sv_vsetpvf('1-2-3-'), "$]" >= 5.004 ? 'Perl-42' : '%s-%d'); +is(&Devel::PPPort::vnewSVpvf(), ivers($]) >= ivers("5.004") ? 'Perl-42' : '%s-%d'); +is(&Devel::PPPort::sv_vcatpvf('1-2-3-'), ivers($]) >= ivers("5.004") ? '1-2-3-Perl-42' : '1-2-3-%s-%d'); +is(&Devel::PPPort::sv_vsetpvf('1-2-3-'), ivers($]) >= ivers("5.004") ? 'Perl-42' : '%s-%d'); &Devel::PPPort::sv_catpvf_mg($h{foo}); -is($h{foo}, "$]" >= 5.004 ? 'foo-Perl-42' : 'foo-'); +is($h{foo}, ivers($]) >= ivers("5.004") ? 'foo-Perl-42' : 'foo-'); &Devel::PPPort::Perl_sv_catpvf_mg($h{foo}); -is($h{foo}, "$]" >= 5.004 ? 'foo-Perl-42-Perl-43' : 'foo-'); +is($h{foo}, ivers($]) >= ivers("5.004") ? 'foo-Perl-42-Perl-43' : 'foo-'); &Devel::PPPort::sv_catpvf_mg_nocontext($h{foo}); -is($h{foo}, "$]" >= 5.004 ? 'foo-Perl-42-Perl-43-Perl-44' : 'foo-'); +is($h{foo}, ivers($]) >= ivers("5.004") ? 'foo-Perl-42-Perl-43-Perl-44' : 'foo-'); &Devel::PPPort::sv_setpvf_mg($h{bar}); -is($h{bar}, "$]" >= 5.004 ? 'mhx-42' : ''); +is($h{bar}, ivers($]) >= ivers("5.004") ? 'mhx-42' : ''); &Devel::PPPort::Perl_sv_setpvf_mg($h{bar}); -is($h{bar}, "$]" >= 5.004 ? 'foo-43' : ''); +is($h{bar}, ivers($]) >= ivers("5.004") ? 'foo-43' : ''); &Devel::PPPort::sv_setpvf_mg_nocontext($h{bar}); -is($h{bar}, "$]" >= 5.004 ? 'bar-44' : ''); +is($h{bar}, ivers($]) >= ivers("5.004") ? 'bar-44' : ''); diff --git a/dist/Devel-PPPort/parts/inc/uv b/dist/Devel-PPPort/parts/inc/uv index 96145e6833..9332c21255 100644 --- a/dist/Devel-PPPort/parts/inc/uv +++ b/dist/Devel-PPPort/parts/inc/uv @@ -152,7 +152,7 @@ my_strnlen(s, max) =tests plan => 11 -BEGIN { require warnings if "$]" > '5.006' } +BEGIN { require warnings if ivers($]) > ivers('5.006') } is(&Devel::PPPort::sv_setuv(42), 42); is(&Devel::PPPort::newSVuv(123), 123); diff --git a/dist/Devel-PPPort/parts/inc/variables b/dist/Devel-PPPort/parts/inc/variables index cc984c852b..08c26e56ec 100644 --- a/dist/Devel-PPPort/parts/inc/variables +++ b/dist/Devel-PPPort/parts/inc/variables @@ -445,7 +445,7 @@ ok(!&Devel::PPPort::PL_sv_no()); is(&Devel::PPPort::PL_na("abcd"), 4); is(&Devel::PPPort::PL_Sv(), "mhx"); ok(defined &Devel::PPPort::PL_tokenbuf()); -ok("$]" >= 5.009005 || &Devel::PPPort::PL_parser()); +ok(ivers($]) >= ivers("5.009005") || &Devel::PPPort::PL_parser()); ok(&Devel::PPPort::PL_hexdigit() =~ /^[0-9a-zA-Z]+$/); ok(defined &Devel::PPPort::PL_hints()); is(&Devel::PPPort::PL_ppaddr("mhx"), "MHX"); @@ -461,7 +461,7 @@ for (&Devel::PPPort::other_variables()) { local $SIG{'__WARN__'} = sub { push @w, @_ }; ok(&Devel::PPPort::dummy_parser_warning()); } - if ("$]" >= 5.009005) { + if (ivers($]) >= ivers("5.009005")) { ok(@w >= 0); for (@w) { print "# $_"; @@ -477,11 +477,11 @@ for (&Devel::PPPort::other_variables()) { is($fail, 0); } -ok(&Devel::PPPort::no_dummy_parser_vars(1) >= ("$]" < 5.009005 ? 1 : 0)); +ok(&Devel::PPPort::no_dummy_parser_vars(1) >= (ivers($]) < ivers("5.009005") ? 1 : 0)); eval { &Devel::PPPort::no_dummy_parser_vars(0) }; -if ("$]" < 5.009005) { +if (ivers($]) < ivers("5.009005")) { is($@, ''); } else { diff --git a/dist/Devel-PPPort/parts/inc/version b/dist/Devel-PPPort/parts/inc/version index 053a082a6b..421a3aa541 100644 --- a/dist/Devel-PPPort/parts/inc/version +++ b/dist/Devel-PPPort/parts/inc/version @@ -11,43 +11,136 @@ =provides -PERL_REVISION -PERL_VERSION -PERL_SUBVERSION -PERL_BCDVERSION __UNDEFINED__ =dontwarn +## We don't want people to be using these symbols so even though we provide +## them, we don't publicly mention them + +PERL_REVISION +PERL_VERSION +PERL_SUBVERSION PERL_PATCHLEVEL_H_IMPLICIT =implementation -#ifndef PERL_REVISION -# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) +#define D_PPP_RELEASE_DATE 1597017600 /* 2020-08-10 */ + +#if ! defined(PERL_REVISION) && ! defined(PERL_VERSION_MAJOR) +# if ! defined(__PATCHLEVEL_H_INCLUDED__) \ + && ! ( defined(PATCHLEVEL) && defined(SUBVERSION)) # define PERL_PATCHLEVEL_H_IMPLICIT # include <patchlevel.h> # endif -# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) +# if ! defined(PERL_VERSION) \ + && ! defined(PERL_VERSION_MAJOR) \ + && ( ! defined(SUBVERSION) || ! defined(PATCHLEVEL) ) # include <could_not_find_Perl_patchlevel.h> # endif -# ifndef PERL_REVISION -# define PERL_REVISION (5) - /* Replace: 1 */ -# define PERL_VERSION PATCHLEVEL -# define PERL_SUBVERSION SUBVERSION - /* Replace PERL_PATCHLEVEL with PERL_VERSION */ - /* Replace: 0 */ +#endif + +#ifdef PERL_VERSION_MAJOR +# define D_PPP_MAJOR PERL_VERSION_MAJOR +#elif defined(PERL_REVISION) +# define D_PPP_MAJOR PERL_REVISION +#else +# define D_PPP_MAJOR 5 +#endif + +#ifdef PERL_VERSION_MINOR +# define D_PPP_MINOR PERL_VERSION_MINOR +#elif defined(PERL_VERSION) +# define D_PPP_MINOR PERL_VERSION +#elif defined(PATCHLEVEL) +# define D_PPP_MINOR PATCHLEVEL +# define PERL_VERSION PATCHLEVEL /* back-compat */ +#else +# error Could not find a source for PERL_VERSION_MINOR +#endif + +#ifdef PERL_VERSION_PATCH +# define D_PPP_PATCH PERL_VERSION_PATCH +#elif defined(PERL_SUBVERSION) +# define D_PPP_PATCH PERL_SUBVERSION +#elif defined(SUBVERSION) +# define D_PPP_PATCH SUBVERSION +# define PERL_SUBVERSION SUBVERSION /* back-compat */ +#else +# error Could not find a source for PERL_VERSION_PATCH +#endif + +#if D_PPP_MAJOR < 5 || D_PPP_MAJOR == 6 +# error Devel::PPPort works only on Perl 5, Perl 7, ... +#elif D_PPP_MAJOR != 5 + /* Perl 7 and above: the old forms are deprecated, set up so that they + * assume Perl 5, and will make this look like 5.201.201. + * + * 201 is used so will be well above anything that would come from a 5 + * series if we unexpectedly have to continue it, but still gives plenty of + * room, up to 255, of numbers that will fit into a byte in case there is + * something else unforeseen */ +# undef PERL_REVISION +# undef PERL_VERSION +# undef PERL_SUBVERSION +# define D_PPP_REVISION 5 +# define D_PPP_VERSION 201 +# define D_PPP_SUBVERSION 201 +# if (defined(__clang__) /* _Pragma here doesn't work with gcc */ \ + && ( (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ + || defined(_STDC_C99) \ + || defined(__c99))) +# define D_PPP_STRINGIFY(x) #x +# define D_PPP_deprecate(xyz) _Pragma(D_PPP_STRINGIFY(GCC warning(D_PPP_STRINGIFY(xyz) " is deprecated"))) +# define PERL_REVISION (D_PPP_REVISION D_PPP_deprecate(PERL_REVISION)) +# define PERL_VERSION (D_PPP_REVISION D_PPP_deprecate(PERL_VERSION)) +# define PERL_SUBVERSION (D_PPP_SUBVERSION D_PPP_deprecate(PERL_SUBVERSION)) +# else +# define PERL_REVISION D_PPP_REVISION +# define PERL_VERSION D_PPP_REVISION +# define PERL_SUBVERSION D_PPP_SUBVERSION # endif #endif +/* Replace PERL_PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ +/* Replace PATCHLEVEL with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ +/* Replace SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ +/* Replace PERL_REVISION with PERL_VERSION_xy(a,b,c) (where xy is EQ,LT,GT...) */ +/* Replace PERL_VERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ +/* Replace PERL_SUBVERSION with PERL_VERSION_xy(5,a,b) (where xy is EQ,LT,GT...) */ + #define D_PPP_DEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) -#define D_PPP_RVS_TO_BCD(r,v,s) ((D_PPP_DEC2BCD(r)<<24)|(D_PPP_DEC2BCD(v)<<12)|D_PPP_DEC2BCD(s)) -#define PERL_BCDVERSION D_PPP_RVS_TO_BCD(PERL_REVISION, PERL_VERSION, PERL_SUBVERSION) - -__UNDEFINED__ PERL_VERSION_EQ(r,v,s) (PERL_BCDVERSION == D_PPP_RVS_TO_BCD(r,v,s)) -__UNDEFINED__ PERL_VERSION_NE(r,v,s) (! PERL_VERSION_EQ(r,v,s)) -__UNDEFINED__ PERL_VERSION_LT(r,v,s) (PERL_BCDVERSION < D_PPP_RVS_TO_BCD(r,v,s)) -__UNDEFINED__ PERL_VERSION_LE(r,v,s) (PERL_BCDVERSION <= D_PPP_RVS_TO_BCD(r,v,s)) -__UNDEFINED__ PERL_VERSION_GT(r,v,s) (! PERL_VERSION_LE(r,v,s)) -__UNDEFINED__ PERL_VERSION_GE(r,v,s) (! PERL_VERSION_LT(r,v,s)) +#define D_PPP_JNP_TO_BCD(j,n,p) ((D_PPP_DEC2BCD(j)<<24)|(D_PPP_DEC2BCD(n)<<12)|D_PPP_DEC2BCD(p)) +#define D_PPP_BCDVERSION D_PPP_JNP_TO_BCD(D_PPP_MAJOR, \ + D_PPP_MINOR, \ + D_PPP_PATCH) + +/* These differ from the versions outside D:P in using D_PPP_BCDVERSION instead + * of PERL_DECIMAL_VERSION. The formats printing in this module assume BCD, so + * always use it */ +#undef PERL_VERSION_EQ +#undef PERL_VERSION_NE +#undef PERL_VERSION_LT +#undef PERL_VERSION_GE +#undef PERL_VERSION_LE +#undef PERL_VERSION_GT + +/* N.B. These don't work if the patch number is 42 or 92, as those are what '*' + * is in ASCII and EBCDIC respectively */ +__UNDEFINED__ PERL_VERSION_EQ(j,n,p) \ + (((p) == '*') ? ( (j) == D_PPP_VERSION_MAJOR \ + && (n) == D_PPP_VERSION_MINOR) \ + : (D_PPP_BCDVERSION == D_PPP_JNP_TO_BCD(j,n,p))) +__UNDEFINED__ PERL_VERSION_NE(j,n,p) (! PERL_VERSION_EQ(j,n,p)) + +__UNDEFINED__ PERL_VERSION_LT(j,n,p) /* p=='*' means _LT(j,n,0) */ \ + (D_PPP_BCDVERSION < D_PPP_JNP_TO_BCD( (j), \ + (n), \ + (((p) == '*') ? 0 : (p)))) +__UNDEFINED__ PERL_VERSION_GE(j,n,p) (! PERL_VERSION_LT(j,n,p)) + +__UNDEFINED__ PERL_VERSION_LE(j,n,p) /* p=='*' means _LT(j,n+1,0) */ \ + (D_PPP_BCDVERSION < D_PPP_JNP_TO_BCD( (j), \ + (((p) == '*') ? ((n)+1) : (n)), \ + (((p) == '*') ? 0 : (p)))) +__UNDEFINED__ PERL_VERSION_GT(j,n,p) (! PERL_VERSION_LE(j,n,p)) diff --git a/dist/Devel-PPPort/parts/inc/warn b/dist/Devel-PPPort/parts/inc/warn index 32c772ea2a..d3c0d054f6 100644 --- a/dist/Devel-PPPort/parts/inc/warn +++ b/dist/Devel-PPPort/parts/inc/warn @@ -147,15 +147,15 @@ $SIG{'__WARN__'} = sub { $warning = $_[0] }; $warning = ''; Devel::PPPort::warner(); -ok("$]" >= 5.004 ? $warning =~ /^warner bar:42/ : $warning eq ''); +ok(ivers($]) >= ivers("5.004") ? $warning =~ /^warner bar:42/ : $warning eq ''); $warning = ''; Devel::PPPort::Perl_warner(); -ok("$]" >= 5.004 ? $warning =~ /^Perl_warner bar:42/ : $warning eq ''); +ok(ivers($]) >= ivers("5.004") ? $warning =~ /^Perl_warner bar:42/ : $warning eq ''); $warning = ''; Devel::PPPort::Perl_warner_nocontext(); -ok("$]" >= 5.004 ? $warning =~ /^Perl_warner_nocontext bar:42/ : $warning eq ''); +ok(ivers($]) >= ivers("5.004") ? $warning =~ /^Perl_warner_nocontext bar:42/ : $warning eq ''); $warning = ''; Devel::PPPort::ckWARN(); @@ -165,4 +165,4 @@ $^W = 1; $warning = ''; Devel::PPPort::ckWARN(); -ok("$]" >= 5.004 ? $warning =~ /^ckWARN bar:42/ : $warning eq ''); +ok(ivers($]) >= ivers("5.004") ? $warning =~ /^ckWARN bar:42/ : $warning eq ''); |