[PATCHv2 2/2] prohibit-duplicate-header: print file name and line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This way :make syntax-check in ViM will point you at the offending line.
---
 build-aux/prohibit-duplicate-header.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/build-aux/prohibit-duplicate-header.pl b/build-aux/prohibit-duplicate-header.pl
index f9ab3f5..f0539ae 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";
         }
     }
 }
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]