Fix reporting a line number for non-terminated prototypes

This commit is contained in:
Petr Písař 2019-01-14 17:20:16 +01:00
parent ba7b23759d
commit 634fb4080c
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,52 @@
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

View File

@ -224,6 +224,10 @@ Patch41: perl-5.29.5-Avoid-Use-of-uninitialized-value-res-in-numeric-eq-w
Patch42: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec.patch Patch42: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec.patch
Patch43: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec-2.patch Patch43: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec-2.patch
# Fix reporting a line number for non-terminated prototypes, RT#133524,
# in upstream after 5.29.6
Patch44: perl-5.28.1-perl-133524-report-line-number-for-Prototype-not-ter.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2821,6 +2825,7 @@ Perl extension for Version Objects
%patch41 -p1 %patch41 -p1
%patch42 -p1 %patch42 -p1
%patch43 -p1 %patch43 -p1
%patch44 -p1
%patch200 -p1 %patch200 -p1
%patch201 -p1 %patch201 -p1
@ -2859,6 +2864,7 @@ perl -x patchlevel.h \
'Fedora Patch38: Fix compiling regular expressions that contain both compile- and run-time compiled code blocks (RT#133687)' \ 'Fedora Patch38: Fix compiling regular expressions that contain both compile- and run-time compiled code blocks (RT#133687)' \
'Fedora Patch39: Adjust tests to gdbm-1.15 (RT#133295)' \ 'Fedora Patch39: Adjust tests to gdbm-1.15 (RT#133295)' \
'Fedora Patch42: Do not close an IPC pipe that already has a desired descriptor (RT#133726)' \ 'Fedora Patch42: Do not close an IPC pipe that already has a desired descriptor (RT#133726)' \
'Fedora Patch44: Fix reporting a line number for non-terminated prototypes (RT#133524)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ 'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil} %{nil}
@ -5150,6 +5156,7 @@ popd
* Mon Jan 14 2019 Petr Pisar <ppisar@redhat.com> - 4:5.28.1-430 * Mon Jan 14 2019 Petr Pisar <ppisar@redhat.com> - 4:5.28.1-430
- Adjust tests to gdbm-1.15 using an upstream fix (RT#133295) - Adjust tests to gdbm-1.15 using an upstream fix (RT#133295)
- Do not close an IPC pipe that already has a desired descriptor (RT#133726) - Do not close an IPC pipe that already has a desired descriptor (RT#133726)
- Fix reporting a line number for non-terminated prototypes (RT#133524)
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-429 * Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-429
- Rebuilt for libcrypt.so.2 (#1666033) - Rebuilt for libcrypt.so.2 (#1666033)