Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f3c2a56

Browse files
committed
Fatalize use of goto to jump into construct
Adapt all tests. Insert a placeholder for the explanation of fatalization in perldiag.
1 parent f04eb08 commit f3c2a56

File tree

6 files changed

+294
-359
lines changed

6 files changed

+294
-359
lines changed

‎pod/perldiag.pod‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7923,6 +7923,10 @@ For speed and efficiency reasons, Perl internally does not do full
79237923
reference-counting of iterated items, hence deleting such an item in the
79247924
middle of an iteration causes Perl to see a freed value.
79257925

7926+
=item Use of "goto" to jump into a construct is no longer permitted
7927+
7928+
(F) More TO COME.
7929+
79267930
=item Use of /g modifier is meaningless in split
79277931

79287932
(W regexp) You used the /g modifier on the pattern for a C<split>

‎pp_ctl.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,10 +3685,7 @@ PP(pp_goto)
36853685
}
36863686

36873687
if (into_construct)
3688-
deprecate_fatal_in(WARN_DEPRECATED__GOTO_CONSTRUCT,
3689-
"5.42",
3690-
"Use of \"goto\" to jump into a construct");
3691-
3688+
croak("Use of \"goto\" to jump into a construct is no longer permitted");
36923689

36933690
if (do_dump) {
36943691
#ifdef VMS

‎t/comp/package_block.t‎

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!./perl
22

3-
print "1..7\n";
3+
print "1..5\n";
44

55
$main::result = "";
66
eval q{
@@ -55,38 +55,3 @@ eval q{
5555
$main::result .= "f(".__LINE__.")";
5656
};
5757
print $main::result eq "a(2)b(4)c(6)d(8)e(10)f(12)" ? "ok 5\n" : "not ok 5\n";
58-
59-
$main::result = "";
60-
$main::warning = "";
61-
$SIG{__WARN__} = sub { $main::warning .= $_[0]; };
62-
eval q{
63-
$main::result .= "a(".__PACKAGE__."/".eval("__PACKAGE__").")";
64-
goto l0;
65-
$main::result .= "b(".__PACKAGE__."/".eval("__PACKAGE__").")";
66-
package Foo {
67-
$main::result .= "c(".__PACKAGE__."/".eval("__PACKAGE__").")";
68-
l0:
69-
$main::result .= "d(".__PACKAGE__."/".eval("__PACKAGE__").")";
70-
goto l1;
71-
$main::result .= "e(".__PACKAGE__."/".eval("__PACKAGE__").")";
72-
}
73-
$main::result .= "f(".__PACKAGE__."/".eval("__PACKAGE__").")";
74-
l1:
75-
$main::result .= "g(".__PACKAGE__."/".eval("__PACKAGE__").")";
76-
goto l2;
77-
$main::result .= "h(".__PACKAGE__."/".eval("__PACKAGE__").")";
78-
package Bar {
79-
l2:
80-
$main::result .= "i(".__PACKAGE__."/".eval("__PACKAGE__").")";
81-
}
82-
$main::result .= "j(".__PACKAGE__."/".eval("__PACKAGE__").")";
83-
};
84-
print $main::result eq
85-
"a(main/main)d(Foo/Foo)g(main/main)i(Bar/Bar)j(main/main)" ?
86-
"ok 6\n" : "not ok 6\n";
87-
print $main::warning =~ /\A
88-
Use\ of\ "goto"\ [^\n]*\ line\ 3\.\n
89-
Use\ of\ "goto"\ [^\n]*\ line\ 15\.\n
90-
\z/x ? "ok 7\n" : "not ok 7\n";
91-
92-
1;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /