Skip to content

Commit 816b056

Browse files
ppisartonycoz
authored andcommitted
Fix Errno.pm generation for gcc-5.0
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
1 parent 5bd81aa commit 816b056

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

ext/Errno/Errno_pm.PL

+17-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
22
use Config;
33
use strict;
44

5-
our $VERSION = "1.22";
5+
our $VERSION = "1.23";
66

77
my %err = ();
88

@@ -215,20 +215,31 @@ sub write_errno_pm {
215215
{ # BeOS (support now removed) did not enter this block
216216
# invoke CPP and read the output
217217

218+
my $inhibit_linemarkers = '';
219+
if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
220+
# GCC 5.0 interleaves expanded macros with line numbers breaking
221+
# each line into multiple lines. RT#123784
222+
$inhibit_linemarkers = ' -P';
223+
}
224+
218225
if ($^O eq 'VMS') {
219-
my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
226+
my $cpp = "$Config{cppstdin} $Config{cppflags}" .
227+
$inhibit_linemarkers . " $Config{cppminus}";
220228
$cpp =~ s/sys\$input//i;
221229
open(CPPO,"$cpp errno.c |") or
222230
die "Cannot exec $Config{cppstdin}";
223231
} elsif ($IsMSWin32 || $^O eq 'NetWare') {
224-
open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
225-
die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
232+
my $cpp = "$Config{cpprun} $Config{cppflags}" .
233+
$inhibit_linemarkers;
234+
open(CPPO,"$cpp errno.c |") or
235+
die "Cannot run '$cpp errno.c'";
226236
} elsif ($IsSymbian) {
227-
my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
237+
my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
238+
$inhibit_linemarkers ." -";
228239
open(CPPO,"$cpp < errno.c |")
229240
or die "Cannot exec $cpp";
230241
} else {
231-
my $cpp = default_cpp();
242+
my $cpp = default_cpp() . $inhibit_linemarkers;
232243
open(CPPO,"$cpp < errno.c |")
233244
or die "Cannot exec $cpp";
234245
}

0 commit comments

Comments
 (0)