Re: [PATCH][2.6.8-rc1-mm1] drivers/scsi/sg.c gcc341 inlining fix
From: Douglas Gilbert
Date: Thu Jul 15 2004 - 10:49:11 EST
Andrew Morton wrote:
Jeff Garzik <jgarzik@xxxxxxxxx> wrote:
Or you could just call it "gcc is dumb" rather than a compiler bug.
Yeah, but doing:
static inline foo(void);
bar()
{
...
foo();
}
static inline foo(void)
{
...
}
is pretty dumb too. I don't see any harm if this compiler feature/problem
pushes us to fix the above in the obvious way.
It might be dumb but C99 (ISO/IEC 9899:1999(E) ) says in
section 6.7.4 :
"function-specifiers shall be used only in the
declaration of an identifier for a function"
The only "function-specifier" defined in C99 is
"inline". So that seems to imply "inline" should
not appear in a function definition. If that is true
then you must declare an inline function before use
in order to pass the "inline" hint to the compiler.
Anyways C99 says very little about "inline" other than
some restrictions on its usage together with external
linkage. That seems to imply constructs that are legal
_without_ "inline" in front of a function declaration
should also be legal when "inline" is added (modulo
external linkage restrictions).
Doug Gilbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/