From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751328AbbEGNr4 (ORCPT ); Thu, 7 May 2015 09:47:56 -0400 Received: from smtprelay0106.hostedemail.com ([216.40.44.106]:58731 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750843AbbEGNry (ORCPT ); Thu, 7 May 2015 09:47:54 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3653:3865:3867:3868:3870:3871:3872:4321:5007:6261:8531:10004:10400:10848:11232:11658:11914:12043:12296:12517:12519:12740:13069:13095:13161:13229:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: fact72_44bc40378af0f X-Filterd-Recvd-Size: 1757 Message-ID: <1431006471.9365.124.camel@perches.com> Subject: Re: [patch] checkpatch: complain about GW-BASIC style label names From: Joe Perches To: Dan Carpenter Cc: Andy Whitcroft , linux-kernel@vger.kernel.org Date: Thu, 07 May 2015 06:47:51 -0700 In-Reply-To: <20150507112111.GA21498@mwanda> References: <20150507112111.GA21498@mwanda> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2015-05-07 at 14:21 +0300, Dan Carpenter wrote: > GW-BASIC style label names are quite common. This generates a warning > like: > > WARNING: bad label name > #795: FILE: drivers/ata/pata_mpc52xx.c:795: > + err2: Hey Dan. > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -4023,6 +4023,16 @@ sub process { > } > } > > +#avoid GW-BASIC style label names > + if ($line=~/^\+\s*(err|error|fail|out)[0-9]+:/) { Labels aren't always only lower case. This may have false positives with ?: uses like a = foo ? err1:err2; > + if (WARN("LABEL_NAME", > + "bad label name\n" . $herecurr) && > + $fix) { > + $fixed[$fixlinenr] =~ > + s/^(.)\s+/$1/; > + } > + } There already is a $fix option in the INDENTED_LABEL test above this one and isn't needed or wanted here. It may be better to use a message like: "Prefer functionally descriptive label naming (ie: label:)\n"