diff options
author | Gerard Goossen <gerard@ggoossen.net> | 2011-08-09 20:52:34 +0200 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-03 11:27:49 -0700 |
commit | c475d5dcffe516f06f78424f9515dc90cebe2577 (patch) | |
tree | 1ff5b2878322c70a984977f4b8c8b85b39201c3d | |
parent | 33d4ef81b59b60428ca88cbc75a473f65b8e78a4 (diff) | |
download | perl-c475d5dcffe516f06f78424f9515dc90cebe2577.tar.gz |
Include name of global scalars in unitialized value warnings when the peephole optimiser isn't applied.
When the peephole optimiser isn't applied warnings about uninitialised
values from global scalars don't include the name of variable, because
the OP_RV2SV + OP_GV isn't converted to OP_GVSV. This patch fixes that
by extracting the name of the variable from the OP_RV2SV + OP_GV.
-rw-r--r-- | sv.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -13844,6 +13844,19 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, keysv, index, subscript_type); } + case OP_RV2SV: + if (cUNOPx(obase)->op_first->op_type == OP_GV) { + /* $global */ + gv = cGVOPx_gv(cUNOPx(obase)->op_first); + if (!gv || !GvSTASH(gv)) + break; + if (match && (GvSV(gv) != uninit_sv)) + break; + return varname(gv, '$', 0, NULL, 0, FUV_SUBSCRIPT_NONE); + } + /* ${expr} */ + return find_uninit_var(cUNOPx(obase)->op_first, uninit_sv, 1); + case OP_PADSV: if (match && PAD_SVl(obase->op_targ) != uninit_sv) break; @@ -14024,7 +14037,6 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, case OP_ENTEREVAL: /* could be eval $undef or $x='$undef'; eval $x */ - case OP_RV2SV: case OP_CUSTOM: /* XS or custom code could trigger random warnings */ /* the following ops are capable of returning PL_sv_undef even for |