Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932764AbcLRMgQ (ORCPT ); Sun, 18 Dec 2016 07:36:16 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34955 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932260AbcLRMgO (ORCPT ); Sun, 18 Dec 2016 07:36:14 -0500 From: Cheah Kok Cheong To: linux-kernel@vger.kernel.org Cc: mmarek@suse.com, Cheah Kok Cheong Subject: [PATCH] scripts: checkincludes: add exit message for no duplicates found Date: Sun, 18 Dec 2016 20:35:19 +0800 Message-Id: <1482064519-4352-1-git-send-email-thrust73@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1140 Lines: 51 If no duplicates found, inform user. Signed-off-by: Cheah Kok Cheong --- 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