summaryrefslogtreecommitdiff
path: root/check-module
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-08-29 11:57:17 +0000
committerJim Meyering <jim@meyering.net>2005-08-29 11:57:17 +0000
commitbe7bbbd5d2d8ac9408ee7ffc82ff9387cd9c3990 (patch)
tree8c2bc59733f4b2d856be1ef9b93f5de8c38cffb0 /check-module
parent656c6c9ca4c29d122166cd4f83248ed1ca121e37 (diff)
downloadgnulib-be7bbbd5d2d8ac9408ee7ffc82ff9387cd9c3990.tar.gz
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.
Diffstat (limited to 'check-module')
-rwxr-xr-xcheck-module78
1 files changed, 44 insertions, 34 deletions
diff --git a/check-module b/check-module
index 9bfa133133..9f028281a8 100755
--- a/check-module
+++ b/check-module
@@ -14,7 +14,7 @@ use strict;
use Getopt::Long;
#use Coda;
-(my $VERSION = '$Revision: 1.2 $ ') =~ tr/[0-9].//cd;
+(my $VERSION = '$Revision: 1.3 $ ') =~ tr/[0-9].//cd;
(my $ME = $0) =~ s|.*/||;
use constant ST_INIT => 1;
@@ -144,17 +144,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 +151,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 +200,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 +224,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;
}