This is the mail archive of the
mailing list for the GCC project.
Re: C++ and gather-detailed-mem-stats
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc at gcc dot gnu dot org, crowl at google dot com, Diego Novillo <dnovillo at google dot com>
- Date: Wed, 15 Aug 2012 05:07:15 -0500
- Subject: Re: C++ and gather-detailed-mem-stats
- References: <alpine.LNX.firstname.lastname@example.org>
On Wed, Aug 15, 2012 at 4:37 AM, Richard Guenther <email@example.com> wrote:
> I face an issue with replacing macros with C++ functions and the
> way we implement gather-detailed-mem-stats. Currently the
> mem-stat info is passed at the call site of functions via macros
> #define VEC_safe_grow_cleared(T,A,V,I) \
> (VEC_safe_grow_cleared_1<T,A> (&(V), (int)(I) \
> VEC_CHECK_INFO MEM_STAT_INFO))
Not every CPP macros can be simply and perfectly
replaced by a C++ template. CPP macros fundamentally operate at
levels not understood by the language core semantics, for good or bad.
You might try to encode/package information with the
parameters T and A, but essentially you will hit the wall
that __FILE__, __LINE__, and __FUNCTION__ are CPP artifacts.
Unless we are willing to fundamentally change the way our
current allocators work, I fear we would have to live with
these parts of CPP.