From: Ján Tomko Date: Wed, 22 Jun 2016 20:27:43 +0000 (+0200) Subject: prohibit-duplicate-header: print file name and line X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=43d2b6f2aa59a79a1f2d4e4638c7a8142a6a9773;p=libvirt.git prohibit-duplicate-header: print file name and line This way :make syntax-check in ViM will point you at the offending line. --- diff --git a/build-aux/prohibit-duplicate-header.pl b/build-aux/prohibit-duplicate-header.pl index f9ab3f58a6..f0539aeca5 100644 --- a/build-aux/prohibit-duplicate-header.pl +++ b/build-aux/prohibit-duplicate-header.pl @@ -5,17 +5,21 @@ use strict; my $file = " "; my $ret = 0; my %includes = ( ); +my $lineno = 0; while (<>) { if (not $file eq $ARGV) { %includes = ( ); $file = $ARGV; + $lineno = 0; } + $lineno++; if (/^# *include *[<"]([^>"]*\.h)[">]/) { $includes{$1}++; if ($includes{$1} == 2) { $ret = 1; - print STDERR "$1 included multiple times in $ARGV\n"; + print STDERR "$ARGV:$lineno: $_"; + print STDERR "Do not include a header more than once per file\n"; } } }