Re: [patch 01/10] compiler: define __attribute_unused__

From: David Rientjes
Date: Wed May 02 2007 - 02:26:20 EST


On Tue, 1 May 2007, David Rientjes wrote:

> The patched version makes this:
>
> int type __attribute_unused__ = 0;
>
> which definitely tells you that you're using a compiler attribute that
> will be attached to that automatic. In your case:
>
> int type __unneeded = 0;
>
> doesn't say anything in this case. It doesn't resemble any attribute that
> a programmer might be familiar with and begs the question of why we've
> declared it if it's truly "unneeded"?
>

One possible way to remedy this situation is with __needed and
__maybe_unneeded.

__needed would be defined to __attribute__ ((used)), which would apply to
functions only and specify that its code needs to be emitted anyway even
though it appears to be unreferenced. This is needed for gcc >=3.4. In
gcc <3.4, this gets defined to be __attribute__ ((unused)) to simply
suppress the warning. So now all functions that are unreferenced except
in inline assembly get __needed appended.

__maybe_unneeded would be defined to __attribute__ ((unused)). It can
apply to either functions or variables to suppress the warning if they are
unused.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/