Re: [PATCH v5 1/2] lib/test_bitops: Add benchmark test for fns()

From: Nathan Chancellor
Date: Mon May 06 2024 - 13:56:53 EST


On Sun, May 05, 2024 at 12:42:53PM +0200, Miguel Ojeda wrote:
> On Fri, May 3, 2024 at 11:56 PM Yury Norov <yury.norov@xxxxxxxxx> wrote:
> >
> > + * The __used attribute guarantees that the attributed variable will be
>
> We should probably mention functions as Nathan said (unless it does
> not work for some reason).

Yeah, it should work for functions. I think clarifying it will not work
for local variables would probably be good as well, since __used__ does
not work on those like I replied in my other email, but it is not that
big of a deal.

> > + * is actually used. It's a compiler implementation details either emit
> > + * the warning in that case or not.
>
> Is it an implementation detail or rather that they took different
> alternatives/options on purpose (even if not documented)? If we think
> it is just a consequence of their implementation, perhaps we should
> mention that and what GCC/Clang do today in their latest version, in
> case it changes (so that we know whether we need to remove the macro,
> for instance).

Yeah it is entirely possible that this is not intentional but when
-Wunused-but-set-variable was introduced in Clang, I know there was a
lot of discussion around making the warning match GCC in certain ways as
well as breaking from GCC in others. I have not tried to dig up those
discussions to confirm though.

Cheers,
Nathan