This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Partly rewriting gengtype in C++ ?

On Fri, 2 Mar 2012 13:56:24 -0500
Diego Novillo <> wrote:
> > I agree that such conversion will have to be done at some point, but
> > I'm not sure if a big rewrite should happen way before the rest of the
> > code will start to use gengtype-annotated C++ data structures.
> Wait, I don't follow.  gengtype supporting C++ data structures is
> different than writing gengtype in C++.

In principle I fully agree (gengtype could even be a GCC plugin -at least if we restrict
ourselves to hosts having a GCC-, or a MELT extension). Unfortunately, I don't think that
a gengtype implemented as a GCC plugin would be accepted (because it would require that
the compiler compiling GCC is a GCC).

I practice, gengtype is so messy today that any significant work on it (notably
support of ggc-ed vectors using C++ vectors or templates, not vec.h) requires to rewrite
big parts of it. Nobody really understands it very well... And its coding conventions are

So in fact the two are silently related; to enhance gengtype for C++ data structures I
would be tempted to rewrite it in MELT (but that means a GCC plugin required to build GCC)
or in C++.

BTW, we could adopt a terminology: gengtype++ would be an enhanced gengtype able to GTY
types like C++ [GTY-ed] classes or [GTY-ed] vectors
(it is indeed an increment of gengtype,
providing extra functionality). While gengtypexx would be a rewrite of gengtype in C++.  

My feeling is that gengtypexx is a useful step towards gengtype++ ; another option would
be to make gengtype++ a GCC plugin or MELT extension, but while it is much simpler (it
can take advantage of all GCC infrastructure, notably all GCC C++ frontend) I believe it
wont be accepted any soon, because it would require GCC to be hacked with GCC (we could
put the generated gt-*.[ch] files inside the repository, so GCC would then still be
compilable by any C++03 compiler).

email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]