linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts: checkincludes: add exit message for no duplicates found
@ 2016-12-18 12:35 Cheah Kok Cheong
  2016-12-19 10:47 ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Cheah Kok Cheong @ 2016-12-18 12:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: mmarek, Cheah Kok Cheong

If no duplicates found, inform user.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
 scripts/checkincludes.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl
index 97b2c61..2bf234c 100755
--- a/scripts/checkincludes.pl
+++ b/scripts/checkincludes.pl
@@ -37,6 +37,13 @@ if ($#ARGV >= 1) {
 	}
 }
 
+my $dup_counter = 0;
+
+sub nodup_count {
+	++$dup_counter;
+	return;
+}
+
 foreach my $file (@ARGV) {
 	open(my $f, '<', $file)
 	    or die "Cannot open $file: $!.\n";
@@ -57,6 +64,7 @@ foreach my $file (@ARGV) {
 		foreach my $filename (keys %includedfiles) {
 			if ($includedfiles{$filename} > 1) {
 				print "$file: $filename is included more than once.\n";
+				nodup_count();
 			}
 		}
 		next;
@@ -73,6 +81,7 @@ foreach my $file (@ARGV) {
 					if ($includedfiles{$filename} > 1) {
 						$includedfiles{$filename}--;
 						$dups++;
+						nodup_count();
 					} else {
 						print {$f} $_;
 					}
@@ -87,3 +96,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] 3+ messages in thread

end of thread, other threads:[~2016-12-20  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-18 12:35 [PATCH] scripts: checkincludes: add exit message for no duplicates found Cheah Kok Cheong
2016-12-19 10:47 ` Michal Marek
2016-12-20  9:10   ` 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).