2005-07-11 Bruno Haible and Stepan Kasal * check-module: If more parameters are given, check each of them separately; add more exceptions, as noted by Jim Meyering. (check_module): New procedure. (%exempt_header): Now contains all exceptions. Index: check-module =================================================================== RCS file: /cvsroot/gnulib/gnulib/check-module,v retrieving revision 1.2 diff -u -r1.2 check-module --- check-module 28 Jun 2005 11:55:41 -0000 1.2 +++ check-module 11 Jul 2005 12:34:07 -0000 @@ -144,17 +144,6 @@ exists $inc{$line} && ! exists $special_non_dup{$line} and warn "$ME: $file: duplicate inclusion of $line\n"; - # Some known exceptions. - $file =~ /\bfull-write\.c$/ && $line eq 'full-read.h' - and next; - $file =~ /\bsafe-read.c$/ && $line eq 'safe-write.h' - and next; - $file =~ /\bhash\.c$/ && $line eq 'obstack.h' - and next; - $file =~ /\bfts\.c$/ && - ($line eq 'fts-cycle.c' || $line eq 'unistd-safer.h') - and next; - $inc{$line} = 1; } close FH; @@ -162,23 +151,40 @@ return \%inc; } -{ - GetOptions - ( - help => sub { usage 0 }, - version => sub { print "$ME version $VERSION\n"; exit }, - ) or usage 1; +my %exempt_header = + ( + # Exempt headers like unlocked-io.h that are `#include'd + # but not necessarily used. + 'unlocked-io.h' => 1, + + # Give gettext.h a free pass only when included from lib/error.c, + # since we've made that exception solely to make the error + # module easier to use -- at RMS's request. + 'lib/error.c:gettext.h' => 1, + + # The full-read module shares code with the full-write module. + 'lib/full-write.c:full-read.h' => 1, + + # The safe-write module shares code with the safe-read module. + 'lib/safe-read.c:safe-write.h' => 1, + + # The use of obstack.h in the hash module is conditional, off by default. + 'lib/hash.c:obstack.h' => 1, + + # The fts-lgpl module doesn't actually use fts-cycle.c and unistd-safer.h. + 'lib/fts.c:fts-cycle.c' => 1, + 'lib/fts.c:unistd-safer.h' => 1, + ); - @ARGV < 1 - and (warn "$ME: missing FILE argument\n"), usage 1; +sub check_module ($) +{ + my @m = @_; my %file; my %module_all_files; my %dep; my %seen_module; - my @m = $ARGV[0]; - while (@m) { my $m = pop @m; @@ -194,18 +200,6 @@ } } - my %exempt_header = - ( - # Exempt headers like unlocked-io.h that are `#include'd - # but not necessarily used. - 'unlocked-io.h' => 1, - - # Give gettext.h a free pass only when included from lib/error.c, - # since we've made that exception solely to make the error - # module easier to use -- at RMS's request. - 'lib/error.c:gettext.h' => 1, - ); - my @t = sort keys %module_all_files; # warn "ALL files: @t\n"; @@ -229,6 +223,22 @@ } #my @t = sort keys %$inc; #print "** $f: @t\n"; + } +} + +{ + GetOptions + ( + help => sub { usage 0 }, + version => sub { print "$ME version $VERSION\n"; exit }, + ) or usage 1; + + @ARGV < 1 + and (warn "$ME: missing FILE argument\n"), usage 1; + + foreach my $module (@ARGV) + { + check_module $module; } exit 0;