I'm trying to come up with a portable way of preventing a function from being inlined. I found my solution in this old answer where there is a comment that 'it might not always work'.
void (*foo_ptr)() = foo;
foo_ptr();
My function is just incrementing a volatile, the purpose is to control the PC for validation (exercising some trace hardware), and I'm not concerned about the surrounding code - just that the flow will likely remain working when I come back to this in 10 years time (with new toolchains). I'd rather not use attributes or embedded assembler (I already need to support 3 toolchains, and I have something that appears to work now).
I am thinking that passing the address through a volatile will give me more protection. Is this necessary, or is there anything less ugly I can use?