In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/594b6face91a40f19765cb90d794c3b9a877497a?hp=9c958f0531818283414573ebe1565e211e614eb7>
- Log ----------------------------------------------------------------- commit 594b6face91a40f19765cb90d794c3b9a877497a Author: Lukas Mai <[email protected]> Date: Sun Oct 12 19:01:09 2014 +0200 treat fatal warnings after syntax errors as syntax errors ----------------------------------------------------------------------- Summary of changes: t/lib/warnings/7fatal | 13 +++++++++++++ util.c | 9 +++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/t/lib/warnings/7fatal b/t/lib/warnings/7fatal index aab7fd1..87f3fd0 100644 --- a/t/lib/warnings/7fatal +++ b/t/lib/warnings/7fatal @@ -535,3 +535,16 @@ print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 10. The End. +######## + +# fatal warnings shouldn't hide parse errors [perl #122966] +use warnings FATAL => 'all'; +if (1 { + my $x = "hello"; + print $x, "\n"; +} +EXPECT +syntax error at - line 4, near "1 {" +"my" variable $x masks earlier declaration in same statement at - line 6. +syntax error at - line 7, near "}" +Execution of - aborted due to compilation errors. diff --git a/util.c b/util.c index ae3b833..add8f1d 100644 --- a/util.c +++ b/util.c @@ -1914,8 +1914,13 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args) if (PL_warnhook == PERL_WARNHOOK_FATAL || ckDEAD(err)) { SV * const msv = vmess(pat, args); - invoke_exception_hook(msv, FALSE); - die_unwind(msv); + if (PL_parser && PL_parser->error_count) { + qerror(msv); + } + else { + invoke_exception_hook(msv, FALSE); + die_unwind(msv); + } } else { Perl_vwarn(aTHX_ pat, args); -- Perl5 Master Repository
