This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gengtype needs for C++?
- From: Basile Starynkevitch <basile at starynkevitch dot net>
- To: gcc at gcc dot gnu dot org
- Cc: tromey at redhat dot com, jeremie dot salvucci at free dot fr, iant at google dot com, laurynas dot biveinis at gmail dot com
- Date: Mon, 28 Jun 2010 23:23:18 +0200
- Subject: gengtype needs for C++?
- Reply-to: basile at starynkevitch dot net
Hello All,
(With Jeremie Salvucci we are trying to improve a bit gengtype, in
particular w.r.t. plugins & perhaps C++; we will continue to improve
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02178.html soon, taking
into account Paolo's remarks)
I am not a C++ expert, so I am asking: what would be needs of gengtype
w.r.t. C++ datatypes? I am only thinking here of garbage-collected
types, ie GTY-ed types!
Obviously, accepting plain C++ GTY-ed classes (with a single GTY-ed
super-class) is a must (and is probably not that hard). Basically, this
could be almost as simple as accepting class in gengtype everywhere
struct is accepted (but I know it is not that simple; at least the
gengtype parser has to evolve a lot!).
My current intuitions are:
* we don't need to accept any kind of multiple inheritance (for GTY-ed
data)
* I don't know exactly what should be wished with respect to templates.
Tom Tromey (in CC) have a wonderful insight in
http://gcc.gnu.org/ml/gcc/2010-06/msg00143.html but I probably did not
understood all the details & the consequences. In particular I don't
understand if the mark method in his example has to be supplied or
generated.
What I don't understand is, for GTY-ed template classes, do we really
need to exactly use all the std container, or could we specialize them.
My current feeling is that it would a lot easier for gengtype to require
that GTY-ed vectors would be instantiated from a GCC specific template
class, something like
template<typename Elemtype> class gty_vector : std::vector<Elemtype>
and require that, for GTY-ed C++ vectors, we would only accept for
example gty_vector<tree> instead of std::vector<tree> ; but I may be
very wrong!
BTW, I am not supposing that gengtype & ggc will go away with C++ (on
the contrary, I would guess that C++ will make some new useful features
of GGC worthwhile; probably C++ could make almost easy the ability to
add local Ggc-ed pointers, not only static or external ones.).
Cheers.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***