Force inline without -O2
Jie Zhang
jie.zhang@analog.com
Mon Dec 28 15:43:00 GMT 2009
On 12/28/2009 08:21 PM, Thomas Martitz wrote:
> 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.
>
GCC uses -O0 by default, not -O1.
Jie
More information about the Gcc-help
mailing list