From: Dave Mitchell Date: Fri, 22 Feb 2008 00:07:15 +0000 (+0000) Subject: fix variable names in 'ununit var' warnings in evals X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=50edf520be9fa4c0e7982006bec3a6939b2f61a7;p=p5sagit%2Fp5-mst-13.2.git fix variable names in 'ununit var' warnings in evals p4raw-id: //depot/perl@33342 --- diff --git a/sv.c b/sv.c index 1ef5e31..be66ac8 100644 --- a/sv.c +++ b/sv.c @@ -12545,6 +12545,7 @@ S_find_uninit_var(pTHX_ OP* obase, SV* uninit_sv, bool match) goto do_op2; + case OP_ENTEREVAL: /* could be eval $undef or $x='$undef'; eval $x */ case OP_RV2SV: case OP_CUSTOM: match = 1; /* XS or custom code could trigger random warnings */ diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index dd305e3..bbaba19 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -669,6 +669,9 @@ $foo =~ s/$m1/z/; $foo =~ s//$g1/; $foo =~ s/$m1/$g1/; $foo =~ s/./$m1/e; +undef $g1; +$m1 = '$g1'; +$foo =~ s//$m1/ee; EXPECT Use of uninitialized value $_ in pattern match (m//) at - line 5. Use of uninitialized value $m1 in regexp compilation at - line 6. @@ -731,6 +734,7 @@ Use of uninitialized value $g1 in substitution (s///) at - line 39. Use of uninitialized value $m1 in regexp compilation at - line 40. Use of uninitialized value $g1 in substitution iterator at - line 40. Use of uninitialized value $m1 in substitution iterator at - line 41. +Use of uninitialized value in substitution iterator at - line 44. ######## use warnings 'uninitialized'; my ($m1); @@ -1304,13 +1308,15 @@ Use of uninitialized value $m1 in localtime at - line 5. Use of uninitialized value $g1 in gmtime at - line 6. ######## use warnings 'uninitialized'; -my ($m1, $v); +my ($m1, $m2, $v); $v = eval; $v = eval $m1; +$m2 = q($m1); $v = 1 + eval $m2; EXPECT Use of uninitialized value $_ in eval "string" at - line 4. Use of uninitialized value $m1 in eval "string" at - line 5. +Use of uninitialized value in addition (+) at - line 6. ######## use warnings 'uninitialized'; my ($m1);