diff options
-rw-r--r-- | dist/B-Deparse/t/deparse.t | 7 | ||||
-rw-r--r-- | gv.c | 29 | ||||
-rw-r--r-- | pod/perldelta.pod | 7 | ||||
-rw-r--r-- | pod/perldiag.pod | 7 | ||||
-rw-r--r-- | t/lib/warnings/gv | 18 |
5 files changed, 59 insertions, 9 deletions
diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t index 6b51d1e0c0..f26aa969d4 100644 --- a/dist/B-Deparse/t/deparse.t +++ b/dist/B-Deparse/t/deparse.t @@ -1053,11 +1053,16 @@ print $_; #### # $#- $#+ $#{%} etc. my @x; -@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&}, $#{*}); +@x = ($#{`}, $#{~}, $#{!}, $#{@}, $#{$}, $#{%}, $#{^}, $#{&}); @x = ($#{(}, $#{)}, $#{[}, $#{{}, $#{]}, $#{}}, $#{'}, $#{"}, $#{,}); @x = ($#{<}, $#{.}, $#{>}, $#{/}, $#{?}, $#{=}, $#+, $#{\}, $#{|}, $#-); @x = ($#{;}, $#{:}); #### +# $#{*} +# It's a known TODO that warnings are deparsed as bits, not textually. +no warnings; +() = $#{*}; +#### # ${#} interpolated # It's a known TODO that warnings are deparsed as bits, not textually. no warnings; @@ -1638,16 +1638,23 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1); else if (*name == '-' || *name == '+') require_tie_mod(gv, name, newSVpvs("Tie::Hash::NamedCapture"), "TIEHASH", 0); - } else if (sv_type == SVt_PV) { - if (*name == '*') { + } else if (sv_type == SVt_PV && *name == '#') { + Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, + WARN_SYNTAX), + "$# is no longer supported"); + } + if (*name == '*') { + if (sv_type == SVt_PV) Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), "$* is no longer supported, and will become a syntax error"); - } else if (*name == '#') { - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, - WARN_SYNTAX), - "$# is no longer supported"); - } + else + Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), + "%c* is deprecated, and will become a syntax error", + sv_type == SVt_PVAV ? '@' + : sv_type == SVt_PVCV ? '&' + : sv_type == SVt_PVHV ? '%' + : '*'); } if (sv_type==SVt_PV || sv_type==SVt_PVGV) { switch (*name) { @@ -1940,6 +1947,14 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (sv_type == SVt_PV) Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), "$* is no longer supported, and will become a syntax error"); + else { + Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), + "%c* is deprecated, and will become a syntax error", + sv_type == SVt_PVAV ? '@' + : sv_type == SVt_PVCV ? '&' + : sv_type == SVt_PVHV ? '%' + : '*'); + } break; case '#': /* $# */ if (sv_type == SVt_PV) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 1a17400034..68f070f5a1 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -192,7 +192,12 @@ XXX L<message|perldiag/"message"> =item * -XXX L<message|perldiag/"message"> +L%c* is deprecated, and will become a syntax error|perldiag/"%c* is deprecated, and will become a syntax error"> + +Use of C<@*>, C<&*>, C<**> or C<%*> is now deprecated, and will generate a +compile time warning, enabled by default. In future such code will fail to +compile with a syntax error. Removing these variables, along with C<$*>, +will permit future syntax additions. =back diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 069e1aab71..17d13ceaaa 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2618,6 +2618,13 @@ modifiers. You can enable C</m> for a lexical scope (even a whole file) with C<use re '/m'>. (In older versions: when C<$*> was set to a true value then all regular expressions behaved as if they were written using C</m>.) +=item %c* is deprecated, and will become a syntax error + +(D deprecated, syntax) The punctuation variables C<@*>, C<&*>, C<**> and +C<%*> will be removed soon. In future such code will fail to compile with a +syntax error. Removing these variables along with C<$*> will permit future +syntax additions. + =item $# is no longer supported (D deprecated, syntax) The special variable C<$#>, deprecated in older diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index 1618e40932..332810c7e5 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -100,6 +100,7 @@ $* is no longer supported, and will become a syntax error at - line 7. $a = $#; $a = $*; EXPECT +@* is deprecated, and will become a syntax error at - line 3. $# is no longer supported at - line 4. $* is no longer supported, and will become a syntax error at - line 5. ######## @@ -111,6 +112,23 @@ $a = $*; EXPECT $# is no longer supported at - line 2. $* is no longer supported, and will become a syntax error at - line 3. +@* is deprecated, and will become a syntax error at - line 5. +######## +# gv.c +$a = \@*; +$a = \&*; +$a = \**; +$a = \%*; +no warnings 'deprecated' ; +$a = \@*; +$a = \&*; +$a = \**; +$a = \%*; +EXPECT +@* is deprecated, and will become a syntax error at - line 2. +&* is deprecated, and will become a syntax error at - line 3. +** is deprecated, and will become a syntax error at - line 4. +%* is deprecated, and will become a syntax error at - line 5. ######## # gv.c use warnings 'syntax' ; |