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

2007-05-03 Thread David Rientjes
On Thu, 3 May 2007, Adrian Bunk wrote: > > static external variables are certainly still static code and gcc issues > > the proper warnings if I do: > > > > static struct bootnode nodes[MAX_NUMNODES]; > > > > and I never reference nodes. > > No disagreement. > > But you said: > What abo

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

2007-05-03 Thread Adrian Bunk
On Thu, May 03, 2007 at 11:56:34AM -0700, David Rientjes wrote: > On Thu, 3 May 2007, Adrian Bunk wrote: > > > > That's only addressing part of the issue. What about automatic or static > > > external variables that are declared but may go unreferenced depending on > > > > This is only about s

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

2007-05-03 Thread David Rientjes
On Thu, 3 May 2007, Adrian Bunk wrote: > > That's only addressing part of the issue. What about automatic or static > > external variables that are declared but may go unreferenced depending on > > This is only about static code. For non-static code it would be > impossible for gcc to issue wa

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

2007-05-03 Thread Adrian Bunk
On Wed, May 02, 2007 at 10:16:15AM -0700, David Rientjes wrote: > On Wed, 2 May 2007, Adrian Bunk wrote: > > > If we don't want any warnings with CONFIG_PCI=n, CONFIG_SYSFS=n or > > CONFIG_PROC_FS=n, we'd have to annotate _many_ functions. > > > > If the lonterm goal is to compile the kernel with

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

2007-05-02 Thread David Rientjes
On Wed, 2 May 2007, Adrian Bunk wrote: > If we don't want any warnings with CONFIG_PCI=n, CONFIG_SYSFS=n or > CONFIG_PROC_FS=n, we'd have to annotate _many_ functions. > > If the lonterm goal is to compile the kernel with -Werror then we need > -Wno-unused-function, not annotating individual fun

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

2007-05-02 Thread Adrian Bunk
On Wed, May 02, 2007 at 04:55:50PM +0200, Adrian Bunk wrote: > > "many ... are marked __attribute__ ((unused))" is not true: > $ grep -r __attribute_used__ * | wc -l > 60 > $ Sorry, my fault - I confused used and unused. >... > Unused static non-inline functions are the only functions resulting

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

2007-05-02 Thread Adrian Bunk
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

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

2007-05-02 Thread Rusty Russell
On Wed, 2007-05-02 at 00:22 -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 someth

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

2007-05-02 Thread Robert P. J. Day
On Wed, 2 May 2007, David Rientjes wrote: > On Wed, 2 May 2007, Robert P. J. Day wrote: > > > not only that, but there are numerous files that *already* use > > "__unused": > > > > $ grep -rw __unused * > > ... snip lots of output here ... > > > > as well as a few files that can now have their d

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

2007-05-02 Thread David Rientjes
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 re

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

2007-05-02 Thread David Rientjes
On Wed, 2 May 2007, Robert P. J. Day wrote: > not only that, but there are numerous files that *already* use > "__unused": > > $ grep -rw __unused * > ... snip lots of output here ... > > as well as a few files that can now have their definition of that > removed: > > $ grep -r "define __unus

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

2007-05-02 Thread Rusty Russell
On Tue, 2007-05-01 at 23:41 -0700, David Rientjes wrote: > On Wed, 2 May 2007, Rusty Russell wrote: > > > OTOH, your point about "__unneeded" is well taken. "__needed" and > > "__optional" perhaps? But their feature is *exactly* that the don't > > look like the gcc attributes, hence avoid their

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

2007-05-02 Thread Robert P. J. Day
On Wed, 2 May 2007, Alexey Dobriyan wrote: > On Tue, May 01, 2007 at 09:28:18PM -0700, David Rientjes wrote: > > +#define __attribute_unused__ __attribute__((unused)) > > Suggest __unused which is shorter and looks compiler-neutral. not only that, but there are numerous files that

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

2007-05-01 Thread Andrew Morton
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

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

2007-05-01 Thread Nick Piggin
Andrew Morton wrote: On Tue, 1 May 2007 22:53:52 -0700 (PDT) David Rientjes <[EMAIL PROTECTED]> wrote: On Wed, 2 May 2007, Alexey Dobriyan wrote: On Tue, May 01, 2007 at 09:28:18PM -0700, David Rientjes wrote: +#define __attribute_unused__ __attribute__((unused)) Suggest __un

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

2007-05-01 Thread David Rientjes
On Wed, 2 May 2007, Rusty Russell wrote: > OTOH, your point about "__unneeded" is well taken. "__needed" and > "__optional" perhaps? But their feature is *exactly* that the don't > look like the gcc attributes, hence avoid their semantic screwage. > Hmm, __optional doesn't sound appropriate ei

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

2007-05-01 Thread Rusty Russell
On Tue, 2007-05-01 at 23:06 -0700, David Rientjes wrote: > On Wed, 2 May 2007, Rusty Russell wrote: > > > Adding this macro doesn't give us anything that simply saying > > "__attribute__((unused))" doesn't give. But it does add a layer of > > kernel-specific indirection. > > > > That's obviousl

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

2007-05-01 Thread WANG Cong
On Tue, May 01, 2007 at 10:53:52PM -0700, David Rientjes wrote: >On Wed, 2 May 2007, Alexey Dobriyan wrote: > >> On Tue, May 01, 2007 at 09:28:18PM -0700, David Rientjes wrote: >> > +#define __attribute_unused__ __attribute__((unused)) >> >> Suggest __unused which is shorter and looks

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

2007-05-01 Thread David Rientjes
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

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

2007-05-01 Thread David Rientjes
On Wed, 2 May 2007, Rusty Russell wrote: > Adding this macro doesn't give us anything that simply saying > "__attribute__((unused))" doesn't give. But it does add a layer of > kernel-specific indirection. > That's obviously true since we're defining __attribute_unused__ to be __attribute__((un

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

2007-05-01 Thread Andrew Morton
On Tue, 1 May 2007 22:53:52 -0700 (PDT) David Rientjes <[EMAIL PROTECTED]> wrote: > On Wed, 2 May 2007, Alexey Dobriyan wrote: > > > On Tue, May 01, 2007 at 09:28:18PM -0700, David Rientjes wrote: > > > +#define __attribute_unused__ __attribute__((unused)) > > > > Suggest __unused w

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

2007-05-01 Thread David Rientjes
On Wed, 2 May 2007, Alexey Dobriyan wrote: > On Tue, May 01, 2007 at 09:28:18PM -0700, David Rientjes wrote: > > +#define __attribute_unused__ __attribute__((unused)) > > Suggest __unused which is shorter and looks compiler-neutral. > So you would also suggest renaming __attribute

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

2007-05-01 Thread Rusty Russell
On Tue, 2007-05-01 at 21:28 -0700, David Rientjes wrote: > For all supported versions of gcc (major version 3 and above), functions > and variables may be declared with __attribute__((unused)) to suppress > warnings if they are declared but unused. Adding this macro doesn't give us anything that s

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

2007-05-01 Thread Alexey Dobriyan
On Tue, May 01, 2007 at 09:28:18PM -0700, David Rientjes wrote: > +#define __attribute_unused__ __attribute__((unused)) Suggest __unused which is shorter and looks compiler-neutral. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAI

[patch 01/10] compiler: define __attribute_unused__

2007-05-01 Thread David Rientjes
For all supported versions of gcc (major version 3 and above), functions and variables may be declared with __attribute__((unused)) to suppress warnings if they are declared but unused. This shouldn't be confused with functions being declared with __attribute__((used)). This specifies that the fu