diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2004-03-04 20:33:44 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-03-04 20:33:44 +0000 |
commit | 722969e2558105c9a60bf5758cf8dd5f3eedca60 (patch) | |
tree | 8a1dcf7ce8f875ec05b23ec49b9180a3115ce15a | |
parent | 6cd6e77025a610090e5c95f9e958636e90f647bd (diff) | |
download | perl-722969e2558105c9a60bf5758cf8dd5f3eedca60.tar.gz |
retract 22328 and 22332: deprecation warning for my $x if foo
p4raw-id: //depot/perl@22433
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | op.c | 40 | ||||
-rw-r--r-- | opcode.h | 4 | ||||
-rwxr-xr-x | opcode.pl | 4 | ||||
-rw-r--r-- | pod/perldiag.pod | 18 | ||||
-rw-r--r-- | pp.sym | 1 | ||||
-rw-r--r-- | pp_proto.h | 1 | ||||
-rw-r--r-- | t/lib/warnings/op | 57 |
8 files changed, 5 insertions, 122 deletions
@@ -2189,7 +2189,6 @@ #define ck_sort Perl_ck_sort #define ck_spair Perl_ck_spair #define ck_split Perl_ck_split -#define ck_state Perl_ck_state #define ck_subr Perl_ck_subr #define ck_substr Perl_ck_substr #define ck_svconst Perl_ck_svconst @@ -4681,7 +4680,6 @@ #define ck_sort(a) Perl_ck_sort(aTHX_ a) #define ck_spair(a) Perl_ck_spair(aTHX_ a) #define ck_split(a) Perl_ck_split(aTHX_ a) -#define ck_state(a) Perl_ck_state(aTHX_ a) #define ck_subr(a) Perl_ck_subr(aTHX_ a) #define ck_substr(a) Perl_ck_substr(aTHX_ a) #define ck_svconst(a) Perl_ck_svconst(aTHX_ a) @@ -3320,9 +3320,7 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o) } } - o = prepend_elem(OP_LINESEQ, (OP*)cop, o); - CHECKOP(cop->op_type, cop); - return o; + return prepend_elem(OP_LINESEQ, (OP*)cop, o); } @@ -5986,42 +5984,6 @@ Perl_ck_join(pTHX_ OP *o) } OP * -Perl_ck_state(pTHX_ OP *o) -{ - /* warn on C<my $x=1 if foo;> , C<$a && my $x=1;> style statements */ - OP *kid; - o = o->op_sibling; - if (!o || o->op_type != OP_NULL || !(o->op_flags & OPf_KIDS)) - return o; - kid = cUNOPo->op_first; - if (!(kid->op_type == OP_AND || kid->op_type == OP_OR)) - return o; - kid = kUNOP->op_first->op_sibling; - if (kid->op_type == OP_SASSIGN) - kid = kBINOP->op_first->op_sibling; - else if (kid->op_type == OP_AASSIGN) - kid = kBINOP->op_first->op_sibling; - - if (kid->op_type == OP_LIST - || (kid->op_type == OP_NULL && kid->op_targ == OP_LIST)) - { - kid = kUNOP->op_first; - if (kid->op_type == OP_PUSHMARK) - kid = kid->op_sibling; - } - if ((kid->op_type == OP_PADSV || kid->op_type == OP_PADAV - || kid->op_type == OP_PADHV) - && (kid->op_private & OPpLVAL_INTRO) - && (ckWARN(WARN_DEPRECATED))) - { - Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), - "Deprecated use of my() in conditional"); - } - return o; -} - - -OP * Perl_ck_subr(pTHX_ OP *o) { OP *prev = ((cUNOPo->op_first->op_sibling) @@ -1291,8 +1291,8 @@ EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op) = { MEMBER_TO_FPTR(Perl_ck_die), /* die */ MEMBER_TO_FPTR(Perl_ck_fun), /* reset */ MEMBER_TO_FPTR(Perl_ck_null), /* lineseq */ - MEMBER_TO_FPTR(Perl_ck_state), /* nextstate */ - MEMBER_TO_FPTR(Perl_ck_state), /* dbstate */ + MEMBER_TO_FPTR(Perl_ck_null), /* nextstate */ + MEMBER_TO_FPTR(Perl_ck_null), /* dbstate */ MEMBER_TO_FPTR(Perl_ck_null), /* unstack */ MEMBER_TO_FPTR(Perl_ck_null), /* enter */ MEMBER_TO_FPTR(Perl_ck_null), /* leave */ @@ -684,8 +684,8 @@ die die ck_die dimst@ L reset symbol reset ck_fun is% S? lineseq line sequence ck_null @ -nextstate next statement ck_state s; -dbstate debug next statement ck_state s; +nextstate next statement ck_null s; +dbstate debug next statement ck_null s; unstack iteration finalizer ck_null s0 enter block entry ck_null 0 leave block exit ck_null @ diff --git a/pod/perldiag.pod b/pod/perldiag.pod index a2c7348b12..38be87a625 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -4282,24 +4282,6 @@ old way has bad side effects. it already went past any symlink you are presumably trying to look for. The operation returned C<undef>. Use a filename instead. -=item Deprecated use of my() in conditional - -(D deprecated) You used a C<my> declaration within a conditional -expression of some sort, such as C<my $x=1 if foo> or C<foo && (my $x = 1)>. -Perl's run-time behaviour in such constructs is currently undefined, but -typically causes the variable not be be cleared at the end of scope and -to retain its old value the next time the scope is entered. Some people -have been making use of this "feature" to implement a type of static -variable. We intend to change this behaviour in a future release, so -don't rely on it. - -To work around this warning, move the declaration outside the expression, -eg - - my $x; - $x = 1 if foo; - - =item Use of "package" with no arguments is deprecated (D deprecated) You used the C<package> keyword without specifying a package @@ -39,7 +39,6 @@ Perl_ck_shift Perl_ck_sort Perl_ck_spair Perl_ck_split -Perl_ck_state Perl_ck_subr Perl_ck_substr Perl_ck_svconst diff --git a/pp_proto.h b/pp_proto.h index 9b9b7c16bf..2f457c37fd 100644 --- a/pp_proto.h +++ b/pp_proto.h @@ -38,7 +38,6 @@ PERL_CKDEF(Perl_ck_shift) PERL_CKDEF(Perl_ck_sort) PERL_CKDEF(Perl_ck_spair) PERL_CKDEF(Perl_ck_split) -PERL_CKDEF(Perl_ck_state) PERL_CKDEF(Perl_ck_subr) PERL_CKDEF(Perl_ck_substr) PERL_CKDEF(Perl_ck_svconst) diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 3aa5299348..95f3fc8b56 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -1053,60 +1053,3 @@ Useless localization of defined or assignment (//=) at - line 45. Useless localization of substr at - line 48. Useless localization of match position at - line 49. Useless localization of vec at - line 50. -######## -# op.c -use warnings 'deprecated'; -our $a; -my $x1 if $a; -my @x2 if $a; -my %x3 if $a; -my ($x4) if $a; -my ($x5,@x6, %x7) if $a; -my @x8 if ($a+$a); -my $x9 = 1+$a if $a; -my ($x10,@x11) = ($a,$a+$a) if $a; -my ($x12) = 1 if $a; -my $y1 unless $a; -my @y2 unless $a; -my %y3 unless $a; -my ($y4) unless $a; -my ($y5,@y6, %y7) unless $a; -my @y8 unless ($a+$a); -$a && my $z1; -$a && my (%z2); -$a || my @z3; -$a || my (%z4); -$a || my (%z4,$z5); -$a && (my $z6 = 1); -$a && (my ($z7,@z8) = (1,2,3)); - -# these shouldn't warn -our $x if $a; -our $x unless $a; -if ($a) { my $w1 } -if (my $w2) { $a=1 } -if ($a && (my $w3 = 1)) {$a = 2} - -EXPECT -Deprecated use of my() in conditional at - line 4. -Deprecated use of my() in conditional at - line 5. -Deprecated use of my() in conditional at - line 6. -Deprecated use of my() in conditional at - line 7. -Deprecated use of my() in conditional at - line 8. -Deprecated use of my() in conditional at - line 9. -Deprecated use of my() in conditional at - line 10. -Deprecated use of my() in conditional at - line 11. -Deprecated use of my() in conditional at - line 12. -Deprecated use of my() in conditional at - line 13. -Deprecated use of my() in conditional at - line 14. -Deprecated use of my() in conditional at - line 15. -Deprecated use of my() in conditional at - line 16. -Deprecated use of my() in conditional at - line 17. -Deprecated use of my() in conditional at - line 18. -Deprecated use of my() in conditional at - line 19. -Deprecated use of my() in conditional at - line 20. -Deprecated use of my() in conditional at - line 21. -Deprecated use of my() in conditional at - line 22. -Deprecated use of my() in conditional at - line 23. -Deprecated use of my() in conditional at - line 24. -Deprecated use of my() in conditional at - line 25. |