[perl] Fix regressions with GCC 5.0

Petr Pisar ppisar at fedoraproject.org
Thu Feb 12 09:18:09 UTC 2015


commit 59e25a21638574fd097336f46de7a6b88696d2b7
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Feb 12 09:37:39 2015 +0100

    Fix regressions with GCC 5.0
    
    Upstream proposed different fix for the Errno by modifying global CPP
    flags. I think this an overkill preventing people from using the new
    GCC features. So I roll in now the fix local to the Errno module for
    now.

 ....20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch |   80 ++++++++++++++++++++
 ...t-handling-of-hex-constants-for-the-pream.patch |   47 ++++++++++++
 perl.spec                                          |   15 ++++-
 3 files changed, 141 insertions(+), 1 deletions(-)
---
diff --git a/perl-5.20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch b/perl-5.20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch
new file mode 100644
index 0000000..c800bf8
--- /dev/null
+++ b/perl-5.20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch
@@ -0,0 +1,80 @@
+From 93d77ec43f0de26bc9ead97d204a680a902d59e1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Wed, 11 Feb 2015 15:46:37 +0100
+Subject: [PATCH] Fix Errno.pm generation for gcc-5.0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+gcc-5.0 -E interleaves now line numbers with expended macros, so that
+the generated errno.c will be preprocessed to
+
+EBFONT => [[
+           59
+                ]]
+
+which is hard to parse in in line-based reader.
+
+So use -P option with gcc >= 5.0. Global -P usage would break makedepend,
+global -ftrack-macro-expansion=0 would break lib/h2ph.t.
+
+RT#123784
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ ext/Errno/Errno_pm.PL | 23 +++++++++++++++++------
+ 1 file changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 55ad01a..63b5916 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
+ use Config;
+ use strict;
+ 
+-our $VERSION = "1.20_03";
++our $VERSION = "1.20_04";
+ 
+ my %err = ();
+ 
+@@ -225,20 +225,31 @@ sub write_errno_pm {
+     {	# BeOS (support now removed) did not enter this block
+     # invoke CPP and read the output
+ 
++	my $inhibit_linemarkers = '';
++	if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
++	    # GCC 5.0 interleaves expanded macros with line numbers breaking
++	    # each line into multiple lines. RT#123784
++	    $inhibit_linemarkers = ' -P';
++	}
++
+ 	if ($^O eq 'VMS') {
+-	    my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
++	    my $cpp = "$Config{cppstdin} $Config{cppflags}" .
++		$inhibit_linemarkers . " $Config{cppminus}";
+ 	    $cpp =~ s/sys\$input//i;
+ 	    open(CPPO,"$cpp  errno.c |") or
+ 		die "Cannot exec $Config{cppstdin}";
+ 	} elsif ($IsMSWin32 || $^O eq 'NetWare') {
+-	    open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
+-		die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
++	    my $cpp = "$Config{cpprun} $Config{cppflags}" .
++		$inhibit_linemarkers;
++	    open(CPPO,"$cpp errno.c |") or
++		die "Cannot run '$cpp errno.c'";
+ 	} elsif ($IsSymbian) {
+-            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
++            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
++		$inhibit_linemarkers ." -";
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+         } else {
+-	    my $cpp = default_cpp();
++	    my $cpp = default_cpp() . $inhibit_linemarkers;
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+ 	}
+-- 
+1.9.3
+
diff --git a/perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch b/perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch
new file mode 100644
index 0000000..00cda19
--- /dev/null
+++ b/perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch
@@ -0,0 +1,47 @@
+From 6b8383472e2f75b4bbbfe8d80f036c8a3ee6b439 Mon Sep 17 00:00:00 2001
+From: Tony Cook <tony at develop-help.com>
+Date: Thu, 12 Feb 2015 14:10:36 +1100
+Subject: [PATCH 2/2] h2ph: correct handling of hex constants for the preamble
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ utils/h2ph.PL | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/utils/h2ph.PL b/utils/h2ph.PL
+index 9a8b14d..c46d423 100644
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -769,7 +769,7 @@ sub inc_dirs
+ sub build_preamble_if_necessary
+ {
+     # Increment $VERSION every time this function is modified:
+-    my $VERSION     = 3;
++    my $VERSION     = 4;
+     my $preamble    = "$Dest_dir/_h2ph_pre.ph";
+ 
+     # Can we skip building the preamble file?
+@@ -788,6 +788,8 @@ sub build_preamble_if_necessary
+ 
+     open  PREAMBLE, ">$preamble" or die "Cannot open $preamble:  $!";
+ 	print PREAMBLE "# This file was created by h2ph version $VERSION\n";
++        # prevent large hex constants from warning
++        print PREAMBLE "no warnings qw(portable);\n";
+ 
+ 	foreach (sort keys %define) {
+ 	    if ($opt_D) {
+@@ -810,7 +812,7 @@ 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:
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
+-- 
+1.9.3
+
diff --git a/perl.spec b/perl.spec
index acd15e3..689611a 100644
--- a/perl.spec
+++ b/perl.spec
@@ -30,7 +30,7 @@
 Name:           perl
 Version:        %{perl_version}
 # release number must be even higher, because dual-lived modules will be broken otherwise
-Release:        317%{?dist}
+Release:        318%{?dist}
 Epoch:          %{perl_epoch}
 Summary:        Practical Extraction and Report Language
 Group:          Development/Languages
@@ -101,6 +101,12 @@ Patch27:        perl-5.21.6-Report-inaccesible-file-on-failed-require.patch
 # 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
 
+# Fix Errno.pm generation for GCC 5.0, RT#123784
+Patch29:        perl-5.20.1-Fix-Errno.pm-generation-for-gcc-5.0.patch
+
+# Handle hexadecimal constants by h2ph, RT#123784
+Patch30:        perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch
+
 # 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
 
@@ -2013,6 +2019,8 @@ tarball from perl.org.
 %patch26 -p1
 %patch27 -p1
 %patch28 -p1
+%patch29 -p1
+%patch30 -p1
 %patch200 -p1
 %patch201 -p1
 
@@ -2034,6 +2042,8 @@ perl -x patchlevel.h \
     'Fedora Patch26: Make *DBM_File desctructors thread-safe (RT#61912)' \
     'Fedora Patch27: Report inaccesible file on failed require (RT#123270)' \
     '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 Patch30: Handle hexadecimal constants by h2ph (RT#123784)' \
     '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' \
     %{nil}
@@ -3838,6 +3848,9 @@ sed \
 
 # Old changelog entries are preserved in CVS.
 %changelog
+* Thu Feb 12 2015 Petr Pisar <ppisar at redhat.com> - 4:5.20.1-318
+- Fix regressions with GCC 5.0
+
 * Tue Feb 03 2015 Jitka Plesnikova <jplesnik at redhat.com> - 4:5.20.1-317
 - Sub-package inc-latest module
 



More information about the perl-devel mailing list