From bfb35cfda11d529f02c698e87ae298309a776305 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 10 Feb 2014 10:37:11 +0100 Subject: build-sys: add check-includes build target and script --- tools/check-includes.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 tools/check-includes.pl (limited to 'tools') diff --git a/tools/check-includes.pl b/tools/check-includes.pl new file mode 100755 index 0000000000..bf23929d47 --- /dev/null +++ b/tools/check-includes.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# +# checkincludes: Find files included more than once in (other) files. +# Copyright abandoned, 2000, Niels Kristian Bech Jensen . + +foreach $file (@ARGV) { + open(FILE, $file) or die "Cannot open $file: $!.\n"; + + my %includedfiles = (); + + while () { + if (m/^\s*#\s*include\s*[<"](\S*)[>"]/o) { + ++$includedfiles{$1}; + } + } + foreach $filename (keys %includedfiles) { + if ($includedfiles{$filename} > 1) { + print "$file: $filename is included more than once.\n"; + } + } + + close(FILE); +} -- cgit v1.2.3-54-g00ecf