Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp568745yba; Thu, 9 May 2019 02:29:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqya1EXJvwS8Vpv9rvHtaSxVSM9IELFYOzw7zFH9QbvWcHLTENB4UsYj/J/p3CITM9M5li/b X-Received: by 2002:a63:3e47:: with SMTP id l68mr3973320pga.85.1557394181375; Thu, 09 May 2019 02:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557394181; cv=none; d=google.com; s=arc-20160816; b=bt8GODWif4oVWd+Puhj5jTjEwgH3bhBiyaJTbp3vdpuo/FiXvcS2jvGSkdMwlbbYYd cVgLrDKk3Ch2dnLMW8ERUHKZ9gz6x6/XYzJfKVvb8S+1Rv6JGjkoy2AW08ie6EUNSSN4 eQXfYljHZfpNE5uKYQBOp0C43WiAR2YwnmbzGpOpWES3slehuNKHdLPo9PMxpzOtbNHG bZb7UGhJ1VjDMY2Nh2pkriZ2jhb5eUvglcgpDqVDTvr2NfR9ZReYOX/Pj+4pegXYmZFr 4+iInb5eaOe1P14J4GbATVcm71s2o8HbTm92KodDojAfpllc6Rgm5GQnp+QL94fsBI1A Tmmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2mpuoShtc3pBXqAPR31rr6ZG0YleTX+5TXGG7hYRLbI=; b=Xg3Y9zfyulPtbMMbqy/c8cF4EXj82iTty1hCtwCGjNAou29IgR5ky82JqjSOGcPlCp HuWMebBLmzdu3GQIPRPO2japtRpPDptKQwJpcd6zhJlKy0eK9xh872kIpbV2t05MUs7X YJYKVb9o6hkCr7mcJlguVwLmuF7tHQlf+KCMfq/VUkxYWK5UqoaPwuF9YyBdCQ3TcKES Ks+Jxy210li11+5khtajZ9BFKjAO2PMgZAS8zkxRbzqtN4gNul5nITiLk9R7zjTuYb5z CYV3PautWv5fNfmREIGbcz4+TUk/Sj1vcvhXndN31krIxH4gVufKusoWFaNNy/g+ZuAV SkAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VUHffAlg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k33si1945195pld.415.2019.05.09.02.29.25; Thu, 09 May 2019 02:29:41 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VUHffAlg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbfEIJ1O (ORCPT + 99 others); Thu, 9 May 2019 05:27:14 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33968 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbfEIJ1N (ORCPT ); Thu, 9 May 2019 05:27:13 -0400 Received: by mail-lj1-f196.google.com with SMTP id j24so599523ljg.1 for ; Thu, 09 May 2019 02:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2mpuoShtc3pBXqAPR31rr6ZG0YleTX+5TXGG7hYRLbI=; b=VUHffAlgkM6SXmJNVposqrO50IqvChG58Y62PGhoyRXDcZG6nBBOKIVq40yMNrp6NI PUw+z90MnPA/taCA18+upPBWK+k82Dw0s4/iRi+PGEg3EHHLcf1ITp7VKXpCbp83rG7J MTB9baJNKvT8fPUnQj4NJ7QyEZ64PCO17uBJwXnQIirHKXH1BEqJgiU1ifcv8uMKPm1N lK4JGBjaDMFNW4cs0/V6mmkcQ34pTwwBLvMVZ+faphktiWHnx9vokiii0FNVfrBiyC7r Irs0O82Bylu8zSv6LTIOnc3tmQj46+kSJsGVLb5tdDXK6ik5E7Nd402zgaNs9Ta1rQXs LLYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2mpuoShtc3pBXqAPR31rr6ZG0YleTX+5TXGG7hYRLbI=; b=oQqJls9iPDk0cdtYrdOlbR6vpweIN+I6cP6OuHEaX+taZv3uJAFYG5FM5K86PBmyE7 xRCsbQW/YzNYrR8b0gQDrETybZfpUUG1gHt3l6AIxDe+J/+PgxWrbrIUfr+xt201tR0d +cA7y6BJf5DJ+oXrsXmvQ5XOF3W4bc2hZ1pLXeqxVyRJy+eHd50LuL13+VVQr2kv2kWV FgZ1AZQNcxf8THzbYk+2s/FICMCKQfo+G+JeN0gziRQLDn6OgRZMEXIGn8fR7qjSI5l/ vQrfiusv1TrZ450ZaNmrC0BvlzAq+gcNm4m4XdT7CFAE62+qmvnakackVSD503gYxdfl g49Q== X-Gm-Message-State: APjAAAVqZrR4LNAtjej6SWJaI6bxXL0EbfYlnpiHF+Z/aIh9AXgeATCV OutkyIVD3o6QtYA38awP43gMTED07m1FN+cC0yo= X-Received: by 2002:a2e:88cc:: with SMTP id a12mr1785111ljk.55.1557394031673; Thu, 09 May 2019 02:27:11 -0700 (PDT) MIME-Version: 1.0 References: <20190509072104.18734-1-borneo.antonio@gmail.com> <3d1911051672d4d84b46dfa229b8c82c4a41813b.camel@perches.com> In-Reply-To: <3d1911051672d4d84b46dfa229b8c82c4a41813b.camel@perches.com> From: Antonio Borneo Date: Thu, 9 May 2019 11:26:50 +0200 Message-ID: Subject: Re: [PATCH v4] checkpatch: add command-line option for TAB size To: Joe Perches Cc: Andy Whitcroft , "Elliott, Robert (Servers)" , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 9, 2019 at 10:03 AM Joe Perches wrote: > > On Thu, 2019-05-09 at 09:21 +0200, Antonio Borneo wrote: > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -2224,7 +2229,7 @@ sub string_find_replace { > > sub tabify { > > my ($leading) = @_; > > > > - my $source_indent = 8; > > + my $source_indent = $tabsize; > > my $max_spaces_before_tab = $source_indent - 1; > > I didn't test this. > > Does this work properly if --tab-size=1 ? > Maybe die if ($tabsize < 2); is necessary? I have tested it and it works fine, but now that you point it, I rechecked the code. There is already this in checkpatch sub tabify { ... my $source_indent = $tabsize; my $max_spaces_before_tab = $source_indent - 1; ... #Remove spaces before a tab 1 while $leading =~ s@^([\t]*)( {1,$max_spaces_before_tab})\t@$1\t@g; that works fine. But we could have in the future some other test in checkpatch that uses "$tabsize - 1" and does not get the proper validation for --tab-size=1 Maybe it's safer to put die if ($tabsize < 2) right now, and avoid future headaches. With a comment to explains this choice. Antonio