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