~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/scripts/checkconfig.pl

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #! /usr/bin/perl
  2 #
  3 # checkconfig: find uses of CONFIG_* names without matching definitions.
  4 # Copyright abandoned, 1998, Michael Elizabeth Chastain <mailto:mec@shout.net>.
  5 
  6 use integer;
  7 
  8 $| = 1;
  9 
 10 foreach $file (@ARGV)
 11 {
 12     # Open this file.
 13     open(FILE, $file) || die "Can't open $file: $!\n";
 14 
 15     # Initialize variables.
 16     my $fInComment   = 0;
 17     my $fUseConfig   = 0;
 18     my $iLinuxConfig = 0;
 19     my %configList   = ();
 20 
 21     LINE: while ( <FILE> )
 22     {
 23         # Strip comments.
 24         $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next);
 25         m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1)));
 26 
 27         # Pick up definitions.
 28         if ( m/^\s*#/o )
 29         {
 30             $iLinuxConfig      = $. if m/^\s*#\s*include\s*<linux\/config\.h>/o;
 31             $configList{uc $1} = 1  if m/^\s*#\s*include\s*<config\/(\S*)\.h>/o;
 32             $configList{$1}    = 1  if m/^\s*#\s*define\s+CONFIG_(\w*)/o;
 33             $configList{$1}    = 1  if m/^\s*#\s*undef\s+CONFIG_(\w*)/o;
 34         }
 35 
 36         # Look for usages.
 37         next unless m/CONFIG_/o;
 38         WORD: while ( m/\bCONFIG_(\w+)/og )
 39         {
 40             $fUseConfig = 1;
 41             last LINE if $iLinuxConfig;
 42             next WORD if exists $configList{$1};
 43             print "$file: $.: need CONFIG_$1.\n";
 44             $configList{$1} = 0;
 45         }
 46     }
 47 
 48     # Report superfluous includes.
 49     if ( $iLinuxConfig && ! $fUseConfig )
 50         { print "$file: $iLinuxConfig: <linux/config.h> not needed.\n"; }
 51 
 52     close(FILE);
 53 }

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.