diff options
-rw-r--r-- | pp_ctl.c | 52 | ||||
-rw-r--r-- | t/lib/feature/bundle | 1 | ||||
-rw-r--r-- | t/lib/strict/vars | 5 | ||||
-rw-r--r-- | toke.c | 27 |
4 files changed, 44 insertions, 41 deletions
@@ -1656,27 +1656,53 @@ void Perl_qerror(pTHX_ SV *err) { PERL_ARGS_ASSERT_QERROR; - - if (PL_in_eval) { - if (PL_in_eval & EVAL_KEEPERR) { - Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "\t(in cleanup) %" SVf, - SVfARG(err)); + if (err!=NULL) { + if (PL_in_eval) { + if (PL_in_eval & EVAL_KEEPERR) { + Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "\t(in cleanup) %" SVf, + SVfARG(err)); + } + else { + sv_catsv(ERRSV, err); + } } + else if (PL_errors) + sv_catsv(PL_errors, err); else - sv_catsv(ERRSV, err); + Perl_warn(aTHX_ "%" SVf, SVfARG(err)); + + if (PL_parser) { + ++PL_parser->error_count; + } } - else if (PL_errors) - sv_catsv(PL_errors, err); - else - Perl_warn(aTHX_ "%" SVf, SVfARG(err)); - if (PL_parser) { - ++PL_parser->error_count; + if ( PL_parser && (err == NULL || + PL_parser->error_count >= PERL_STOP_PARSING_AFTER_N_ERRORS) + ) { + const char * const name = OutCopFILE(PL_curcop); + SV * errsv = NULL; + U8 raw_error_count = PERL_PARSE_ERROR_COUNT(PL_parser->error_count); + + if (PL_in_eval) { + errsv = ERRSV; + } + + if (err == NULL) { + abort_execution(errsv, name); + } + else + if (raw_error_count >= PERL_STOP_PARSING_AFTER_N_ERRORS) { + if (errsv) { + Perl_croak(aTHX_ "%" SVf "%s has too many errors.\n", + SVfARG(errsv), name); + } else { + Perl_croak(aTHX_ "%s has too many errors.\n", name); + } + } } } - /* pop a CXt_EVAL context and in addition, if it was a require then * based on action: * 0: do nothing extra; diff --git a/t/lib/feature/bundle b/t/lib/feature/bundle index ca4fe209aa..ef24bb953f 100644 --- a/t/lib/feature/bundle +++ b/t/lib/feature/bundle @@ -109,3 +109,4 @@ print $_||$@; EXPECT Number found where operator expected (Do you need to predeclare "evalbytes"?) at (eval 1) line 1, near "evalbytes 12345" syntax error at (eval 1) line 1, near "evalbytes 12345" +Execution of (eval 1) aborted due to compilation errors. diff --git a/t/lib/strict/vars b/t/lib/strict/vars index b571751b52..a4ed56360b 100644 --- a/t/lib/strict/vars +++ b/t/lib/strict/vars @@ -213,11 +213,6 @@ Global symbol "$m" requires explicit package name (did you forget to declare "my Global symbol "$d" requires explicit package name (did you forget to declare "my $d"?) at abc.pm line 6. Global symbol "$i" requires explicit package name (did you forget to declare "my $i"?) at abc.pm line 6. Global symbol "$n" requires explicit package name (did you forget to declare "my $n"?) at abc.pm line 6. -Global symbol "$e" requires explicit package name (did you forget to declare "my $e"?) at abc.pm line 7. -Global symbol "$j" requires explicit package name (did you forget to declare "my $j"?) at abc.pm line 7. -Global symbol "$o" requires explicit package name (did you forget to declare "my $o"?) at abc.pm line 7. -Global symbol "$p" requires explicit package name (did you forget to declare "my $p"?) at abc.pm line 8. -Illegal binary digit '2' at abc.pm line 8, at end of line abc.pm has too many errors. Compilation failed in require at - line 1. BEGIN failed--compilation aborted at - line 1. @@ -12929,30 +12929,11 @@ Perl_yyerror_pvn(pTHX_ const char *const s, STRLEN len, U32 flags) qerror(msg); } } - if ( s == NULL || - PL_error_count >= PERL_STOP_PARSING_AFTER_N_ERRORS - ) { - const char * const name = OutCopFILE(PL_curcop); - SV * errsv = NULL; - U8 raw_error_count = PERL_PARSE_ERROR_COUNT(PL_error_count); - - if (PL_in_eval) { - errsv = ERRSV; - } + /* if there was no message then this is a yyquit(), which is actualy handled + * by qerror() with a NULL argument */ + if (s == NULL) + qerror(NULL); - if (s == NULL) { - abort_execution(errsv, name); - } - else - if (raw_error_count >= PERL_STOP_PARSING_AFTER_N_ERRORS) { - if (errsv) { - Perl_croak(aTHX_ "%" SVf "%s has too many errors.\n", - SVfARG(errsv), name); - } else { - Perl_croak(aTHX_ "%s has too many errors.\n", name); - } - } - } PL_in_my = 0; PL_in_my_stash = NULL; return 0; |