From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965262AbbEMMhZ (ORCPT ); Wed, 13 May 2015 08:37:25 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:23498 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965125AbbEMMhY (ORCPT ); Wed, 13 May 2015 08:37:24 -0400 Date: Wed, 13 May 2015 15:37:12 +0300 From: Dan Carpenter To: Andy Whitcroft Cc: Joe Perches , linux-kernel@vger.kernel.org Subject: [patch v2] checkpatch: complain about GW-BASIC style label names Message-ID: <20150513123712.GA2798@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431029858.18597.35.camel@perches.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GW-BASIC style label names are annoying so we can warn about that in checkpatch. The warnings look like: WARNING: 'fail2' isn't informative - prefer descriptive label names #267: FILE: ./sound/ppc/beep.c:267: + fail2: snd_ctl_remove(chip->card, beep_ctl); This generates slightly under 2000 new warnings. None of them are false positives. Signed-off-by: Dan Carpenter --- v2: I don't want to warn about gotos... diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 89b1df4..c9e4c5b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4023,6 +4023,16 @@ sub process { } } +#avoid GW-BASIC style label names + if ($line =~ /^.\s*((?i)(?:err|error|fail|out)[0-9]+)\s*:/) { + my $label = "This label"; + if (defined $1) { + $label = $1; + } + WARN("BAD_LABEL_NAME", + "'$label' isn't informative - prefer descriptive label names\n" . $herecurr); + } + # return is not a function if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) { my $spacing = $1;