[GCC-XML]support for definitions as well as declarations?

James Michael DuPont mdupont777 at yahoo.com
Wed Aug 7 02:18:40 EDT 2002


--- Dale E Martin <dmartin at cliftonlabs.com> wrote:
> I'm looking at gcc-xml because I have an interest in translating C++
> into other languages.  It looks like an excellent tool for my 
> purposes, except for the fact that method/function definitions aren't
> emitted - only the declarations.  Is there any work/attempt to
support > definitions as well?

Dale,
I have been working on the function bodies of C in the introspector,
the problem is that there are legal and moral issues attached to it. 

One of the problems with the gpl is that it is based on copyright, and
therefore exerts no control over how a program is used. Therefore the
fsf is worried that such an interface could be used to write non-free
backends on the gcc. 

Last month I met with Stallman about this issue, I understand his
concerns and am trying to figure out the best way to proceed on this
issue.

I have promised that I will remove that ability from my program, at
least for the XML side of it. On the other side, the ast-serializer and
ast-optimizer branch of the gcc are doing similar things. If you want
to help try and resolve some of the legal issues involved, I will be
willing to donate my function body dumping into gcc_xml and merge the
two projects.

But note that Stallman has said that he does not have a problem with
gccxml because of the fact that it does not dump bodies. 

On the other side, there is the cppx[1] project that does support the
full dumping of all the compiler data, but they also dont really have
any free tools for using this data, and support non-free backends. That
is why I dont use it.
 
I dont know how tenable it will be not to dump the full function body
information, because of the fact that any application (such as syntax
highlighting) depends on a full function definition. The idea from
stallman is to somehow force the developer to create the module as part
of the gcc, and therefore you would bound by the copyright/copyleft law
to re-releasing the program under the GPL. 

I am not sure how to continue on this path, except to introduce an EULA
that stipulates that the software is only usable by free software, and
that it will not be used to create non-free backends. Would you agree
to such an license? Do you think it makes sense at all.

On the other side there are very interesting programs being written as
part of the gcc itself, the deparse/ast-optimizer has a tree to c
generator, you might want to consider writing your module in c or
directly linked to the compiler as one module.
I would consider expanding my perl interface to link directly to the
gcc, and have a GCC dll/so that has the entire thing as a perl module.
This would allow a direct and static linkage of the gcc to perl and
avoid any XML.  

Of course that would again need an EULA to prevent someone from using
it for creating a non-free backend as well. As I said, if anyone is
interesting in persusing this angle, I would be willing to contribute
that part. In fact it could be added to gcc-xml, as a module........

This might come back down to a problem again, and I have to say that 
right now the best possibility to get the function bodies is from
opencxx [2].
On the other side, if you are willing to sign a form of a
non-disclosure aggreement, we can arrange a private distribution via
gpg/pgp encrypted code, but you will have to aggree not be allowed to
redistribute the code to third parties.

I hope that you found this informative, and I am looking forward to
hearing from you.
mike

[1] cppx : http://www.swag.uwaterloo.ca/~cppx/
[2] opencxx: http://www.csg.is.titech.ac.jp/~chiba/openc++.html

=====
James Michael DuPont
http://introspector.sourceforge.net/

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



More information about the gccxml mailing list