[RFC] type safe trees

Paolo Bonzini paolo.bonzini@polimi.it
Wed Jun 23 15:11:00 GMT 2004


> gengtype already scans all of the source to do its GTY magic.  The idea of
> defining the nodes inline like this appeals to me more than having them off
> in some meta file elsewhere.  If we do that, it is natural to make the
> generated C have the same scope and lifetime as the original class
> declaration.  That way you know exactly where and when you can use the
> generated macros and structs.

Ok, I see.

I think it all depends on how big this comes out.  tree.def is 906 lines 
long, which would get added to tree.h (3695 lines).  With all the extra 
lines for braces and #includes, tree.h would reach 5000 lines.  Not 
exactly nice for an header.

If you put the typeclass declarations in a rewritten tree.def, all the 
output could go into one file gt-tree-def.h (included by tree.h), or 
grouped indirectly into gt-tree-def.h via #include directives.

FWIW, the idea looks very nice.

Paolo



More information about the Gcc mailing list