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

From: Joe Perches
Date: Thu Sep 30 2021 - 22:54:43 EST


On Thu, 2021-09-30 at 15:52 -0700, Kees Cook wrote:
> I have read and re-read Linus's emails, and did a frequency count in the
> kernel, and it looks like the preference is [return type] [return type attrs]

Please don't read too much into frequency counts as it really depends
on age of code.

> but I personally agree with you. :)
>
> # regex I built from __must_check hits...
> $ re='((struct .*|void|char) \* ?|((unsigned )?(long|int)|bool|size_t)($| ))'
>
> # type before __must_check
> $ git grep -E "$re"'__must_check' | wc -l
> 746
>
> # type after __must_check
> $ git grep -E '\b(static (__always_)?inline )?__must_check($| '"$re"')' | wc -l
> 297

Hmm.

$ git grep -w __must_check -- '*.[ch]' | wc -l
909