From: Cheah Kok Cheong <thrust73@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: mmarek@suse.com, Cheah Kok Cheong <thrust73@gmail.com>
Subject: [PATCH] scripts: checkincludes: add exit message for no duplicates found
Date: Sun, 18 Dec 2016 20:35:19 +0800 [thread overview]
Message-ID: <1482064519-4352-1-git-send-email-thrust73@gmail.com> (raw)
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
next reply other threads:[~2016-12-18 12:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-18 12:35 Cheah Kok Cheong [this message]
2016-12-19 10:47 ` Michal Marek
2016-12-20 9:10 ` Cheah Kok Cheong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482064519-4352-1-git-send-email-thrust73@gmail.com \
--to=thrust73@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome