Improve h2ph fix for GCC 5.0
This commit is contained in:
parent
59e25a2163
commit
ff964ebffa
@ -1,18 +1,25 @@
|
|||||||
From 6b8383472e2f75b4bbbfe8d80f036c8a3ee6b439 Mon Sep 17 00:00:00 2001
|
From 3bea78d24634e630b610f59957e7a019205a67b2 Mon Sep 17 00:00:00 2001
|
||||||
From: Tony Cook <tony@develop-help.com>
|
From: Tony Cook <tony@develop-help.com>
|
||||||
Date: Thu, 12 Feb 2015 14:10:36 +1100
|
Date: Mon, 16 Feb 2015 15:57:00 +1100
|
||||||
Subject: [PATCH 2/2] h2ph: correct handling of hex constants for the preamble
|
Subject: [PATCH 2/2] h2ph: correct handling of hex constants for the preamble
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Previously they were treated as identifiers resulting in code
|
||||||
|
generated like C< &0xFFF >.
|
||||||
|
|
||||||
|
We also try to prevent compile-time warnings from large hex integers,
|
||||||
|
the user isn't responsible for the generated code, so we delay those
|
||||||
|
warnings to run-time.
|
||||||
|
|
||||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
---
|
---
|
||||||
utils/h2ph.PL | 6 ++++--
|
utils/h2ph.PL | 19 ++++++++++++++++++-
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/utils/h2ph.PL b/utils/h2ph.PL
|
diff --git a/utils/h2ph.PL b/utils/h2ph.PL
|
||||||
index 9a8b14d..c46d423 100644
|
index 9a8b14d..d082f22 100644
|
||||||
--- a/utils/h2ph.PL
|
--- a/utils/h2ph.PL
|
||||||
+++ b/utils/h2ph.PL
|
+++ b/utils/h2ph.PL
|
||||||
@@ -769,7 +769,7 @@ sub inc_dirs
|
@@ -769,7 +769,7 @@ sub inc_dirs
|
||||||
@ -24,24 +31,37 @@ index 9a8b14d..c46d423 100644
|
|||||||
my $preamble = "$Dest_dir/_h2ph_pre.ph";
|
my $preamble = "$Dest_dir/_h2ph_pre.ph";
|
||||||
|
|
||||||
# Can we skip building the preamble file?
|
# Can we skip building the preamble file?
|
||||||
@@ -788,6 +788,8 @@ sub build_preamble_if_necessary
|
@@ -788,6 +788,11 @@ sub build_preamble_if_necessary
|
||||||
|
|
||||||
open PREAMBLE, ">$preamble" or die "Cannot open $preamble: $!";
|
open PREAMBLE, ">$preamble" or die "Cannot open $preamble: $!";
|
||||||
print PREAMBLE "# This file was created by h2ph version $VERSION\n";
|
print PREAMBLE "# This file was created by h2ph version $VERSION\n";
|
||||||
+ # prevent large hex constants from warning
|
+ # Prevent non-portable hex constants from warning.
|
||||||
|
+ #
|
||||||
|
+ # We still produce an overflow warning if we can't represent
|
||||||
|
+ # a hex constant as an integer.
|
||||||
+ print PREAMBLE "no warnings qw(portable);\n";
|
+ print PREAMBLE "no warnings qw(portable);\n";
|
||||||
|
|
||||||
foreach (sort keys %define) {
|
foreach (sort keys %define) {
|
||||||
if ($opt_D) {
|
if ($opt_D) {
|
||||||
@@ -810,7 +812,7 @@ DEFINE
|
@@ -814,6 +819,18 @@ DEFINE
|
||||||
# float:
|
|
||||||
print PREAMBLE
|
|
||||||
"unless (defined &$_) { sub $_() { $1 } }\n\n";
|
|
||||||
- } elsif ($define{$_} =~ /^([+-]?\d+)U?L{0,2}$/i) {
|
|
||||||
+ } elsif ($define{$_} =~ /^([+-]?\d+|0x[\da-f]+)U?L{0,2}$/i) {
|
|
||||||
# integer:
|
# integer:
|
||||||
print PREAMBLE
|
print PREAMBLE
|
||||||
"unless (defined &$_) { sub $_() { $1 } }\n\n";
|
"unless (defined &$_) { sub $_() { $1 } }\n\n";
|
||||||
|
+ } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
|
||||||
|
+ # hex integer
|
||||||
|
+ # Special cased, since perl warns on hex integers
|
||||||
|
+ # that can't be represented in a UV.
|
||||||
|
+ #
|
||||||
|
+ # This way we get the warning at time of use, so the user
|
||||||
|
+ # only gets the warning if they happen to use this
|
||||||
|
+ # platform-specific definition.
|
||||||
|
+ my $code = $1;
|
||||||
|
+ $code = "hex('$code')" if length $code > 10;
|
||||||
|
+ print PREAMBLE
|
||||||
|
+ "unless (defined &$_) { sub $_() { $code } }\n\n";
|
||||||
|
} elsif ($define{$_} =~ /^\w+$/) {
|
||||||
|
my $def = $define{$_};
|
||||||
|
if ($isatype{$def}) {
|
||||||
--
|
--
|
||||||
1.9.3
|
2.1.0
|
||||||
|
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
From ae54661bfad51c56e0d5c01bace60d44513a77e2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||||
|
Date: Tue, 17 Feb 2015 13:11:00 +0100
|
||||||
|
Subject: [PATCH] lib/h2ph.t to test generated t/_h2ph_pre.ph instead of the
|
||||||
|
system one
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The lib/h2ph.t test executes a t/lib/h2ph.pht which requires
|
||||||
|
'_h2ph_pre.ph'. This should find and exercise generated t/_h2ph_pre.ph
|
||||||
|
file. However, it found a loaded _h2ph_pre.ph from system because the
|
||||||
|
interpreter has the './' directory after the system paths in the @INC by
|
||||||
|
default.
|
||||||
|
|
||||||
|
This patch adds '-I./' to the runperl() invocation to prefer the
|
||||||
|
_h2ph_pre.ph generated at build time.
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
lib/h2ph.t | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/h2ph.t b/lib/h2ph.t
|
||||||
|
index 2b58f6a..64d9dc0 100644
|
||||||
|
--- a/lib/h2ph.t
|
||||||
|
+++ b/lib/h2ph.t
|
||||||
|
@@ -48,7 +48,7 @@ $result = runperl( progfile => '_h2ph_pre.ph',
|
||||||
|
stderr => 1 );
|
||||||
|
like( $result, qr/syntax OK$/, "preamble compiles");
|
||||||
|
|
||||||
|
-$result = runperl( switches => ["-w"],
|
||||||
|
+$result = runperl( switches => ['-I.', "-w"],
|
||||||
|
stderr => 1,
|
||||||
|
prog => <<'PROG' );
|
||||||
|
$SIG{__WARN__} = sub { die $_[0] }; require q(lib/h2ph.pht);
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
14
perl.spec
14
perl.spec
@ -30,7 +30,7 @@
|
|||||||
Name: perl
|
Name: perl
|
||||||
Version: %{perl_version}
|
Version: %{perl_version}
|
||||||
# release number must be even higher, because dual-lived modules will be broken otherwise
|
# release number must be even higher, because dual-lived modules will be broken otherwise
|
||||||
Release: 318%{?dist}
|
Release: 319%{?dist}
|
||||||
Epoch: %{perl_epoch}
|
Epoch: %{perl_epoch}
|
||||||
Summary: Practical Extraction and Report Language
|
Summary: Practical Extraction and Report Language
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
@ -101,12 +101,15 @@ Patch27: perl-5.21.6-Report-inaccesible-file-on-failed-require.patch
|
|||||||
# RT#123338, in upstream after 5.21.6
|
# RT#123338, in upstream after 5.21.6
|
||||||
Patch28: perl-5.21.6-t-op-taint.t-Perform-SHA-256-algorithm-by-crypt-if-d.patch
|
Patch28: perl-5.21.6-t-op-taint.t-Perform-SHA-256-algorithm-by-crypt-if-d.patch
|
||||||
|
|
||||||
# Fix Errno.pm generation for GCC 5.0, RT#123784
|
# Fix Errno.pm generation for GCC 5.0, RT#123784, in upstream after 5.21.8
|
||||||
Patch29: perl-5.20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch
|
Patch29: perl-5.20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch
|
||||||
|
|
||||||
# Handle hexadecimal constants by h2ph, RT#123784
|
# Handle hexadecimal constants by h2ph, RT#123784, in upstream after 5.21.8
|
||||||
Patch30: perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch
|
Patch30: perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch
|
||||||
|
|
||||||
|
# Do not use -_h2ph_pre.ph from system at tests, RT#123784
|
||||||
|
Patch31: perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.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
|
||||||
|
|
||||||
@ -2021,6 +2024,7 @@ tarball from perl.org.
|
|||||||
%patch28 -p1
|
%patch28 -p1
|
||||||
%patch29 -p1
|
%patch29 -p1
|
||||||
%patch30 -p1
|
%patch30 -p1
|
||||||
|
%patch31 -p1
|
||||||
%patch200 -p1
|
%patch200 -p1
|
||||||
%patch201 -p1
|
%patch201 -p1
|
||||||
|
|
||||||
@ -2044,6 +2048,7 @@ perl -x patchlevel.h \
|
|||||||
'Fedora Patch28: Use stronger algorithm needed for FIPS in t/op/taint.t (RT#123338)' \
|
'Fedora Patch28: Use stronger algorithm needed for FIPS in t/op/taint.t (RT#123338)' \
|
||||||
'Fedora Patch29: Fix Errno.pm generation for GCC 5.0 (RT#123784)' \
|
'Fedora Patch29: Fix Errno.pm generation for GCC 5.0 (RT#123784)' \
|
||||||
'Fedora Patch30: Handle hexadecimal constants by h2ph (RT#123784)' \
|
'Fedora Patch30: Handle hexadecimal constants by h2ph (RT#123784)' \
|
||||||
|
'Fedora Patch31: Do not use -_h2ph_pre.ph from system at tests (RT#123784)' \
|
||||||
'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}
|
||||||
@ -3848,6 +3853,9 @@ sed \
|
|||||||
|
|
||||||
# Old changelog entries are preserved in CVS.
|
# Old changelog entries are preserved in CVS.
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 16 2015 Petr Pisar <ppisar@redhat.com> - 4:5.20.1-319
|
||||||
|
- Improve h2ph fix for GCC 5.0
|
||||||
|
|
||||||
* Thu Feb 12 2015 Petr Pisar <ppisar@redhat.com> - 4:5.20.1-318
|
* Thu Feb 12 2015 Petr Pisar <ppisar@redhat.com> - 4:5.20.1-318
|
||||||
- Fix regressions with GCC 5.0
|
- Fix regressions with GCC 5.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user