Re: [PATCH v4] docs: Explain the desired position of function attributes

From: Miguel Ojeda
Date: Sat Oct 02 2021 - 06:47:20 EST


On Sat, Oct 2, 2021 at 8:31 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Why would documenting the expected format have an affect on tools not
> being able to follow that exact expected format? Are we defining a
> format that is somehow impossible for them to use?

>From a quick test, clang-format-12 with our current config keeps
attributes in the same line and it does not seem to reorder them, so
it seems OK (the developer has to do it by hand, but that is fine)
except for the `__malloc` in the second example which is in a
different line (but not in the first). Is that intended?

> If anything I would think that now we have a format that the tools can
> actually follow, while before it was semi-random as to what to pick as
> the "one true way".

In the future, clang-format could have a configuration option to pass
a sort order, in which case, having the sort order already defined in
the kernel would definitely be helpful.

In fact, we could use the fact that the kernel has one as a way to
tell upstream that such a feature would be nice to have :)

Cheers,
Miguel