Received: by 10.223.164.202 with SMTP id h10csp2326670wrb; Thu, 16 Nov 2017 13:14:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMbq8QhcmC+eWTJzawohJq6GGwUmsmqhfiL6UunJQIjrvH5TY0UFek9arjsSSjLyivT9pP+3 X-Received: by 10.101.82.200 with SMTP id z8mr2932985pgp.444.1510866897610; Thu, 16 Nov 2017 13:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510866897; cv=none; d=google.com; s=arc-20160816; b=QwYVGr8+mtVy1b/Qyd7d4KjUeFHfFR4B6M0r6B3kuglAn/PIS4djnI64LV38HstPKE uyfHvc3rFy4oT73CpHuZujpcr9Qz3wIkVrsyx863SFL+AoOc4NcZTKBhYKVWI3g5tCy4 1LUP5NafffOrgu6cxIyZOUZpHdBn0ehgDs29y2BU/MNJJtFpr1ZOANXw1Dlfwtu8oEtv vwOZ2w6EWIUCTQcjRHABh/pkz6UNwG2rDb2ak3cJUhDRQO6zoI7a7ybsekw/tKrnPqH+ 5A4rViKBDwpSMjFdONG2D3gcKGp/ZUGYkdwv3HVcf+m8ZpnSjR1ZMJL8lGgTy1lMCKkI Skqg== 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:references :in-reply-to:mime-version:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4F9kBFB8BBuozArgUYpVcamnchIyWls0N4p9p/L3KDw=; b=xDEDSp+YJF+x4PJYkNPKgnPPvd/qu5EqzuPHWzfLCMS6sVhRw1BN5hXaPct3tBWLAY MTLFswVulThZ6ImVTIScisXdNkx4iGTSe9oUjtcHXO9vU9kwveX/V81XLql0EydP4L+D NMGQjNsxnCig8xcesSNsO4NvBiBuJYtRCBTcEm+rSAP83B0lo1HdcoiOPugxaVkezl6F m/5Z3YrwBD7FjABpbGki9pQ1BcbZRmL1ck75+0CtEwJYgs7p9DLxzUKLgdu3UaE+eh5m MXvFoljtM4ck/Sb4/P2aMQFfy1O0MFmlFnPa0Oghkxc82VIvPYjq60CDh2z7YU57ADwm Yd8w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8si692050plv.266.2017.11.16.13.14.44; Thu, 16 Nov 2017 13:14:57 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965386AbdKPRDD (ORCPT + 92 others); Thu, 16 Nov 2017 12:03:03 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:23152 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936125AbdKPRCk (ORCPT ); Thu, 16 Nov 2017 12:02:40 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAGH2YoI004944 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Nov 2017 17:02:35 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vAGH2YXT008255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Nov 2017 17:02:34 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vAGH2XNF001734; Thu, 16 Nov 2017 17:02:34 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 16 Nov 2017 09:02:33 -0800 From: Knut Omang To: linux-kernel@vger.kernel.org Cc: Knut Omang , Andy Whitcroft , Joe Perches Subject: [PATCH 5/7] checkpatch: Improve --fix-inplace for TABSTOP Date: Thu, 16 Nov 2017 18:01:45 +0100 Message-Id: <3f9177f0f599f8168631e3dba43fff7b4cc1e7ae.1510840787.git-series.knut.omang@oracle.com> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 In-Reply-To: References: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the --fix-inplace option for TABSTOP encounters a sitation with several spaces (but less than 8) at the end of an indentation, it will assume that there are extra indentation and align back to the nearest tabstop instead of the next. This might go undetected in a "full" checkpatch --fix-inplace run, as this potential new error will be handled by SUSPECT_CODE_INDENT further down in the script. The code for TABSTOP have limited "knowledge" of the previous line. Adding complexity when it is taken care of later anyway is maybe unnecessary/undesired. As a simple heuristics just use a "natural" rounding algorithm and round up for 4 spaces or more. There's an example in line 108 in net/rds/ib_recv.c with indentation TAB + 7 spaces where the correct would have been an additional TAB. With only TABSTOP enabled, checkpatch will fix this to a single TAB, which is visually worse IMO. Reported-by: Håkon Bugge Signed-off-by: Knut Omang Reviewed-by: Håkon Bugge --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 387292f..c17178e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3061,7 +3061,7 @@ sub process { if (WARN("TABSTOP", "Statements should start on a tabstop\n" . $herecurr) && $fix) { - $fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x ($indent/8)@e; + $fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x (($indent+4)/8)@e; } } } -- git-series 0.9.1 From 1584257753485837927@xxx Thu Nov 16 20:58:50 +0000 2017 X-GM-THRID: 1583646864494093955 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread