I have for debugging purposes created following workflow.
I defined a global macro
#define PRINT_CALL(x) std::cout << "(CALL) " << x << std::endl
to notify whenever something is called. Trivially it is used like so:
void foo() {
PRINT_CALL("foo()");
// do stuff
}
This makes debugging much easier in my use case. Is there a way to automate this? Here is what I had in mind in totally illegal C++ syntax:
#define_decorator call_me(x) std::cout << "(CALL) " << x << std::endl
@call_me
void foo() {
// do stuff
}
// ==> resulting in the exact same outcome as above.
I hope you get the idea. As I said, syntax is obviously trash; since I don't know of such a functionality and didn't find any useful information online, maybe someone knows a hack. Appreciate all answers!