Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1027102imb; Sat, 2 Mar 2019 00:11:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwDN7JscaGG86dH2jnU+TtzsQSEx1dbUSIAPDJVM7K9BaogZ1vJA4ddHKb/ZqzYR6HScO7L X-Received: by 2002:a17:902:c81:: with SMTP id 1mr9825458plt.155.1551514270491; Sat, 02 Mar 2019 00:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551514270; cv=none; d=google.com; s=arc-20160816; b=Io3a1hZJ2UP7u/qKk/QDfp4AXPS5bQ1SI0U7B34rxwM1metjBSbMmECLdP3BxU8gcW Nl4X/jZCT8W3DeSsRvgR2I2H9HvQ8fUNZcV9i9iAb99JXA88cA2RKwAdeLC7JIzpJidC Bb6+adNdGjfKwA1tL6aVLMTA/mKhZbFZVMqi0X/8rVMutT74eOOMzmxydyaiobRA1DnD V+iUc88qokgTGYOCJQulDhzJkCy7yT+q1PL4pvNlcyeA58pkgqE4sfOcvy+5NzCCXsIe V6a2111oYU3waR6n5ZBow72jQl2pL6o+kvjvzGm6PmZRiXMlSLwtz3HbBIuw4t9EO4iP EFUA== 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:in-reply-to :mime-version:user-agent:date:message-id:references:subject:cc:to :from; bh=V4lgjG7CKhaHxxhIMd830Z5luMBl+LiZk9Hy1l3PoH0=; b=UmRinHC/6lZ0IeNWhGAu+jG7Wyca8Lr0xPNhNM8qJg26bEcjqvM79pQ45LgiHFZqgS 2r7hCEAWmMY7qlH2Zftld7dWox5EazXFSgjJphanb8/86REZlv0KNpCneXq1NaMXUrG6 2iWgnUtNe1Ar5Wi08lw1+T7tKay5J8EVRd/MQbS+wSqd0dkGciMD0hJ0pG/upVPg8Tf8 cwGM8bndI9wkjMRUOTfg+jPB5SmY/lxebe1bR4AJbxuP+KYkxtNuMvWGhRruLJ43HWyb nnfOq1lUl82iVn11JLMMSN+Ao6bH7C51T3LxHrYsyL/rx45SjD+JasF++U7iF4EoS6cT 8Mhg== 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 e67si120057pfh.212.2019.03.02.00.10.39; Sat, 02 Mar 2019 00:11:10 -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 S1726169AbfCBIKA (ORCPT + 99 others); Sat, 2 Mar 2019 03:10:00 -0500 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:60973 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbfCBIKA (ORCPT ); Sat, 2 Mar 2019 03:10:00 -0500 X-Originating-IP: 77.136.197.76 Received: from [192.168.43.237] (76.197.136.77.rev.sfr.net [77.136.197.76]) (Authenticated sender: alex@ghiti.fr) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 7051F1BF206; Sat, 2 Mar 2019 08:09:57 +0000 (UTC) From: Alex Ghiti To: Joe Perches Cc: Andy Whitcroft , linux-kernel@vger.kernel.org Subject: Re: [PATCH] scripts: checkpatch: Check multiple blank lines when deleting code References: <20190228181531.18530-1-alex@ghiti.fr> <29a040d31a84dd24618096e2776a66c23880f2d7.camel@perches.com> Message-ID: Date: Sat, 2 Mar 2019 03:09:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <29a040d31a84dd24618096e2776a66c23880f2d7.camel@perches.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/1/19 2:31 PM, Joe Perches wrote: > 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 > [] I do not understand what you mean here, can you clarify for v2 please ? Thanks ! >> @@ -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 + > > Totally, you're right, thanks. > >