From 0a9815ee8998b54c221d5a5772f6e5420df6b0e0a9b6525d14cbd828ca70ca7d Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 24 Feb 2015 21:31:40 +0000 Subject: [PATCH] Accepting request 287332 from home:namtrac:bugfix - Add multiple patches for gcc5 support, tracked by RT#123784 * perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch * perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch * perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch OBS-URL: https://build.opensuse.org/request/show/287332 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl?expand=0&rev=128 --- ...-Fix-Errno.pm-generation-for-gcc-5.0.patch | 71 +++++++++++++++++++ ...dling-of-hex-constants-for-the-pream.patch | 67 +++++++++++++++++ ...st-generated-t-_h2ph_pre.ph-instead-.patch | 39 ++++++++++ perl.changes | 8 +++ perl.spec | 6 ++ 5 files changed, 191 insertions(+) create mode 100644 perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch create mode 100644 perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch create mode 100644 perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch diff --git a/perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch b/perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch new file mode 100644 index 0000000..3474278 --- /dev/null +++ b/perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch @@ -0,0 +1,71 @@ +From 93d77ec43f0de26bc9ead97d204a680a902d59e1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +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ř +--- + 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 +@@ -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..1ae5728 --- /dev/null +++ b/perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch @@ -0,0 +1,67 @@ +From 3bea78d24634e630b610f59957e7a019205a67b2 Mon Sep 17 00:00:00 2001 +From: Tony Cook +Date: Mon, 16 Feb 2015 15:57:00 +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 + +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ř +--- + utils/h2ph.PL | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/utils/h2ph.PL b/utils/h2ph.PL +index 9a8b14d..d082f22 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,11 @@ 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 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"; + + foreach (sort keys %define) { + if ($opt_D) { +@@ -814,6 +819,18 @@ DEFINE + # integer: + print PREAMBLE + "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}) { +-- +2.1.0 + diff --git a/perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch b/perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch new file mode 100644 index 0000000..eebad67 --- /dev/null +++ b/perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch @@ -0,0 +1,39 @@ +From ae54661bfad51c56e0d5c01bace60d44513a77e2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +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ř +--- + 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 + diff --git a/perl.changes b/perl.changes index 09ff1d4..3049d3c 100644 --- a/perl.changes +++ b/perl.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Feb 23 13:13:16 UTC 2015 - idonmez@suse.com + +- Add multiple patches for gcc5 support, tracked by RT#123784 + * perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch + * perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch + * perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch + ------------------------------------------------------------------- Thu Feb 5 07:44:14 UTC 2015 - coolo@suse.com diff --git a/perl.spec b/perl.spec index c88a836..6ab3e50 100644 --- a/perl.spec +++ b/perl.spec @@ -40,6 +40,9 @@ Patch8: skip_time_hires.patch Patch9: perl-incfix.diff Patch11: perl-5.18.2-overflow.diff Patch12: DataDumper-no-infinite-recursion.diff +Patch13: perl-5.20.2-Fix-Errno.pm-generation-for-gcc-5.0.patch +Patch14: perl-5.21.8-h2ph-correct-handling-of-hex-constants-for-the-pream.patch +Patch15: perl-5.21.8-lib-h2ph.t-to-test-generated-t-_h2ph_pre.ph-instead-.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: perl-base = %version #PreReq: %fillup_prereq @@ -175,6 +178,9 @@ cp -p %{S:3} . %patch9 %patch11 %patch12 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 %build cp -a lib savelib