From 84b32f52b10f9912b40ef378cd0b01f4aff80630 Mon Sep 17 00:00:00 2001 From: Abigail Date: Wed, 23 Nov 2016 22:52:36 +0100 Subject: [PATCH] Jumping into constructs will be fatal in 5.28. --- pod/perldeprecation.pod | 26 ++++++++++++++++++++++++++ pod/perldiag.pod | 4 +++- pod/perlfunc.pod | 3 ++- pp_ctl.c | 2 +- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod index fb1d3861bd8a..13879347b971 100644 --- a/pod/perldeprecation.pod +++ b/pod/perldeprecation.pod @@ -151,6 +151,32 @@ will be a fatal error in Perl 5.28. You should be using two different symbols instead. + + +=head3 Use of "goto" to jump into a construct. + +Use of C to jump from an outer scope into an inner scope was +deprecated in Perl 5.12, and it will be a fatal error in Perl 5.28. + +This means, you should not write constructs like: + + $x = 1; + while ($x) { + $foo = 1; + LABEL: + $bar = 1; + } + goto LABEL; + +This will jump into the block belonging to C. Not only has +been this a cause of subtle bugs in the past, it's generally +considered to lead to hard to understand programs. + +This means, soon it's not possible anymore to write +L in pure Perl. +But you never wanted to do this anyway. + + =head3 ${^ENCODING} is no longer supported. The special variable C<${^ENCODING}> was used to implement diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 6f61d2227358..d581a630ed6a 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -6979,11 +6979,13 @@ middle of an iteration causes Perl to see a freed value. operator. Since C always tries to match the pattern repeatedly, the C has no effect. -=item Use of "goto" to jump into a construct is deprecated +=item Use of "goto" to jump into a construct is deprecated. Its use will be fatal in Perl 5.28 (D deprecated) Using C to jump from an outer scope into an inner scope is deprecated and should be avoided. +This was deprecated in Perl 5.12, and will be a fatal error in Perl 5.28. + =item Use of inherited AUTOLOAD for non-method %s() is deprecated (D deprecated) As an (ahem) accidental feature, C diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 18bb4654e1e1..d8cf052aa44e 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -3285,7 +3285,8 @@ Also, unlike most named operators, this has the same precedence as assignment. Use of C or C to jump into a construct is -deprecated and will issue a warning. Even then, it may not be used to +deprecated and will issue a warning; it will be a fatal error in +Perl 5.28. Even then, it may not be used to go into any construct that requires initialization, such as a subroutine or a C loop. It also can't be used to go into a construct that is optimized away. diff --git a/pp_ctl.c b/pp_ctl.c index 89a7521f603f..b86ebde544fe 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3011,7 +3011,7 @@ PP(pp_goto) if (*enterops && enterops[1]) { I32 i = enterops[1]->op_type == OP_ENTER && in_block ? 2 : 1; if (enterops[i]) - deprecate("\"goto\" to jump into a construct"); + deprecate_fatal_in("5.28", "Use of \"goto\" to jump into a construct is deprecated. Its use will be fatal in Perl 5.28"); } /* pop unwanted frames */