* [PATCH v2] scripts: checkincludes: add exit message for no duplicates found
@ 2016-12-21 11:48 Cheah Kok Cheong
0 siblings, 0 replies; only message in thread
From: Cheah Kok Cheong @ 2016-12-21 11:48 UTC (permalink / raw)
To: mmarek, linux-kernel; +Cc: Cheah Kok Cheong
If no duplicates found, inform user.
Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
Notes:
V2: Remove unnecessary subroutine - Michal
scripts/checkincludes.pl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl
index 97b2c61..381c018 100755
--- a/scripts/checkincludes.pl
+++ b/scripts/checkincludes.pl
@@ -37,6 +37,8 @@ if ($#ARGV >= 1) {
}
}
+my $dup_counter = 0;
+
foreach my $file (@ARGV) {
open(my $f, '<', $file)
or die "Cannot open $file: $!.\n";
@@ -57,6 +59,7 @@ foreach my $file (@ARGV) {
foreach my $filename (keys %includedfiles) {
if ($includedfiles{$filename} > 1) {
print "$file: $filename is included more than once.\n";
+ ++$dup_counter;
}
}
next;
@@ -73,6 +76,7 @@ foreach my $file (@ARGV) {
if ($includedfiles{$filename} > 1) {
$includedfiles{$filename}--;
$dups++;
+ ++$dup_counter;
} else {
print {$f} $_;
}
@@ -87,3 +91,7 @@ foreach my $file (@ARGV) {
}
close($f);
}
+
+if ($dup_counter == 0) {
+ print "No duplicate includes found.\n";
+}
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-21 11:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 11:48 [PATCH v2] scripts: checkincludes: add exit message for no duplicates found Cheah Kok Cheong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).