Re: static int __init foobar_init(void) {}

From: Alexander Viro (viro@math.psu.edu)
Date: Sun Mar 12 2000 - 22:05:39 EST


On Mon, 13 Mar 2000, Jean-Christian de Rivaz wrote:

> I get confused by many warning while compile 2.3.51. gcc warn: init and
> exit functions aren't used in many modules. Is the probleme only the
> static word or something more important explain the current state ?
>
> In fact, when writing a module driver, what is correct ?
>
> static int __init foobar_init(void) {}
> module_init(foobar_init);

It should be correct. Yes, gcc complains here. What actually happens is
that

static void foo(void) {baz();barf();}
void bar(void) __attribute(alias(foo));

is correctly compiled (resulting code consists of a function that calls
baz() and barf(), foo is equal to bar and both point to the beginning of
that function, only bar is visible outside of file), but gcc complains
about foo() being static and never called. Which is technically true
(defining alias != calling), but is pretty meaningless.

Could gcc folks comment on that? IMO counting alias as valid use is a
reasonable idea...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:23 EST