Re: [PATCH v1] tools clang-format: Add a tools clang-format that overrides some kernel behaviors
From: Namhyung Kim
Date: Tue Apr 14 2026 - 02:40:45 EST
On Mon, Apr 13, 2026 at 10:50:59AM -0700, Ian Rogers wrote:
> On Mon, Apr 13, 2026 at 9:54 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
> >
> > On Mon, 2026-04-13 at 09:19 -0700, Ian Rogers wrote:
> > > On Mon, Apr 13, 2026 at 8:45 AM Joe Perches <[joe@xxxxxxxxxxx](mailto:joe@xxxxxxxxxxx)> wrote:
> > > > On Mon, 2026-04-13 at 08:39 -0700, Ian Rogers wrote:
> > > On Tue, Apr 7, 2026 at 10:11 AM Joe Perches <[[joe@xxxxxxxxxxx](mailto:joe@xxxxxxxxxxx)](mailto:[joe@xxxxxxxxxxx](mailto:joe@xxxxxxxxxxx))> wrote:
> > > On Tue, 2026-04-07 at 09:55 -0700, Ian Rogers wrote:
> > > > > Sorting headers is desirable to avoid issues like duplicate includes.
> > > > > > Perhaps.
> > > > > > Some others prefer reverse-christmas-tree by length ordering for #includes
> > > > > > though I think it's poor style.
> > > > > Thanks Joe. I second not switching to a reverse-christmas-tree style :-)
> > > > > If this patch is okay, could we bring it in through the perf tree?
> > > > It's likely better to avoid this suggestion.
> > > > The issue is that others strongly prefer that reverse-christmas-tree
> > > > style and would object so nak.
> > > Presumably that is a kernel suggestion rather than a tools directory
> > > suggestion. We can move the file into tools/perf, tools/lib/perf, etc.
> > > if that removes more global concerns. perf hasn't adopted a
> > > reverse-christmas-tree style.
> >
> > Fine by me.
> > Just curious: is this a style control file used by directory depth/path?
>
> clang-format searches from the directory containing the file to be
> formatted upwards until it finds a .clang-format file. This change
> places the style in tools/, which is my preferred location for
> consistency across different tools and libraries. Header file ordering
> is a different issue within the kernel tree because it generally only
> references itself.
I think we need confirmation from other folks in tools/ if we want to
put it there.
Thanks,
Namhyung