Commit 10030f4
Father Chrysostomos
Don’t trigger warnings for qq"@Builtin"
Built-in arrays should not be giving warnings about possible unin-
tended interpolation (which happens with nonexistent arrays).
Some built-in variables do not exist if they are not needed, but perl
will generally pretend that they did already exist whenever they are
fetched. It is such variables that trigger this warning erroneously:
$ ./miniperl -we 'sub dump_isa { warn "@isa" } @isa = ("foo","bar"); dump_isa'
Possible unintended interpolation of @isa in string at -e line 1.
foo bar at -e line 1.
I discovered this when writing a test for @db::args, using -w.
warnings.pm uses @db::args, so ‘use warnings’ code won’t get the warn-
ing, but code using -w gets it:
$ ./miniperl -we 'sub foo { package DB { () = caller 0 } print "@db::args\n" } foo(1..3);'
Possible unintended interpolation of @db::args in string at -e line 1.
1 2 3
The code in toke.c that decides whether this warning should take place
needs to supply the GV_ADDMG flag to gv_fetchpvn_flags, making it one
of the code paths that engages in the pretence mentioned above.
That code already had an explicit exception for @+ and @-. This com-
mit removes it as being no longer necessary.1 parent aebe74f commit 10030f4
2 files changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1115 | 1120 | | |
1116 | 1121 | | |
1117 | 1122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8581 | 8581 | | |
8582 | 8582 | | |
8583 | 8583 | | |
8584 | | - | |
| 8584 | + | |
| 8585 | + | |
8585 | 8586 | | |
8586 | | - | |
8587 | | - | |
8588 | | - | |
8589 | 8587 | | |
8590 | 8588 | | |
8591 | 8589 | | |
| |||
0 commit comments