perl/perl-5.28.1-perl-133524-report-line-number-for-Prototype-not-ter.patch

53 lines
1.6 KiB
Diff

From f5972f38fbf06ff7db2ba869d0a5a4bc8e4c1e70 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
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ř <ppisar@redhat.com>
---
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
@@ -480,3 +480,9 @@ Bareword found where operator expected at - line 2, near "2p0"
(Missing operator before p0?)
syntax error at - line 2, near "2p0"
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