[GCC-XML]GCC-XML DTD

Brad King brad.king at kitware.com
Mon Jul 14 15:45:49 EDT 2003


Paul,

Thanks for posting this.  It looks pretty good.

> I guess the other way would to change the GCC_XML schema so that a type
> can always be an IDREF so instead of:
>
> <ReferenceType id="_234" type="_456c"/>
>
> To:
>
> <ReferenceType id="_234" type="_456" const="1"/>

This won't quite work.  The idea of "_456c" is that it references type
_456 with a "const" top-level cv qualifier.  Consider the dump of

int const f();

The node for the function will look like this:

  <Function id="_2" name="f" returns="_3c" context="_1" location="f0:1" extern="1"/>
  <FundamentalType id="_3" name="int"/>

Note the "returns" attribute.  The cv qualifiers must be usable wherever a
type can be referenced.  What if more than one attribute in the same
element specifies a type?  To which does the "const" attribute apply?

> Another suggestion might be to include the GCC_XML version as an
> attribute at the root something like:
>
> <GCC_XML version="0.4.2">

This is a good idea, but it is tricky to implement right now.  The problem
is that the dump is done by xml.c, which is not compiled by GCC_XML's
build process, but instead by the build of the patched GCC to produce
gccxml_cc1plus.  There is no way to configure the version number, and it
will get out of date if it is hard-coded in xml.c.

As a partial solution, I've added this to xml.c in the CVS version:

#if defined(GCCXML_VERSION_FULL)
  fprintf (file, "<GCC_XML version=\"" GCCXML_VERSION_FULL "\">\n");
#else
  fprintf (file, "<GCC_XML>\n");
#endif

You can use this to build a version of gccxml_cc1plus yourself that
includes the version in the dump.  Add -DGCCXML_VERSION_FULL=\"0.5.0\" to
the build flags for xml.o.

In the future, the patched GCC will be included with the main GCC-XML
distribution.  At that time, the configuration of the version number will
work.

-Brad




More information about the gccxml mailing list