2017-09-18 12:35:50 +00:00
|
|
|
#!/usr/bin/env perl
|
2016-06-15 16:01:24 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my $file = " ";
|
|
|
|
my $ret = 0;
|
|
|
|
my %includes = ( );
|
2016-06-22 20:27:43 +00:00
|
|
|
my $lineno = 0;
|
2016-06-15 16:01:24 +00:00
|
|
|
|
|
|
|
while (<>) {
|
|
|
|
if (not $file eq $ARGV) {
|
|
|
|
%includes = ( );
|
|
|
|
$file = $ARGV;
|
2016-06-22 20:27:43 +00:00
|
|
|
$lineno = 0;
|
2016-06-15 16:01:24 +00:00
|
|
|
}
|
2016-06-22 20:27:43 +00:00
|
|
|
$lineno++;
|
2016-06-15 16:01:24 +00:00
|
|
|
if (/^# *include *[<"]([^>"]*\.h)[">]/) {
|
|
|
|
$includes{$1}++;
|
|
|
|
if ($includes{$1} == 2) {
|
|
|
|
$ret = 1;
|
2016-06-22 20:27:43 +00:00
|
|
|
print STDERR "$ARGV:$lineno: $_";
|
|
|
|
print STDERR "Do not include a header more than once per file\n";
|
2016-06-15 16:01:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exit $ret;
|