-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
h2ph using deprecated goto #10307
Comments
From @toddrCreated by @toddrrunning h2ph produces warnings like this: Use of "goto" to jump into a construct is deprecated at utils/h2ph line 349, <IN> line xxxx If it's still used, we'll need to clean this up. I lack the expertise to provide a patch on this one. Perl Info
|
From zefram@fysh.orgTodd Rinaldo wrote:
You could factor out the EMIT code into a subroutine. Call it from both -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @toddrOn Apr 16, 2010, at 6:02 AM, Zefram wrote:
It looks like h2ph makes copious use of global variables. As a result, I can commit this evil for a minimal patch. No code was changed moving it into the sub other than passing $proto, which is the only non-global used (but not modified). I tried a 5.12.0 build with this patch and it seems to be passing tests. there is a lib/h2ph.t file but I don't know what it tests exactly. |
From @toddrInline Patchdiff --git a/utils/h2ph.PL b/utils/h2ph.PL
index 8f56db4..3d2fe85 100644
--- a/utils/h2ph.PL
+++ b/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; |
From @toddrA patch was added to the ticket to get this fixed. Could it please be added to blead? http://rt.perl.org/rt3/Ticket/Attachment/683450/325408/patch.txt Thanks, |
From @raflTodd Rinaldo <toddr@cpanel.net> writes:
That patch doesn't apply against blead. Could you please prepare a new Thanks! |
From @toddrThe patch differences are accidental and nothing to do with my change. A fuzz 0 patch is |
From @toddrInline Patchdiff --git a/utils/h2ph.PL b/utils/h2ph.PL
index 1255807..d8efcc0 100644
--- a/utils/h2ph.PL
+++ b/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 {
if (/\b__asm__\b/) { # freak out
$new = '"(assembly code)"'; |
From @toddrProviding proper p5p patch. |
From @toddrFrom 9114805349ec4b13b9fe13c3ae89dc22161b2210 Mon Sep 17 00:00:00 2001 It looks like h2ph makes copious use of global variables. As a result, I can I tried a 5.12.0 build with this patch and it seems to be passing tests. utils/h2ph.PL | 42 ++++++++++++++++++++++++------------------ Inline Patchdiff --git a/utils/h2ph.PL b/utils/h2ph.PL
index 1255807..d8efcc0 100644
--- a/utils/h2ph.PL
+++ b/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 {
if (/\b__asm__\b/) { # freak out
$new = '"(assembly code)"';
--
1.7.2 |
From @raflApplied to blead, along with a test. Thank you! |
@rafl - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#74404 (status was 'resolved')
Searchable as RT74404$
The text was updated successfully, but these errors were encountered: