diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-03 21:19:07 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-03 21:19:07 -0700 |
commit | de4861886737027203b44c1f5cf8851effa5bea2 (patch) | |
tree | dd0123a162e8e1c58e48436177993a29255bbdd7 /v4l/scripts | |
parent | 01dae6cd40b3b47dfd2b70868fca713fadb8eb31 (diff) | |
download | mediapointer-dvb-s2-de4861886737027203b44c1f5cf8851effa5bea2.tar.gz mediapointer-dvb-s2-de4861886737027203b44c1f5cf8851effa5bea2.tar.bz2 |
scripts: improve check_config_defines.pl
From: Trent Piepho <xyzzy@speakeasy.org>
If a kconfig option goes away in the v4l-dvb Kconfig files, but is still
present in the kernel Kconfig files, then v4l-dvb code using that option
would appear to be ok.
This is fixed by not reading the drivers/media Kconfig files from the kernel
source and merging the options defined there with those from the v4l-dvb
version. If a Kconfig file is read from v4l-dvb, the kernel version of that
file is not read.
Fix a regex bug that made #ifdef CONFIG_WHATEVER_MODULE appear to be missing
when WHATEVER did exist.
Check #ifndef too.
Get Kconfig options from menuconfig lines too.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-x | v4l/scripts/check_config_defines.pl | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/v4l/scripts/check_config_defines.pl b/v4l/scripts/check_config_defines.pl index 6d0256dcf..030fa155e 100755 --- a/v4l/scripts/check_config_defines.pl +++ b/v4l/scripts/check_config_defines.pl @@ -4,12 +4,14 @@ # Look for lines in C files like "#ifdef CONFIG_SOME_KCONF_VAR" and make # sure CONFIG_SOME_KCONF_VAR is something that exists. +use strict; + if($#ARGV < 0) { print "Usage: $0 kernel_dir [files to check ...]\n\n"; print "If no files are listed, checks all files from hg manifest\n"; exit; } -$kdir = shift; +my $kdir = shift; if($#ARGV < 0) { @ARGV = `hg manifest | cut "-d " -f3 | grep \\.[ch]\$`; @@ -17,19 +19,23 @@ if($#ARGV < 0) { chomp @ARGV; } +my %kconfigs; # List of Kconfig files read in already +my %vars; # List of defined variables sub readkconfig($$) { my $fn = "$_[0]/$_[1]"; - # Don't read the same kconfig file more than once - return if exists $kconfigs{$fn}; - $kconfigs{$fn} = 1; + # Don't read the same kconfig file more than once. This also means + # the drivers/media/Kconfig file from kernel won't be read in addition + # to the one from v4l-dvb. + return if exists $kconfigs{$_[1]}; + $kconfigs{$_[1]} = 1; # print "Reading $fn\n"; my $fh; open $fh, '<', "$fn" or die "Can't read Kconfig file $fn: $!"; while(<$fh>) { if (/^\s*source\s+"([^"]+)"\s*$/ || /^\s*source\s+(\S+)\s*$/) { readkconfig($_[0], $1); - } elsif(/^config\s+(\w+)$/) { + } elsif(/^(?:menu)?config\s+(\w+)$/) { $vars{"CONFIG_$1"}=1; } } @@ -44,19 +50,21 @@ foreach(glob "$kdir/arch/*/Kconfig") { } while(<>) { - if(/^\s*#ifdef\s+(CONFIG_\w+)(_MODULE)?\W*$/) { + if(/^\s*#ifn?def\s+(CONFIG_\w+?)(:?_MODULE)?\W*$/) { # print "Found $1\n"; print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1}); next; } if(/^\s*#if/) { $_ .= <> while(/\\$/); # Handle line continuations + my $last; while(/defined\(\s*(CONFIG_\w+?)(_MODULE)?\s*\)/) { - print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1}); $_ = $'; + next if($last eq $1); + $last = $1; + print "Unknown config $1 in $ARGV:$.\n" unless(exists $vars{$1}); } } - } continue { close ARGV if eof; } |