From f5972f38fbf06ff7db2ba869d0a5a4bc8e4c1e70 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Wed, 2 Jan 2019 11:20:34 +1100 Subject: [PATCH] report line number for Prototype not terminated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously COPLINE was updated (to the end of the file) before reporting the error, which wasn't useful. Petr Písař: Ported to 5.28.1 from upstream's 7122d783e33c1d4b9b5a037eef231fae4c2d76cd. Signed-off-by: Petr Písař --- t/lib/croak/toke | 6 ++++++ toke.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/t/lib/croak/toke b/t/lib/croak/toke index 1d45a3f..5ec90b9 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -489,3 +489,9 @@ =cut EXPECT syntax error at - line 4, next token ??? Execution of - aborted due to compilation errors. +######## +# NAME check Prototype not terminated includes line number (133524) +sub t1 {} +sub t2 (} +EXPECT +Prototype not terminated at - line 2. diff --git a/toke.c b/toke.c index fc87252..4d81810 100644 --- a/toke.c +++ b/toke.c @@ -8741,9 +8741,9 @@ Perl_yylex(pTHX) /* Look for a prototype */ if (*s == '(' && !is_sigsub) { s = scan_str(s,FALSE,FALSE,FALSE,NULL); - COPLINE_SET_FROM_MULTI_END; if (!s) Perl_croak(aTHX_ "Prototype not terminated"); + COPLINE_SET_FROM_MULTI_END; (void)validate_proto(PL_subname, PL_lex_stuff, ckWARN(WARN_ILLEGALPROTO), 0); have_proto = TRUE; -- 2.17.2