Re: static int __init foobar_init(void) {}

From: Mitchell Blank Jr (mitch@sfgoth.com)
Date: Mon Mar 13 2000 - 14:01:31 EST


Jeff Garzik wrote:
> > Can we get away with just adding __attribute(unused) to the __init and __exit
> > macros?
>
> Regardless of whether this works or not, they are NOT unused, therefore
> this is wrong... From a maintenance standpoint, somebody might come
> through the code, say "hmm this is unused eh?" and delete it.

Then place a comment in <linux/init.h>

> From a
> gcc standpoint, the compiler might change such that __unused__ code is
> never output, which would be equally bad.

The gcc docs seem clear that the "unused" attribute is just to defeat
the warning -- after all what would be the _point_ otherwise, since you
could just #ifdef the function. Even if gcc were to make that change
it would just mean that <linux/init.h> gets a little more code dependant
on __GNUC__. Hopefully by then gcc will correctly recognize aliases as
a use of a static symbol. Granted, this means that old kernels won't
compile with a new gcc, but it's not like that's never happened before.

-Mitch

-
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:27 EST