From: Cheah Kok Cheong <thrust73@gmail.com>
To: mmarek@suse.com, linux-kernel@vger.kernel.org
Cc: Cheah Kok Cheong <thrust73@gmail.com>
Subject: [PATCH v2] scripts: checkincludes: add exit message for no duplicates found
Date: Wed, 21 Dec 2016 19:48:05 +0800 [thread overview]
Message-ID: <1482320885-4025-1-git-send-email-thrust73@gmail.com> (raw)
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
reply other threads:[~2016-12-21 11:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1482320885-4025-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;
as well as URLs for NNTP newsgroup(s).