This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: inline functions
Thanks, I already got the answer from John <eljay@adobe.com>.
It can be useful for ohers, so here are the details:
The compiler has some limits inside to make functions inline. My source cannot
be published here because of its complexity, and that was the problem: the
mentioned class was inherited from other classes, using more inline
functions. The option "-Winline" gives more information in such cases.
The essence is the option "max-inline-insns-single", which is described in
details in "man gcc". The inlining limits can be changed this way.
The source code is mentioned in my previous mail "C++ in embedded systems"
Thanks again,
K. Gy.
2007. jÃlius 13. 15.46 dÃtummal jlh ezt Ãrta:
> KÃvesdi GyÃrgy wrote:
> > I found that the function other_class::f2() cannot be inlined
>
> I filled the blanks in your example with simple code and f1 as
> well as f2 were inlined into the called of f2 when using -O1. You
> should provide a complete compilable example of a situation that
> doesn't do what you want.
>
> > Trying to add __attribute__((inline)) the result is a warning
> > message about ignoring this attribute.
>
> I guess it's because if you define a method directly in the class
> body, you implicitely tell the compiler to inline it, thus making
> this attribute redundant. See [1]. (It still only happens with
> optimization turned on.)
>
> [1] http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.8