[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070502145550.GE3531@stusta.de>
Date: Wed, 2 May 2007 16:55:50 +0200
From: Adrian Bunk <bunk@...sta.de>
To: David Rientjes <rientjes@...gle.com>
Cc: Rusty Russell <rusty@...tcorp.com.au>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [patch 01/10] compiler: define __attribute_unused__
On Wed, May 02, 2007 at 12:22:24AM -0700, David Rientjes wrote:
> On Wed, 2 May 2007, Rusty Russell wrote:
>
> > That sounds exactly right to me! If the author says it's optional, it
> > might be discarded. If they say it's needed, it won't be. At least,
> > when I'm coding and gcc warns me something is unused, this is the
> > decision I have to make ("is this really needed or not?").
> >
>
> Hi Rusty,
>
> There are many instances in the tree of functions that have no callers
> whatsoever because they've been commented out temporarily, disabled
> through configuration, etc. These are marked __attribute__ ((unused))
> right now so that the compiler doesn't emit a warning (and with gcc >=3.4
> it doesn't even emit code for them). What's __optional about these
> functions if they have no callers? They're unused. So we cover all our
> bases with __maybe_unused.
"many ... are marked __attribute__ ((unused))" is not true:
$ grep -r __attribute_used__ * | wc -l
60
$
static inline functions don't result in warnings.
And for global functions, it is technically impossible for gcc to figure
out whether a function has any users.
Unused static non-inline functions are the only functions resulting in
warnings when being unused.
If we don't want gcc to emit warnings for such, we could disable them
globally.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists