In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/7950e9cf39c803dbea774d03b90552b92052b83d?hp=ca81d15134dd9dc7c213a6d9bbac15adcbc11b08>
- Log ----------------------------------------------------------------- commit 7950e9cf39c803dbea774d03b90552b92052b83d Author: Father Chrysostomos <[email protected]> Date: Thu Sep 4 20:09:29 2014 -0700 Remove -foo ambiguity warning $ ./perl -e 'sub foo{} -foo' Ambiguous use of -foo resolved as -&foo() at -e line 1. There is no ambiguity there, since unary minus does not force its argument to be a bareword; it simply exempts barewords from strictures. This warning also makes it harder to use constantly recently added to POSIX. To avoid that warning, for negative infinity you have to write â- Infâ or â-+Infâ, because the most natural way of writing it, â-Infâ, warns. See <[email protected]> and related messages. ----------------------------------------------------------------------- Summary of changes: t/lib/warnings/toke | 24 ++++++------------------ toke.c | 11 ----------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index 39d3695..8c0158a 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -783,15 +783,14 @@ use warnings "ambiguous"; print for keys %+; # should not warn EXPECT ######## -# toke.c +# toke.c [This does not warn any more.] sub fred {}; -fred ; sub hank : lvalue {$_} --hank; # This should *not* warn [perl #77240] EXPECT -Ambiguous use of -fred resolved as -&fred() at - line 3. ######## -# toke.c +# toke.c [This does not warn any more.] $^W = 0 ; sub fred {} ; -fred ; @@ -803,19 +802,15 @@ sub fred {} ; } -fred ; EXPECT -Ambiguous use of -fred resolved as -&fred() at - line 4. -Ambiguous use of -fred resolved as -&fred() at - line 9. -Ambiguous use of -fred resolved as -&fred() at - line 11. ######## -# toke.c +# toke.c [This does not warn any more.] use utf8; use open qw( :utf8 :std ); sub frèd {}; -frèd ; EXPECT -Ambiguous use of -frèd resolved as -&frèd() at - line 5. ######## -# toke.c +# toke.c [This does not warn any more.] $^W = 0 ; use utf8; use open qw( :utf8 :std ); @@ -829,19 +824,15 @@ sub frèd {} ; } -frèd ; EXPECT -Ambiguous use of -frèd resolved as -&frèd() at - line 6. -Ambiguous use of -frèd resolved as -&frèd() at - line 11. -Ambiguous use of -frèd resolved as -&frèd() at - line 13. ######## -# toke.c +# toke.c [This does not warn any more.] use utf8; use open qw( :utf8 :std ); sub ááá {}; -ááá ; EXPECT -Ambiguous use of -ááá resolved as -&ááá() at - line 5. ######## -# toke.c +# toke.c [This does not warn any more.] $^W = 0 ; use utf8; use open qw( :utf8 :std ); @@ -855,9 +846,6 @@ sub ááá {} ; } -ááá ; EXPECT -Ambiguous use of -ááá resolved as -&ááá() at - line 6. -Ambiguous use of -ááá resolved as -&ááá() at - line 11. -Ambiguous use of -ááá resolved as -&ááá() at - line 13. ######## # toke.c open FOO || time; diff --git a/toke.c b/toke.c index 87a34dc..4d33472 100644 --- a/toke.c +++ b/toke.c @@ -6474,10 +6474,6 @@ Perl_yylex(pTHX) just_a_word: { int pkgname = 0; const char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL_bufptr[-1]); - const char penultchar = - lastchar && PL_bufptr - 2 >= PL_linestart - ? PL_bufptr[-2] - : 0; bool safebw; @@ -6686,13 +6682,6 @@ Perl_yylex(pTHX) if (cv) { OP *gvop; - if (lastchar == '-' && penultchar != '-') { - const STRLEN l = len ? len : strlen(PL_tokenbuf); - Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS), - "Ambiguous use of -%"UTF8f" resolved as -&%"UTF8f"()", - UTF8fARG(UTF, l, PL_tokenbuf), - UTF8fARG(UTF, l, PL_tokenbuf)); - } /* Check for a constant sub */ if ((sv = cv_const_sv_or_av(cv))) { its_constant: -- Perl5 Master Repository
