Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1574826 > unrolled thread

[PATCH v2 RESEND] scripts: checkincludes: add exit message for no duplicates found

Started byCheah Kok Cheong <thrust73@gmail.com>
First post2017-02-06 15:30 +0100
Last post2017-02-06 15:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 RESEND] scripts: checkincludes: add exit message for no duplicates found Cheah Kok Cheong <thrust73@gmail.com> - 2017-02-06 15:30 +0100

#1574826 — [PATCH v2 RESEND] scripts: checkincludes: add exit message for no duplicates found

FromCheah Kok Cheong <thrust73@gmail.com>
Date2017-02-06 15:30 +0100
Subject[PATCH v2 RESEND] scripts: checkincludes: add exit message for no duplicates found
Message-ID<t7SsP-64V-31@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web