Reputation: 81
I have a question regarding the -finline-function options
We are testing whether the function which we have implemented is getting successfully inlined. Here are the observation
When we tried compiling using -O0 and -finline-functions together, we still observed that the functions are not getting inlined. we even tried for a very simple method(one line return statement) and observed the same result.
So it seems that usage of -finline-functions flag along with -O0 is redundant(It will not make functions inline). I am still searching if this behavior is documented somewhere in gcc/g++ manual. Please let us know if anyone has exact idea about how g++ works specify -finline-functions and -O0 together.
Regards
Upvotes: 0
Views: 4838
Reputation: 31
define your function like this inline void foo (const char) __attribute__((always_inline));
From website (https://gcc.gnu.org/onlinedocs/gcc/Inline.html)
Upvotes: 0
Reputation: 3069
From the gcc manual ( http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html ):
Most optimizations are only enabled if an -O level is set on the command line. Otherwise they are disabled, even if individual optimization flags are specified.
Upvotes: 4