Skip to content

Commit 1bf4f3b

Browse files
committed
Remove "no warnings 'deprecated';" where no longer needed
These 3 unit tests (which run during t/lib/croak.t): ok 98 - goto into expression ok 99 - dump with computed label ok 100 - when outside given ... no longer need "no warnings 'deprecated';" because they no longer generate 'deprecated'-class warnings. Inside pp_ctl.c we have a 'deprecated'-class warning at line 3655, which falls within function PP(pp_goto). Let's take the 3 unit tests above in turn. "goto into expression" The exception which generates "Can't "goto" into a binary or list expression" occurs at +3234 pp_ctl.c, inside function S_check_op_type. This function is called at +3646 pp_ctl.c and at +3680 pp_ctl.c, both of which are inside function PP(pp_goto). Experimentation indicates that the invocation at +3646 pp_ctl.c. is the triggering invocation. Hence control passes to S_check_op_type before the deprecate_fatal warning at +3655 can be reached. "dump with computed label" The exception which generates "Can't find label" occurs at +3635 pp_ctl.c -- 20 lines before the 'deprecated'-class warning. "when outside given" The exception which generates "Can't "when" outside a topicalizer" occurs at +6398 pp_ctl.c, inside function PP(pp_leavewhen). It appears that in older perls "No warnings 'deprecated';" was needed here because of the (now apparently abandoned) deprecation of given/when.
1 parent e861a6e commit 1bf4f3b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

t/lib/croak/pp_ctl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,24 @@ EXPECT
2020
Can't "goto" into a "given" block at - line 2.
2121
########
2222
# NAME goto into expression
23-
no warnings 'deprecated';
2423
eval { goto a; 1 + do { a: } }; warn $@;
2524
eval { goto b; meth { b: } }; warn $@;
2625
eval { goto c; map { c: } () }; warn $@;
2726
eval { goto d; f(do { d: }) }; die $@;
2827
EXPECT
28+
Can't "goto" into a binary or list expression at - line 1.
2929
Can't "goto" into a binary or list expression at - line 2.
3030
Can't "goto" into a binary or list expression at - line 3.
3131
Can't "goto" into a binary or list expression at - line 4.
32-
Can't "goto" into a binary or list expression at - line 5.
3332
########
3433
# NAME dump with computed label
35-
no warnings 'deprecated';
3634
my $label = "foo";
3735
CORE::dump $label;
3836
EXPECT
39-
Can't find label foo at - line 3.
37+
Can't find label foo at - line 2.
4038
########
4139
# NAME when outside given
42-
use 5.01; no warnings 'deprecated';
40+
use 5.01;
4341
when(undef){}
4442
EXPECT
4543
Can't "when" outside a topicalizer at - line 2.

0 commit comments

Comments
 (0)