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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


+@cindex @code{used} attribute.
+@item 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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux