2010-10-19 12:33:10 +00:00
|
|
|
diff -up perl-5.12.2/lib/h2ph.t.bug perl-5.12.2/lib/h2ph.t
|
|
|
|
--- perl-5.12.2/lib/h2ph.t.bug 2010-09-07 01:30:32.000000000 +0200
|
2010-10-22 13:11:34 +00:00
|
|
|
+++ perl-5.12.2/lib/h2ph.t 2010-10-20 16:52:07.000000000 +0200
|
|
|
|
@@ -41,9 +41,16 @@ $result = runperl( progfile => 'lib/h2ph
|
2010-10-19 12:33:10 +00:00
|
|
|
stderr => 1 );
|
|
|
|
like( $result, qr/syntax OK$/, "output compiles");
|
|
|
|
|
|
|
|
+$result = runperl( progfile => '_h2ph_pre.ph',
|
|
|
|
+ switches => ['-c'],
|
|
|
|
+ stderr => 1 );
|
|
|
|
+like( $result, qr/syntax OK$/, "preamble compiles");
|
|
|
|
+
|
2010-10-22 13:11:34 +00:00
|
|
|
$result = runperl( switches => ["-w"],
|
|
|
|
- prog => '$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);');
|
|
|
|
-is( $result, '', "output free of warnings" );
|
2010-10-19 12:33:10 +00:00
|
|
|
+ stderr => 1,
|
|
|
|
+ prog => <<'PROG' );
|
|
|
|
+$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);
|
|
|
|
+PROG
|
|
|
|
|
|
|
|
# cleanup
|
2010-10-22 13:11:34 +00:00
|
|
|
END {
|
2010-10-19 12:33:10 +00:00
|
|
|
diff -up perl-5.12.2/utils/h2ph.PL.bug perl-5.12.2/utils/h2ph.PL
|
|
|
|
--- perl-5.12.2/utils/h2ph.PL.bug 2010-09-07 01:30:32.000000000 +0200
|
2010-10-22 13:11:34 +00:00
|
|
|
+++ perl-5.12.2/utils/h2ph.PL 2010-10-20 16:49:33.000000000 +0200
|
|
|
|
@@ -401,7 +401,11 @@ if ($opt_e && (scalar(keys %bad_file) >
|
2010-10-19 12:33:10 +00:00
|
|
|
exit $Exit;
|
|
|
|
|
|
|
|
sub expr {
|
|
|
|
- $new = '"(assembly code)"' and return if /\b__asm__\b/; # freak out.
|
|
|
|
+ if (/\b__asm__\b/) { # freak out
|
|
|
|
+ $new = '"(assembly code)"';
|
2010-10-22 13:11:34 +00:00
|
|
|
+ return
|
2010-10-19 12:33:10 +00:00
|
|
|
+ }
|
2010-10-22 13:11:34 +00:00
|
|
|
+
|
2010-10-19 12:33:10 +00:00
|
|
|
my $joined_args;
|
|
|
|
if(keys(%curargs)) {
|
|
|
|
$joined_args = join('|', keys(%curargs));
|
2010-10-22 13:11:34 +00:00
|
|
|
@@ -770,7 +774,7 @@ sub inc_dirs
|
2010-10-19 12:33:10 +00:00
|
|
|
sub build_preamble_if_necessary
|
|
|
|
{
|
|
|
|
# Increment $VERSION every time this function is modified:
|
|
|
|
- my $VERSION = 2;
|
|
|
|
+ my $VERSION = 3;
|
|
|
|
my $preamble = "$Dest_dir/_h2ph_pre.ph";
|
|
|
|
|
|
|
|
# Can we skip building the preamble file?
|
2010-10-22 13:11:34 +00:00
|
|
|
@@ -798,7 +802,16 @@ sub build_preamble_if_necessary
|
2010-10-19 12:33:10 +00:00
|
|
|
# parenthesized value: d=(v)
|
|
|
|
$define{$_} = $1;
|
|
|
|
}
|
|
|
|
- if ($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) {
|
|
|
|
+ if (/^(\w+)\((\w)\)$/) {
|
2010-10-22 13:11:34 +00:00
|
|
|
+ my($macro, $arg) = ($1, $2);
|
|
|
|
+ my $def = $define{$_};
|
|
|
|
+ $def =~ s/$arg/\$\{$arg\}/g;
|
|
|
|
+ print PREAMBLE <<DEFINE;
|
|
|
|
+unless (defined &$macro) { sub $macro(\$) { my (\$$arg) = \@_; \"$def\" } }
|
2010-10-19 12:33:10 +00:00
|
|
|
+
|
|
|
|
+DEFINE
|
2010-10-22 13:11:34 +00:00
|
|
|
+ } elsif
|
|
|
|
+ ($define{$_} =~ /^([+-]?(\d+)?\.\d+([eE][+-]?\d+)?)[FL]?$/) {
|
2010-10-19 12:33:10 +00:00
|
|
|
# float:
|
|
|
|
print PREAMBLE
|
|
|
|
"unless (defined &$_) { sub $_() { $1 } }\n\n";
|
2010-10-22 13:11:34 +00:00
|
|
|
@@ -807,8 +820,14 @@ sub build_preamble_if_necessary
|
2010-10-19 12:33:10 +00:00
|
|
|
print PREAMBLE
|
|
|
|
"unless (defined &$_) { sub $_() { $1 } }\n\n";
|
|
|
|
} elsif ($define{$_} =~ /^\w+$/) {
|
|
|
|
- print PREAMBLE
|
|
|
|
- "unless (defined &$_) { sub $_() { &$define{$_} } }\n\n";
|
|
|
|
+ my $def = $define{$_};
|
|
|
|
+ if ($isatype{$def}) {
|
2010-10-22 13:11:34 +00:00
|
|
|
+ print PREAMBLE
|
|
|
|
+ "unless (defined &$_) { sub $_() { \"$def\" } }\n\n";
|
2010-10-19 12:33:10 +00:00
|
|
|
+ } else {
|
2010-10-22 13:11:34 +00:00
|
|
|
+ print PREAMBLE
|
|
|
|
+ "unless (defined &$_) { sub $_() { &$def } }\n\n";
|
|
|
|
+ }
|
|
|
|
} else {
|
2010-10-19 12:33:10 +00:00
|
|
|
print PREAMBLE
|
|
|
|
"unless (defined &$_) { sub $_() { \"",
|