Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

savesym XS CVs, harmonize dS warnings, avoid threads::AUTOLOAD

do not warn on BEGIN time fd<3 handles. They can be always reopened.
  • Loading branch information...
commit 9c12501e3735cc648f19f16a3593dabbda2422b6 1 parent fbd65d4
Reini Urban authored

Showing 1 changed file with 10 additions and 11 deletions. Show diff stats Hide diff stats

  1. +10 11 lib/B/C.pm
21 lib/B/C.pm
@@ -2467,7 +2467,7 @@ sub B::PVMG::save {
2467 2467
2468 2468 # mark threads::shared to be xs-loaded
2469 2469 sub mark_threads {
2470   - if ( $threads::VERSION ) {
  2470 + if ( $INC{'threads.pm'} ) {
2471 2471 my $stash = 'threads';
2472 2472 mark_package($stash);
2473 2473 $use_xsloader = 1;
@@ -2896,7 +2896,7 @@ sub B::CV::save {
2896 2896 # from PL_initav->save. Re-bootstrapping will push INIT back in,
2897 2897 # so nullop should be sent.
2898 2898 warn $fullname."\n" if $debug{sub};
2899   - return qq/NULL/;
  2899 + return savesym( $cv, 'NULL' );
2900 2900 }
2901 2901 else {
2902 2902 # XSUBs for IO::File, IO::Handle, IO::Socket, IO::Seekable and IO::Poll
@@ -2923,7 +2923,7 @@ sub B::CV::save {
2923 2923 svref_2object( \*{"$stashname\::bootstrap"} )->save
2924 2924 if $stashname;# and defined ${"$stashname\::bootstrap"};
2925 2925 #mark_package($stashname); # not needed
2926   - return qq/get_cv("$fullname", TRUE)/;
  2926 + return savesym($cv, qq/get_cv("$fullname", TRUE)/);
2927 2927 } else {
2928 2928 my $xsstash = $stashname;
2929 2929 if ($xsstash =~ /^PerlIO::Layer/) {
@@ -2970,7 +2970,7 @@ sub B::CV::save {
2970 2970 $B::C::DynaLoader_warn++;
2971 2971 }
2972 2972 $decl->add("XS($xs);");
2973   - return qq/newXS("$fullname", $xs, (char*)xsfile)/;
  2973 + return savesym($cv, qq/newXS("$fullname", $xs, (char*)xsfile)/);
2974 2974 }
2975 2975 }
2976 2976 if ( $cvxsub && $cvname eq "INIT" ) {
@@ -3042,7 +3042,7 @@ sub B::CV::save {
3042 3042 if ($$gvnew) {
3043 3043 if ($cvstashname ne $gvnew->STASH->NAME or $cvname ne $gvnew->NAME) { # UNIVERSAL or AUTOLOAD
3044 3044 my $newname = $gvnew->STASH->NAME."::".$gvnew->NAME;
3045   - warn "New $newname autoloaded. remove old cv\n" if $debug{sub}; # and wrong GV?
  3045 + warn " New $newname autoloaded. remove old cv\n" if $debug{sub}; # and wrong GV?
3046 3046 unless ($new_cv_fw) {
3047 3047 $svsect->remove;
3048 3048 $xpvcvsect->remove;
@@ -3090,7 +3090,7 @@ sub B::CV::save {
3090 3090 }
3091 3091 if (!$$root) {
3092 3092 if ($fullname ne 'threads::tid' and ($PERL510 and !defined(&{"$cvstashname\::AUTOLOAD"}))) {
3093   - warn "WARNING: &".$fullname." not found\n" if $verbose or $debug{sub};
  3093 + warn "Warning: &".$fullname." not found\n" if $verbose or $debug{sub};
3094 3094 }
3095 3095 $init->add( "/* CV $fullname not found */" ) if $verbose or $debug{sub};
3096 3096 if ($sv_ix == $svsect->index and !$new_cv_fw) { # can delete, is the last SV
@@ -3433,10 +3433,9 @@ if (0) {
3433 3433 $fancyname = cstring($fullname);
3434 3434 }
3435 3435
3436   - if ($fullname eq 'threads::tid' and !$ITHREADS) { # checked for defined'ness in Carp
  3436 + # checked for defined'ness in Carp. So the GV must exist, the CV not
  3437 + if ($fullname =~ /^threads::(tid|AUTOLOAD)$/ and !$ITHREADS) {
3437 3438 $filter = 8;
3438   - # $init->add(qq[$sym = (GV*)&PL_sv_undef;]);
3439   - # return $sym;
3440 3439 }
3441 3440 #if ( !defined(*{$fullname}{GLOB}) or $skip_package{$package} or $package =~ /^B::C(C?)::/) {
3442 3441 # $init->add(qq[$sym = &PL_sv_undef;]);
@@ -4285,7 +4284,7 @@ sub B::IO::save {
4285 4284 }
4286 4285 elsif ($iotype =~ /[a>]/) { # write-only
4287 4286 warn "Warning: Write BEGIN-block $fullname to FileHandle $iotype \&$fd\n"
4288   - if $fd >= 3 or $verbose;
  4287 + if $fd >= 3;
4289 4288 my $mode = $iotype eq '>' ? 'w' : 'a';
4290 4289 #$init->add( sprintf("IoIFP($sym) = IoOFP($sym) = PerlIO_openn(aTHX_ NULL,%s,%d,0,0,NULL,0,NULL);",
4291 4290 # cstring($mode), $fd));
@@ -4294,7 +4293,7 @@ sub B::IO::save {
4294 4293 }
4295 4294 elsif ($iotype =~ /[<#\+]/) {
4296 4295 warn "Warning: Read BEGIN-block $fullname from FileHandle $iotype \&$fd\n"
4297   - if $fd >= 3 or $verbose; # need to setup it up before
  4296 + if $fd >= 3; # need to setup it up before
4298 4297 $init->add("/* XXX WARNING: Read BEGIN-block $fullname from FileHandle */",
4299 4298 "IoIFP($sym) = IoOFP($sym) = PerlIO_fdopen($fd, \"r\");");
4300 4299 my $tell;

0 comments on commit 9c12501

Please sign in to comment.
Something went wrong with that request. Please try again.