Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754883AbXEBGww (ORCPT ); Wed, 2 May 2007 02:52:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754886AbXEBGwv (ORCPT ); Wed, 2 May 2007 02:52:51 -0400 Received: from smtp1.linux-foundation.org ([65.172.181.25]:36219 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754883AbXEBGwu (ORCPT ); Wed, 2 May 2007 02:52:50 -0400 Date: Tue, 1 May 2007 23:52:37 -0700 From: Andrew Morton To: David Rientjes Cc: Rusty Russell , linux-kernel@vger.kernel.org Subject: Re: [patch 01/10] compiler: define __attribute_unused__ Message-Id: <20070501235237.ba43586a.akpm@linux-foundation.org> In-Reply-To: References: <1178084403.28659.222.camel@localhost.localdomain> <1178087393.28659.238.camel@localhost.localdomain> X-Mailer: Sylpheed version 2.2.7 (GTK+ 2.8.17; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1736 Lines: 43 On Tue, 1 May 2007 23:41:34 -0700 (PDT) David Rientjes 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 > --- > 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/