Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3372765pxb; Mon, 17 Jan 2022 18:55:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxM4o+ocFZCbi5OJ4VCLFBl/FGC5SV+Fqp7QGUSuXlq/nR0HcHyBo7XmgPANGgMx5TAX+QY X-Received: by 2002:a17:902:a502:b0:149:c5a5:5329 with SMTP id s2-20020a170902a50200b00149c5a55329mr25405112plq.164.1642474556688; Mon, 17 Jan 2022 18:55:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642474556; cv=none; d=google.com; s=arc-20160816; b=imjLIuJ3pM8lAW/0WDGTGYQfGUGUgiKWRccWWWxIGd3zqIfQjdbpPEn/oge60/CG8T 8KtFsTu6cUMHZI/ZbnvzxR0GSuYLVwFkIvjOd2BUQRfO81FrF0KAbkUWHS22sF+nCkC4 8dISPh8Yf8Z67z3+tOKlTYzAK/CbX/sIPLZTAo1FwUyp5eTbNAZ9iOFV1Ijdd7MubJOT MrGTGUc4JTyjAFT06PwNUgIeOROjumJf29KvQy7fPzeTD78PjespTpCkTLxa276uKwQL y531P05fI/WNOkfIUSHQkp26NYtcfDcx+3mO1dxK5BHkkiGQdMOMnylE8rNpCTi7bWt2 QRBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=wKOLwFmB08I91Ebxd9Xqv1B0yA25qHIM12vlG3oZC6k=; b=toGgVksKn+EdWBfRmGPuwrbZUQUZt6Hkrj6F4aZ4bn5TxIYnOqdBcoKcxtZlw4QCic 5sVLF17WedWpnBaTt/SzSDILB783TpxyxM982qcTbSL7pmXOLWHWwCIwYFFWT+QuRJ2g okxkrRKA/Sc1wdFggXrGSUcAfCKkJAYXqkXRaHJZRd7Xm5To8ppcCj1CL+gNkKG0pC4h FT6ned2xw96kxABsr8RAeOnIPjEkuyJlKYhM8qzDYc9LQONgOEQwJmzuet2BGJKY5tr3 WTG6Fwx6GdZWarDrZo62fYH9gKDlLQCSlZwoNvPeCrvdAYcAwpPV6fElK/WeYig78m9U 4BSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d26si7099854pfo.343.2022.01.17.18.55.44; Mon, 17 Jan 2022 18:55:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242166AbiAQSFV (ORCPT + 99 others); Mon, 17 Jan 2022 13:05:21 -0500 Received: from relay038.a.hostedemail.com ([64.99.140.38]:19625 "EHLO relay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242087AbiAQSFT (ORCPT ); Mon, 17 Jan 2022 13:05:19 -0500 Received: from omf01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F0F6325307; Mon, 17 Jan 2022 18:05:17 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA id 817716000E; Mon, 17 Jan 2022 18:05:07 +0000 (UTC) Message-ID: Subject: Re: list iterator spacing: clang-format vs checkpatch From: Joe Perches To: "Jason A. Donenfeld" , Miguel Ojeda Cc: Andrew Lunn , LKML Date: Mon, 17 Jan 2022 10:05:15 -0800 In-Reply-To: References: <3cbaf145ee577f017cf7aea953c9dd1eb88ed4b4.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 817716000E X-Spam-Status: No, score=-2.18 X-Stat-Signature: sggpbsqu86ytmdasds6m67ecweokaouf X-Rspamd-Server: rspamout07 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+TONOwT8Ea+r8Fe4q7nQp8jsSucvMhp3w= X-HE-Tag: 1642442707-812029 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2022-01-17 at 13:47 +0100, Jason A. Donenfeld wrote: > Hey again, Rehi. > Four years later I went through basically the same motions: "oh hey I > should clean this up", "I'll start with clang format", "oh cool it > adds spaces before the iterator paren so it looks like a normal for > loop to me", "that seems so reasonable; I love clang format", "oh no > checkpatch.pl complains; I hope it's wrong", "I wonder if anybody has > thought about this before", "oh, look, I asked about this already in > 2018." Original thread: https://lore.kernel.org/lkml/CAHmME9ofzanQTBD_WYBRW49d+gM77rCdh8Utdk4+PM9n_bmKwA@mail.gmail.com/ > So, here we are again. I'm wondering: > - Can we switch to spaces before iterator parens? Still doubtful because the kernel sources has ~150:1 preference for no space, and it's still just a whitespace convention... $ git grep -P '\b\w*for_each\w*\(' | wc -l 31920 $ git grep -P '\b\w*for_each\w*\s+\(' | wc -l 196 > - If not, is clang-format ever going to be fixed to quit adding them? Doubtful as it's likely the .clang-format for_each list is just out of date for your particular for_each type use and the scripted bit that it uses to create them hasn't be updated in awhile. Also that scripted bit only works on files in include/ and not anything locally defined. in .clang-format: # Taken from: # git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \ # | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ # | sort | uniq commit 4792f9dd12936ec35deced665ae3a4ca8fe98729 Author: Miguel Ojeda Date: Wed May 12 23:32:39 2021 +0200 clang-format: Update with the latest for_each macro list Re-run the shell fragment that generated the original list. Signed-off-by: Miguel Ojeda checkpatch basically just looks for any use of 'for_each' (?:[a-z_]+|)for_each[a-z_]+) So it has false positives for some functions and not macros.