On Tue, 1 May 2007 23:41:34 -0700 (PDT) David Rientjes <[EMAIL PROTECTED]> 
wrote:

> compiler: define __maybe_unused
> 
> Define __maybe_unused to apply to both functions or variables as
> __attribute__((unused)).  This will not emit a compile-time warning when
> a function or variable is declared but unreferenced.
> 
> We eventually want to change the name of __attribute_used__ to __used.
> 
> Signed-off-by: David Rientjes <[EMAIL PROTECTED]>
> ---
>  include/linux/compiler-gcc.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -37,3 +37,4 @@
>  #define  noinline                    __attribute__((noinline))
>  #define __attribute_pure__           __attribute__((pure))
>  #define __attribute_const__          __attribute__((__const__))
> +#define __maybe_unused                       __attribute__((unused))

Seems sane to me.  We'd need a definition in compiler-intel.h too.  I don't
know if ICC implements __attribute__((unused)) - probably it does.

I guess we can get by without any commentary describing __maybe_unused, but
I think __used would need one - it's pretty obscure.


[EMAIL PROTECTED] @code{used} attribute.
[EMAIL PROTECTED] used
+This attribute, attached to a function, means that code must be emitted
+for the function even if it appears that the function is not referenced.
+This is useful, for example, when the function is referenced only in
+inline assembly.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to