On Sunday, 25 June 2017 at 21:55:22 UTC, Johan Engelen wrote:
On Sunday, 25 June 2017 at 16:31:52 UTC, Moritz Maxeiner wrote:

By requiring the compiler to inline the empty foo:

This won't work.

Yes, it does; comment out the call to `foo` and notice no change in the assembly in my link.

Semantically, there is still a call

You asked for

no call and no extra code at -O0

and that is exactly what this solution provides.

and e.g. profiling will see it:
https://godbolt.org/g/AUCeuu

The solution obviously does *not* work if you change the premise of your question after the fact by artificially injecting instructions into all function bodies (read what `-finstrument-functions` does).

Reply via email to