lkml.org 
[lkml]   [2000]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: static int __init foobar_init(void) {}
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/

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