[GCC-XML] C++ -> C

Brad King brad.king at kitware.com
Thu Apr 19 08:21:14 EDT 2007

Mike Goodwin wrote:
> Could anyone give me an indication of how difficult it would be to
> modify gccxml to use the c front end (and obviously output the correct
> c xml)? If possible a brief overview of the steps it would take as
> well?

Most of the effort for gccxml went into the support for processing the 
headers of each native compiler.  This would not have to be repeated to 
support C.

The actual dump code for the C++ front-end is in GCC/gcc/cp/xml.c under 
the gccxml source tree.  There is a hook in the finish_translation_unit 
function in the semantics.c file that invokes the dump.  Creating a C 
dump would mean creating a GCC/gcc/xml.c file and putting a hook in the 
C front-end.  I'm not sure how much of the dump code could be shared 
between the two files.

> I am not an expert, but from what I have researched I understand that
> the gcc c and c++ compilers share the same source representations
> ('Trees'), so one would think that much of the code would be reused.

Much of the representation is shared.  The C++ compiler adds a bunch of 
tree node types.


More information about the gccxml mailing list