X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=check-module;h=026e41e10ece36d869cea13ccbdde92e1a65e917;hb=45a14d0fe450d6b70c404cc9ae6aca4f31054896;hp=9bfa133133edb0ce0daa7117cd789a0faca113fe;hpb=2ef643a4f33ad334090ad5b23f542997f9c4b3c2;p=gnulib.git diff --git a/check-module b/check-module index 9bfa13313..026e41e10 100755 --- a/check-module +++ b/check-module @@ -10,11 +10,18 @@ # Written by Jim Meyering +# FIXME: +# for each .m4 file listed in the Files: section(s) +# parse it for AC_LIBSOURCES directives, and accumulate the set +# of files `required' via all AC_LIBSOURCES. +# If this set is not empty, ensure that it contains +# the same (.c and .h only?) files as are listed in the Files: sections. + use strict; use Getopt::Long; #use Coda; -(my $VERSION = '$Revision: 1.2 $ ') =~ tr/[0-9].//cd; +(my $VERSION = '$Revision: 1.4 $ ') =~ tr/[0-9].//cd; (my $ME = $0) =~ s|.*/||; use constant ST_INIT => 1; @@ -144,17 +151,6 @@ sub find_included_lib_files ($) 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 +158,40 @@ sub find_included_lib_files ($) 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, - @ARGV < 1 - and (warn "$ME: missing FILE argument\n"), usage 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, + ); + +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 +207,6 @@ sub find_included_lib_files ($) } } - 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"; @@ -230,6 +231,22 @@ sub find_included_lib_files ($) #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; }