C++ and gather-detailed-mem-stats

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Aug 15 11:04:00 GMT 2012


On Wed, Aug 15, 2012 at 5:10 AM, Richard Guenther <rguenther@suse.de> wrote:

> 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)?

Florian mentioned that GNAT already has language-level
builtins for __FILE__, __LINE__, and __FUNCTION__.
It looks to me as if we would like to make that functionality
available at least at the GNU C++ level, and rely on the standard
rules that default arguments are evaluated at the call site.

> 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.
>

I think we are converging on the notion that mem-stat will be accurate
only on stage 2 or higher builds, or stage 1 compiler built with
GCC-4.8.

-- Gaby



More information about the Gcc mailing list