From: Joe Perches <joe@perches.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: list iterator spacing: clang-format vs checkpatch
Date: Mon, 17 Jan 2022 10:05:15 -0800 [thread overview]
Message-ID: <e67388e4bdd25ca5ccb4cf20df0527d82ba31277.camel@perches.com> (raw)
In-Reply-To: <CAHmME9p6q5MxLy-_1KaDWz8ksQYAUev1UvaQ-fHhetmy0sNHOg@mail.gmail.com>
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 <ojeda@kernel.org>
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 <ojeda@kernel.org>
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.
next prev parent reply other threads:[~2022-01-17 18:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 2:00 Jason A. Donenfeld
2018-10-08 7:31 ` Miguel Ojeda
2018-10-08 15:40 ` Joe Perches
2018-10-08 16:01 ` Miguel Ojeda
2018-10-08 16:06 ` Jason A. Donenfeld
2022-01-17 12:47 ` Jason A. Donenfeld
2022-01-17 18:05 ` Joe Perches [this message]
2022-01-17 21:41 ` Miguel Ojeda
2022-01-18 4:25 ` Joe Perches
2022-01-18 9:27 ` David Laight
2022-01-17 21:41 ` Miguel Ojeda
2022-01-22 13:16 ` Miguel Ojeda
2022-04-21 23:53 ` Brian Norris
2022-04-22 10:57 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e67388e4bdd25ca5ccb4cf20df0527d82ba31277.camel@perches.com \
--to=joe@perches.com \
--cc=Jason@zx2c4.com \
--cc=andrew@lunn.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome