diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-28 16:19:24 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-28 16:19:24 +0000 |
commit | fdac912e801e531e7b5915f9de291c65c40addce (patch) | |
tree | 0f3aaac96a8096157da16f1bf0bf171fff54b7c9 /gnu | |
parent | a6aa13e6a2b21b1eef07718edda1dbd891d35517 (diff) |
Fix [perl #74404] h2ph using deprecated goto
Patch from perl git repo
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/perl/utils/h2ph.PL | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/gnu/usr.bin/perl/utils/h2ph.PL b/gnu/usr.bin/perl/utils/h2ph.PL index 4c5a6cd0569..6517d31e1a0 100644 --- a/gnu/usr.bin/perl/utils/h2ph.PL +++ b/gnu/usr.bin/perl/utils/h2ph.PL @@ -147,23 +147,7 @@ while (defined (my $file = next_file())) { s/^\s+//; expr(); $new =~ s/(["\\])/\\$1/g; #"]); - EMIT: - $new = reindent($new); - $args = reindent($args); - if ($t ne '') { - $new =~ s/(['\\])/\\$1/g; #']); - if ($opt_h) { - print OUT $t, - "eval \"\\n#line $eval_index $outfile\\n\" . 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n"; - $eval_index++; - } else { - print OUT $t, - "eval 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n"; - } - } else { - print OUT "unless(defined(\&$name)) {\n sub $name $proto\{\n\t${args}eval q($new);\n }\n}\n"; - } - %curargs = (); + EMIT($proto); } else { s/^\s+//; expr(); @@ -380,7 +364,7 @@ while (defined (my $file = next_file())) { $new =~ s/&$_\b/\$$_/g for @local_variables; $new =~ s/(["\\])/\\$1/g; #"]); # now that's almost like a macro (we hope) - goto EMIT; + EMIT($proto); } } $Is_converted{$file} = 1; @@ -400,6 +384,28 @@ if ($opt_e && (scalar(keys %bad_file) > 0)) { exit $Exit; +sub EMIT { + my $proto = shift; + + $new = reindent($new); + $args = reindent($args); + if ($t ne '') { + $new =~ s/(['\\])/\\$1/g; #']); + if ($opt_h) { + print OUT $t, + "eval \"\\n#line $eval_index $outfile\\n\" . 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n"; + $eval_index++; + } else { + print OUT $t, + "eval 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n"; + } + } else { + print OUT "unless(defined(\&$name)) {\n sub $name $proto\{\n\t${args}eval q($new);\n }\n}\n"; + } + %curargs = (); + return; +} + sub expr { $new = '"(assembly code)"' and return if /\b__asm__\b/; # freak out. my $joined_args; |