Re: [PATCH] include/linux/compiler*.h: Use feature checking instead of version checks for attributes
From: Miguel Ojeda
Date: Mon Aug 27 2018 - 08:33:35 EST
Hi Joe,
On Sun, Aug 26, 2018 at 8:50 PM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> On Sun, 2018-08-26 at 19:57 +0200, Miguel Ojeda wrote:
>> Instead of using version checks per-compiler to define (or not) each attribute,
>> use __has_attribute to test for them, following the cleanup started with
>> commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive").
>
> Very nice. Thank you Miguel.
Thanks!
>
> trivia:
>
> I believe the alphabetic sorting of the required attributes
> makes reading by use a bit difficult and I would prefer that
> various required attributes are sorted by logical use instead.
>
> ie: keep noinline and __always_inline together,
> keep __used and __always_unused together,
> etc...
>
>
Both ways are fine with me --- I sorted them as an attempt to avoid
the file evolving into a mess again in the upcoming years :-)
Half-joking: it may also be a good way to avoid people "guessing" what
the attributes do by name and, instead, consulting the docs (either
the compiler's, or a Doc/ file maybe).
Cheers,
Miguel