3 # checkconfig: find uses of CONFIG_* names without matching definitions.
4 # Copyright abandoned, 1998, Michael Elizabeth Chastain <mailto:mec@shout.net>.
13 open(FILE
, $file) || die "Can't open $file: $!\n";
15 # Initialize variables.
21 LINE
: while ( <FILE
> )
24 $fInComment && (s
+^.*?\
*/+ +o ?
($fInComment = 0) : next);
25 m
+/\*+o && (s+/\
*.*?\
*/+ +go, (s+/\
*.*$+ +o
&& ($fInComment = 1)));
27 # Pick up definitions.
30 $iLinuxConfig = $. if m/^#\s*include\s*<linux\/config\
.h
>/o
;
31 $configList{uc $1} = 1 if m/^#\s*include\s*<config\/(\S
*)\
.h
>/o
;
32 $configList{$1} = 1 if m/^#\s*define\s+CONFIG_(\w*)/o;
33 $configList{$1} = 1 if m/^#\s*undef\s+CONFIG_(\w*)/o;
37 next unless m/CONFIG_/o;
38 WORD
: while ( m/\bCONFIG_(\w+)/og )
41 last LINE
if $iLinuxConfig;
42 next WORD
if exists $configList{$1};
43 print "$file: $.: need CONFIG_$1.\n";
48 # Report superfluous includes.
49 if ( $iLinuxConfig && ! $fUseConfig )
50 { print "$file: $iLinuxConfig: <linux/config.h> not needed.\n"; }