Skip to content

Commit

Permalink
C 1.57_01: add dynamic_copwarn to v5.29.7+
Browse files Browse the repository at this point in the history
cannot initialize PL_WARN_ALL|NONE statically anymore.
Not added to cperl, i.e. reverted for v5.29.2c.
  • Loading branch information
rurban committed May 8, 2019
1 parent 5bd70da commit f17578e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Changes
Expand Up @@ -3,6 +3,11 @@
The Perl compiler was in CORE from alpha4 until Perl 5.9.4
and worked quite fine with Perl 5.6 and 5.8.

1.57_01 2019-05-08 rurban
* C: add dynamic_copwarn to v5.29.7+, cannot initialize
PL_WARN_ALL|NONE statically anymore. Not added to cperl.
* buildcc: pass -cw

1.57 2019-05-07 rurban
* Makefile.PL: fix wrong t/modules.pm dependency

Expand Down
16 changes: 11 additions & 5 deletions lib/B/C.pm
Expand Up @@ -13,7 +13,7 @@
package B::C;
use strict;

our $VERSION = '1.57';
our $VERSION = '1.57_01';
our (%debug, $check, %Config, %Cross, %OriConfig, $cross);
BEGIN {
require B::C::Config;
Expand Down Expand Up @@ -2443,7 +2443,13 @@ sub B::COP::save {

my $dynamic_copwarn = ($PERL510 and !$is_special) ? 1 : !$B::C::optimize_warn_sv;
# branch feature/gh70-static-lexwarn with PERL_SUPPORT_STATIC_COP
$dynamic_copwarn = 0 if $Config{usecperl} and $] >= 5.022002;
$dynamic_copwarn = 0 if $^V =~ /c$/ and $] >= 5.022002;
# v5.29.7 added non-static PL_WARN_ALL|NONE symbols
$dynamic_copwarn = 1
if $is_special and $warn_sv =~ /_(?:ALL|NONE)/
and ($^V !~ /c$/ and $] >= 5.029007);
# reverted that in cperl
# or ($^V =~ /c$/ and $] >= 5.029002));

# Trim the .pl extension, to print the executable name only.
my $file = $op->file;
Expand Down Expand Up @@ -2598,16 +2604,16 @@ sub B::COP::save {
# lexwarn<n> might be also be STRLEN* 0
$init->no_split;
$init->add("#ifdef PERL_SUPPORT_STATIC_COP /* so far cperl only */",
"$dest = $warn_sv;",
" $dest = $warn_sv;",
"#else",
sprintf("%s = (STRLEN*)savesharedpvn((const char*)%s, sizeof(%s));",
sprintf(" %s = (STRLEN*)savesharedpvn((const char*)%s, sizeof(%s));",
$dest, $copw, $copw),
"#endif");
$init->split;
}
} else {
$init->add( sprintf( "cop_list[%d].cop_warnings = %s;", $ix, $warn_sv ) )
unless $B::C::optimize_warn_sv;
if !$B::C::optimize_warn_sv or $dynamic_copwarn;
}
#push @B::C::static_free, "cop_list[$ix]" if $ITHREADS;
if (!$B::C::optimize_cop) {
Expand Down

0 comments on commit f17578e

Please sign in to comment.