Maybe have a GNU C++ builtin type
struct __Gcc_call_location_pack {
const char *file;
const char *function;
unsigned line;
};
and an attribute
void foo (int bar) __attribute__((add_location_pack));
that directs GNU C++ to add a __Gcc_call_location_pack typed
argument at each call site (properly constructed of course)?
Or more explicitely:
void foo (int bar,
__Gcc_call_location_pack pack = __Gcc_create_location_pack ());
? I'd be willing to pay the price that only GCC can build itself
with mem-stat support.