lkml.org 
[lkml]   [2003]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Make gcc3.3 Eliminate Unused Static Functions
Date
In message <20030619121732.GQ29247@fs.tum.de> you write:
> On Fri, Jun 13, 2003 at 11:03:43AM +1000, Rusty Russell wrote:
> > Argh, bogus line pasted into Makefile turned up in patch.
> >
> > This should be better...
> >...
> > +# Needs gcc 3.3 or above to understand max-inline-insns-auto.
> > +INLINE_OPTS := $(shell $(CC) -o /non/existent/file -c --param max-i
nline-insns-auto=0 -xc /dev/null 2>&1 | grep /non/existent/file >/dev/null && e
cho -finline-functions --param max-inline-insns-auto=0)
> >...
>
> You have to add a -Wno-unused-function or you'll get a warning for every
> eliminated function.

No, suppressing warnings like that would be bad. Instead, you write
functions like this:

#ifdef CONFIG_FOO
extern int register_foo(foo_fn myfunction);
#else
static inline int register_foo(foo_fn myfunction)
{
return 0;
}
#endif /* CONFIG_FOO */

That way, there's no unused warning, but gcc knows enough to discard
the function.

Hope that clarifies!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.025 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site