gengtype needs for C++?
Paolo Bonzini
bonzini@gnu.org
Tue Jun 29 11:24:00 GMT 2010
On 06/29/2010 04:16 AM, Tom Tromey wrote:
> Ian> In Tom's interesting idea, we would write the mark function by hand for
> Ian> each C++ type that we use GTY with.
>
> I think we should be clear that the need to write a mark function for a
> new type is a drawback of this approach. Perhaps gengtype could still
> write the functions for ordinary types in GCC, just not (templatized)
> containers.
Yes, gengtype would emit template specializations instead of its own
mangled function names, and it would just call the same function (e.g.
gt_mark) instead of using mangled names. The C++ front-end would pick
up the correct function.
For templated containers it would be the same, except that you'd have
overloading instead of full specialization, such as template<typename T>
mark(std::vector<typename T> v). gengtype logic can be simplified a
lot, if we accept that some of the error reporting will be deferred to
the compiler.
Paolo
More information about the Gcc
mailing list