|
@@ -19,6 +19,7 @@
|
|
# 3) Check for leaked CONFIG_ symbols
|
|
# 3) Check for leaked CONFIG_ symbols
|
|
|
|
|
|
use strict;
|
|
use strict;
|
|
|
|
+use File::Basename;
|
|
|
|
|
|
my ($dir, $arch, @files) = @ARGV;
|
|
my ($dir, $arch, @files) = @ARGV;
|
|
|
|
|
|
@@ -99,6 +100,39 @@ sub check_asm_types
|
|
}
|
|
}
|
|
|
|
|
|
my $linux_types;
|
|
my $linux_types;
|
|
|
|
+my %import_stack = ();
|
|
|
|
+sub check_include_typesh
|
|
|
|
+{
|
|
|
|
+ my $path = $_[0];
|
|
|
|
+ my $import_path;
|
|
|
|
+
|
|
|
|
+ my $fh;
|
|
|
|
+ my @file_paths = ($path, $dir . "/" . $path, dirname($filename) . "/" . $path);
|
|
|
|
+ for my $possible ( @file_paths ) {
|
|
|
|
+ if (not $import_stack{$possible} and open($fh, '<', $possible)) {
|
|
|
|
+ $import_path = $possible;
|
|
|
|
+ $import_stack{$import_path} = 1;
|
|
|
|
+ last;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (eof $fh) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ my $line;
|
|
|
|
+ while ($line = <$fh>) {
|
|
|
|
+ if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) {
|
|
|
|
+ $linux_types = 1;
|
|
|
|
+ last;
|
|
|
|
+ }
|
|
|
|
+ if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
|
|
|
|
+ check_include_typesh($included);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ close $fh;
|
|
|
|
+ delete $import_stack{$import_path};
|
|
|
|
+}
|
|
|
|
+
|
|
sub check_sizetypes
|
|
sub check_sizetypes
|
|
{
|
|
{
|
|
if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
|
|
if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
|
|
@@ -113,6 +147,9 @@ sub check_sizetypes
|
|
$linux_types = 1;
|
|
$linux_types = 1;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
|
|
|
|
+ check_include_typesh($included);
|
|
|
|
+ }
|
|
if ($line =~ m/__[us](8|16|32|64)\b/) {
|
|
if ($line =~ m/__[us](8|16|32|64)\b/) {
|
|
printf STDERR "$filename:$lineno: " .
|
|
printf STDERR "$filename:$lineno: " .
|
|
"found __[us]{8,16,32,64} type " .
|
|
"found __[us]{8,16,32,64} type " .
|
|
@@ -122,4 +159,3 @@ sub check_sizetypes
|
|
#$ret = 1;
|
|
#$ret = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|