diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-30 18:15:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-30 18:15:43 -0700 |
commit | 923f79743c76583ed4684e2c80c8da51a7268af3 (patch) | |
tree | e523a04c6b4cdddf70cf4adec25fa4fbbdbc5f5a /scripts/headers_check.pl | |
parent | a7697b945e6e5025f184d6762e7285f1c498411d (diff) | |
parent | 7f3bd6c9cb8e9fa2b57bfa860cd3e734a28f48ed (diff) | |
download | linux-923f79743c76583ed4684e2c80c8da51a7268af3.tar.gz linux-923f79743c76583ed4684e2c80c8da51a7268af3.tar.bz2 linux-923f79743c76583ed4684e2c80c8da51a7268af3.zip |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild changes from Michal Marek:
- Unification of cmd_uimage among archs that use it
- make headers_check tries harder before reporting a missing
<linux/types.h> include
- kbuild portability fix for shells that do not support echo -e
- make clean descends into samples/
- setlocalversion grep fix
- modpost typo fix
- dtc warnings fix
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
setlocalversion: Use "grep -q" instead of piping output to "read dummy"
modpost: fix ALL_INIT_DATA_SECTIONS
Kbuild: centralize MKIMAGE and cmd_uimage definitions
headers_check: recursively search for linux/types.h inclusion
scripts/Kbuild.include: Fix portability problem of "echo -e"
scripts: dtc: fix compile warnings
kbuild: clean up samples directory
kbuild: disable -Wmissing-field-initializers for W=1
Diffstat (limited to 'scripts/headers_check.pl')
-rw-r--r-- | scripts/headers_check.pl | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 7957e7a5166a..64ac2380e4d5 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -19,6 +19,7 @@ # 3) Check for leaked CONFIG_ symbols use strict; +use File::Basename; my ($dir, $arch, @files) = @ARGV; @@ -99,6 +100,39 @@ sub check_asm_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 { if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { @@ -113,6 +147,9 @@ sub check_sizetypes $linux_types = 1; return; } + if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { + check_include_typesh($included); + } if ($line =~ m/__[us](8|16|32|64)\b/) { printf STDERR "$filename:$lineno: " . "found __[us]{8,16,32,64} type " . @@ -122,4 +159,3 @@ sub check_sizetypes #$ret = 1; } } - |