Daniel Berlin wrote:
Maybe at some point then we should just stop using gengtype and just
hand-write the walkers once.
One of the reasons gengtype exists is because you can't easily have an
abstract interface with member functions that you can force people to
implement in C.
In C++, we can.
This is of course, a large change, but i'm not sure how much more work
it really is than trying to understand gengtype and rewrite it to
properly parse C++/support STL containers.
I might be the only person out there who likes GTY annotations. The fact
that gengtype has a separate parser is highly inconvenient. Why not use
the GCC C/C++ parser on gengtype? It seems that with some refactoring,
it should be possible to bootstrap just the C++ parser( without memory
management or maybe some minimal handwritten stuff).
Then the parser could parse the headers to extract GTY annotations with
full semantic info.
For my plugin stuff I use a macro to convert GTY stuff to GNU
attributes(patch is coming as soon as I get the paperwork done) which
allows me to do some trivial metaprogramming to produce useful things
such generate most of the code for a JavaScript binding to GIMPLE gcc
plugin(http://developer.mozilla.org/en/docs/Treehydra).
Overall I think the the GTY annotations make the structs more
understandable and the fact that they allow for generating
structure-aware code is awesome. I think there may be other automation
benefits to be reaped from GTY-style annotations elsewhere in the code,
so the system should be improved, not canned.
Taras
On Wed, Jun 25, 2008 at 10:49 AM, Tom Tromey <[EMAIL PROTECTED]> wrote:
"Daniel" == Daniel Jacobowitz <[EMAIL PROTECTED]> writes:
On Wed, Jun 25, 2008 at 08:35:41AM -0600, Tom Tromey wrote:
I think most of the needed changes will be in gengtype. If you aren't
familiar with what this does, read gcc/doc/gty.texi.
Daniel> Also - I may regret saying this but - doesn't gengtype have a
Daniel> simplistic C parser in it? How upset is it likely to get on C++
Daniel> input?
Yeah, it does -- see gengtype-parse.c.
I haven't done extensive hacking there; I don't really know how upset
it will be. I assume it won't work the first time :)
Tom