Re: [PATCH][2.6.8-rc1-mm1] drivers/scsi/sg.c gcc341 inlining fix

Douglas Gilbert
2004-07-15T15:48:14Z

Andrew Morton wrote:
> Jeff Garzik <jgarzik@pobox.com> 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