How to use gcc inline report (-Winline)

Including -Winline in my project gives a lot of results that I really don't understand. Does anyone know how to use this output to find out why my particular function was not built in?

+4
source share
1 answer

Ok, according to my gcc man page ...

The compiler uses many heuristics to determine whether to embed a function. For example, the compiler takes into account the size of the built-in function and the amount of insertion that has already been done in the current function. Therefore, it would seem that minor changes in the source program may cause warnings created by -Winline to appear or disappear.

I do not believe that you can force the compiler to inline your function; this is an implementation detail that may even change when the compiler is updated. Also, as long as choosing a compiler makes your function run faster, is there any special reason that bothers you if the function is really enabled or not?

Of course, if you really want to inline your function for some reason, you can probably use a macro for this.

+3
source

Source: https://habr.com/ru/post/1348187/


All Articles