From: Steve Hay Date: Thu, 30 Jun 2005 07:57:25 +0000 (+0000) Subject: Silence MinGW warnings about system headers when building Errno X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e92bf58d9ca015d8f610db7bf0ee9de90ff39ff;p=p5sagit%2Fp5-mst-13.2.git Silence MinGW warnings about system headers when building Errno Thanks to Mike Guy for the suggested fix. p4raw-id: //depot/perl@25014 --- diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL index 5c76d89..bd87f62 100644 --- a/ext/Errno/Errno_pm.PL +++ b/ext/Errno/Errno_pm.PL @@ -16,8 +16,24 @@ unlink "Errno.pm" if -f "Errno.pm"; open OUT, ">Errno.pm" or die "Cannot open Errno.pm: $!"; select OUT; my $file; -foreach $file (get_files()) { - process_file($file); +my @files = get_files(); +if ($Config{gccversion} ne '' && $^O eq 'MSWin32') { + # MinGW complains "warning: #pragma system_header ignored outside include + # file" if the header files are processed individually, so include them + # all in .c file and process that instead. + open INCS, '>includes.c' or + die "Cannot open includes.c"; + foreach $file (@files) { + print INCS qq[#include "$file"\n]; + } + close INCS; + process_file('includes.c'); + unlink 'includes.c'; +} +else { + foreach $file (@files) { + process_file($file); + } } write_errno_pm(); unlink "errno.c" if -f "errno.c"; @@ -178,6 +194,8 @@ sub get_files { if (/$pat/o) { my $f = $1; $f =~ s,\\\\,/,g; + next if $f eq 'errno.c'; + next unless -f $f; $file{$f} = 1; } }