From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753775AbdBFO2m (ORCPT ); Mon, 6 Feb 2017 09:28:42 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36098 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbdBFO2l (ORCPT ); Mon, 6 Feb 2017 09:28:41 -0500 From: Cheah Kok Cheong To: linux-kernel@vger.kernel.org, mmarek@suse.com, mcgrof@gmail.com, akpm@linux-foundation.org Cc: Cheah Kok Cheong Subject: [PATCH v2 RESEND] scripts: checkincludes: add exit message for no duplicates found Date: Mon, 6 Feb 2017 22:27:55 +0800 Message-Id: <1486391275-2843-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 If no duplicates found, inform user. Signed-off-by: Cheah Kok Cheong --- 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