HC12: Unable to inline from other source files

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HC12: Unable to inline from other source files

ソリューションへジャンプ
2,439件の閲覧回数
falken
Contributor I
I noticed today that when calling

// foo.c
#pragma INLINE
void foo(void){xxx}

from

// bar.c
void bar(void)
{
foo();
}

it's not inlined.
When calling INLINE functions from the same source file, it works.

Am I doing something wrong or is it not implemented?

HCS12 with CW 3.1 & 4.5 with build option -Oi

/Thanks

Message Edited by CrasyCat on 2007-04-13 02:27 PM

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,170件の閲覧回数
CrasyCat
Specialist III
Hello
 
This is fully normal behavior.
 
When compiling the compiler has only visibility on the current compilation unit (the source file and all the files it includes).
If a function is implemented in another module, the compiler will not be able to inline it as it will not know which is the code from the function.
 
If you wish to inline a function in several different source files, I would recommend you to implement a static function in a header file and include the header file in different source file.
 
CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,170件の閲覧回数
falken
Contributor I
Ok, thanks.
0 件の賞賛
返信
1,171件の閲覧回数
CrasyCat
Specialist III
Hello
 
This is fully normal behavior.
 
When compiling the compiler has only visibility on the current compilation unit (the source file and all the files it includes).
If a function is implemented in another module, the compiler will not be able to inline it as it will not know which is the code from the function.
 
If you wish to inline a function in several different source files, I would recommend you to implement a static function in a header file and include the header file in different source file.
 
CrasyCat
0 件の賞賛
返信