Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp698994imb; Fri, 1 Mar 2019 11:32:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxuMEvIZ/E6pCupIJZ4FU7bhZQklsk3nvJhGWayM14OLIHZrPBQqje7S/+ZpEfTcVHtvVW6 X-Received: by 2002:a17:902:850a:: with SMTP id bj10mr7081558plb.91.1551468724745; Fri, 01 Mar 2019 11:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551468724; cv=none; d=google.com; s=arc-20160816; b=kMk79NJWJZ89ruA/XreOw5FB9+RGuACM6sXphAr8WrDk7akQW53NPvfvS3k0nigeiy 2ZQqFspRlT5jdGJAvrxIyTTWMqtkaUci0C2XkqCvWBf4cmwSOIYAH7H/kLpLadNgcINl /m5Qy1BN16QQsVKUvJzCxaif85J3n12K+69QB2+253L3LoqlfJzjLVfIoPZ0SwpEKCSv 05MWtBztCkwtGKlxhGjDyeGwbYAcLYmkVb/6TN3QRolxf0QkRg9fkwtHVu9Dops2St7y sJOZOQ3UnmO5V0oREyykmpZP6hBn0KbkQgwaYz4F1Z/EhNhtUnO4AXFNTQK9e/8P2+h3 xHhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=ClrIyyiJVUTidWbLXnub3JKB5fJtEcdMlIpLe/TsGMw=; b=Ozi9z6Za9RVcvx90+olHJdnRRZrmWZFZnXNO1oLv2cCxQk8zj2lgl0SFmYA6a9LNkm 7dG4P4kdIzdIx/I57gn77OUujjxsOI2EyYuBzsLc69tT8CtbBKRMHxkV2T6uZhf9q50T LN6YdmUlKA1TlZ/+moPUL3Be/Z6j0dSy2GH6TjzsDuQlj2WoYwvzYrg/De7Ofw1LqejP hHOOeiQJusQcqJALc1PSL2Ojv912eQW1AFJXLQBg3JMhuSK8ZpM0l9ZvDgspmFz4GxMS BCuxp+ZAS8Ad+op9gP1TqtK5pc6xeLd1cY7R3ojpoUNckswyWlRiLBMgN/AWOBeerxLc 4HHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si20928553pls.101.2019.03.01.11.31.48; Fri, 01 Mar 2019 11:32:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726166AbfCATbT (ORCPT + 99 others); Fri, 1 Mar 2019 14:31:19 -0500 Received: from smtprelay0050.hostedemail.com ([216.40.44.50]:38988 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725934AbfCATbT (ORCPT ); Fri, 1 Mar 2019 14:31:19 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 8AC8C180A8141; Fri, 1 Mar 2019 19:31:17 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1381:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2691:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:3872:4321:5007:7903:10004:10400:10848:11026:11232:11658:11914:12043:12295:12296:12438:12740:12760:12895:13017:13018:13019:13069:13311:13357:13439:14181:14659:14721:21063:21080:21451:21611:21627:30012:30054:30070:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:31,LUA_SUMMARY:none X-HE-Tag: nest56_627c0156c4315 X-Filterd-Recvd-Size: 2065 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA; Fri, 1 Mar 2019 19:31:16 +0000 (UTC) Message-ID: <29a040d31a84dd24618096e2776a66c23880f2d7.camel@perches.com> Subject: Re: [PATCH] scripts: checkpatch: Check multiple blank lines when deleting code From: Joe Perches To: Alexandre Ghiti , Andy Whitcroft , linux-kernel@vger.kernel.org Date: Fri, 01 Mar 2019 11:31:15 -0800 In-Reply-To: <20190228181531.18530-1-alex@ghiti.fr> References: <20190228181531.18530-1-alex@ghiti.fr> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-02-28 at 13:15 -0500, Alexandre Ghiti wrote: > By matching only current line starting with '+', we miss the case > when deleting code makes consecutive blank lines appear: this patch > then makes it possible to detect this case by also matching current > line starting with ' ', which is an already existing blank line. > > On the following example, checkpatch --subjective now complains about > multiple blank lines: > > static long hugepage_subpool_get_pages(struct hugepage_subpool *spool, > { > long ret = delta; > > - if (!spool) > - return ret; > > spin_lock(&spool->lock); > > Signed-off-by: Alexandre Ghiti > --- > scripts/checkpatch.pl | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -3298,7 +3298,7 @@ sub process { > > # check for multiple consecutive blank lines > if ($prevline =~ /^[\+ ]\s*$/ && > - $line =~ /^\+\s*$/ && > + $line =~ /^[\+ ]\s*$/ && > $last_blank_line != ($linenr - 1)) { > if (CHK("LINE_SPACING", > "Please don't use multiple blank lines\n" . $hereprev) && I believe this screws up the --fix option just below this if the line does not start with +