Force inline without -O2

Thomas Martitz thomas.martitz@student.HTW-Berlin.de
Mon Dec 28 12:30:00 GMT 2009


Am 28.12.2009 04:22, schrieb Jie Zhang:
> I think __attribute__((always_inline)) is used to inline functions
> even not optimizing. Below is from GCC manual:
>
> always_inline
>      Generally, functions are not inlined unless optimization is
> specified. For functions declared inline, this attribute inlines the
> function even if no optimization level was specified.
>    


That just means that it's inlined under the implicit default 
optimization level -O1 (that is what you  get "if no optimization level 
was specified"). If you set -O0, it will not inline. I had problem where 
-O0 broke code that is depended on being inlined.

Best regards.



More information about the Gcc-help mailing list