In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b255a112693312907754193cdbc1648d9182cb0d?hp=13adb056c2262d333a32ed705fd4906e95f9b08c>
- Log ----------------------------------------------------------------- commit b255a112693312907754193cdbc1648d9182cb0d Author: Father Chrysostomos <spr...@cpan.org> Date: Thu Nov 13 05:34:15 2014 -0800 â%s found where op expectedâ under fatal warnings This is related to ticket #123195. This code: use warnings FATAL => 'all'; use strict; $foo; myfunc 1,2,3 __END__ was giving this: Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3. (Do you need to predeclare myfunc?) syntax error at - line 4, near "myfunc 1" Execution of - aborted due to compilation errors. How can we have âDo you need to predeclare myfunc?â without any prior mention of myfunc in the diagnostics? Fatal warnings were modified in 594b6fac to queue compile-time warning and emit them as part of the error message. But the logic was not quite right for yywarn, which is used for âfoo found where operator expectedâ. The warning was just disappearing outside of an eval. qerror was treating PL_in_eval as a boolean, so we need to clear the flag we have just set, before we call it. ----------------------------------------------------------------------- Summary of changes: t/lib/croak/toke | 20 ++++++++++++++++++++ toke.c | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/t/lib/croak/toke b/t/lib/croak/toke index 2943c7b..2711c50 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -1,4 +1,24 @@ __END__ +# NAME foo found where operator expected +myfunc 1,2,3 +EXPECT +Number found where operator expected at - line 1, near "myfunc 1" + (Do you need to predeclare myfunc?) +syntax error at - line 1, near "myfunc 1" +Execution of - aborted due to compilation errors. +######## +# NAME foo found where operator expected (after strict error, w/fatal warnings) +use warnings FATAL => 'all'; +use strict; +$foo; +myfunc 1,2,3 +EXPECT +Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at - line 3. +Number found where operator expected at - line 4, near "myfunc 1" + (Do you need to predeclare myfunc?) +syntax error at - line 4, near "myfunc 1" +Execution of - aborted due to compilation errors. +######## # NAME Unterminated here-doc in string eval eval "<<foo"; die $@ EXPECT diff --git a/toke.c b/toke.c index d644d93..74dd1c1 100644 --- a/toke.c +++ b/toke.c @@ -10557,7 +10557,6 @@ S_yywarn(pTHX_ const char *const s, U32 flags) PL_in_eval |= EVAL_WARNONLY; yyerror_pv(s, flags); - PL_in_eval &= ~EVAL_WARNONLY; return 0; } @@ -10661,6 +10660,7 @@ Perl_yyerror_pvn(pTHX_ const char *const s, STRLEN len, U32 flags) PL_multi_end = 0; } if (PL_in_eval & EVAL_WARNONLY) { + PL_in_eval &= ~EVAL_WARNONLY; Perl_ck_warner_d(aTHX_ packWARN(WARN_SYNTAX), "%"SVf, SVfARG(msg)); } else -- Perl5 Master Repository