@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
22use Config;
33use strict;
44
5- our $VERSION = " 1.36 " ;
5+ our $VERSION = " 1.37 " ;
66
77my %err = ();
88
@@ -18,18 +18,11 @@ if ($Config{gccversion} ne '' && $^O eq 'MSWin32') {
1818 # MinGW complains "warning: #pragma system_header ignored outside include
1919 # file" if the header files are processed individually, so include them
2020 # all in .c file and process that instead.
21- my %seen ;
2221 open INCS, ' >' , ' includes.c' or
2322 die " Cannot open includes.c" ;
2423 foreach $file (@files ) {
2524 next if $file eq ' errno.c' ;
2625 next unless -f $file ;
27- if ( $file eq ' avx512vpopcntdqvlintrin.h' || $file eq ' avx512bwintrin.h' ) {
28- # "Never use <avx512bwintrin.h> directly; include <immintrin.h> instead."
29- # "Never use <avx512vpopcntdqvlintrin.h> directly; include <immintrin.h> instead."
30- $file = ' immintrin.h' ;
31- }
32- next if ++$seen {$file } > 1;
3326 print INCS qq[ #include "$file "\n ] ;
3427 }
3528 close INCS;
@@ -114,7 +107,7 @@ sub default_cpp {
114107}
115108
116109sub get_files {
117- my % file = () ;
110+ my @ file ;
118111 # When cross-compiling we may store a path for gcc's "sysroot" option:
119112 my $sysroot = $Config {sysroot } || ' ' ;
120113 my $linux_errno_h ;
@@ -128,34 +121,34 @@ sub get_files {
128121
129122 # VMS keeps its include files in system libraries
130123 if ($^O eq ' VMS' ) {
131- $ file{ ' Sys$Library:DECC$RTLDEF.TLB' } = 1 ;
124+ push ( @ file, ' Sys$Library:DECC$RTLDEF.TLB' ) ;
132125 } elsif ($^O eq ' os390' ) {
133126 # OS/390 C compiler doesn't generate #file or #line directives
134127 # and it does not tag the header as 1047 (EBCDIC), so make a local
135128 # copy and tag it
136129 my $cp = ` cp /usr/include/errno.h ./errno.h` ;
137130 my $chtag = ` chtag -t -cIBM-1047 ./errno.h` ;
138- $ file{ ' ./errno.h' } = 1 ;
131+ push ( @ file, ' ./errno.h' ) ;
139132 } elsif ($Config {archname } eq ' arm-riscos' ) {
140133 # Watch out for cross compiling for RISC OS
141134 my $dep = ` echo "#include <errno.h>" | gcc -E -M -` ;
142135 if ($dep =~ / (\S +errno\. h)/ ) {
143- $ file{ $1 } = 1 ;
136+ push ( @ file, $1 ) ;
144137 }
145138 } elsif ($^O eq ' linux' &&
146139 $Config {gccversion } ne ' ' &&
147140 $Config {gccversion } !~ / intel/i &&
148141 # might be using, say, Intel's icc
149142 $linux_errno_h
150143 ) {
151- $ file{ $linux_errno_h } = 1 ;
144+ push ( @ file, $linux_errno_h ) ;
152145 } elsif ($^O eq ' haiku' ) {
153146 # hidden in a special place
154- $ file{ ' /boot/system/develop/headers/posix/errno.h' } = 1 ;
147+ push ( @ file, ' /boot/system/develop/headers/posix/errno.h' ) ;
155148
156149 } elsif ($^O eq ' vos' ) {
157150 # avoid problem where cpp returns non-POSIX pathnames
158- $ file{ ' /system/include_library/errno.h' } = 1 ;
151+ push ( @ file, ' /system/include_library/errno.h' ) ;
159152 } else {
160153 open (CPPI, ' >' , ' errno.c' ) or
161154 die " Cannot open errno.c" ;
@@ -183,16 +176,28 @@ sub get_files {
183176 if (/ $pat /o ) {
184177 my $f = $1 ;
185178 $f =~ s ,\\\\,/,g;
186- $ file{ $f } = 1 ;
179+ push ( @ file, $f ) ;
187180 }
188181 }
189182 else {
190- $ file{ $1 } = 1 if / $pat /o ;
183+ push ( @ file, $1 ) if / $pat /o ;
191184 }
192185 }
193186 close (CPPO);
194187 }
195- return keys %file ;
188+ return uniq(@file );
189+ }
190+
191+ #
192+ #
193+ sub uniq
194+ {
195+ # At this point List::Util::uniq appears not to be usable so
196+ # roll our own.
197+ #
198+ # Returns a list with unique values, while keeping the order
199+ #
200+ return do { my %seen ; grep { !$seen {$_ }++ } @_ };
196201}
197202
198203sub write_errno_pm {
364369
365370 if ($IsMSWin32 ) {
366371 print " WINSOCK => [qw(\n " ;
367- $k = join (" " , grep { / ^WSAE/ } keys %err );
372+ $k = join (" " , grep { / ^WSAE/ } sort keys %err );
368373 $k =~ s / (.{50,70})\s / $1 \n\t / g ;
369374 print " \t " ,$k ," \n )],\n " ;
370375 }
0 commit comments