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