[GCC-XML]New cv-qualified type referencing scheme

Brad King brad.king at kitware.com
Fri Oct 3 11:37:00 EDT 2003


Hello GCC-XML Users,

The current GCC-XML dump uses the following technique to reference a
top-level cv-qualified type:

<PointerType id="_1" type="_5"/>       <!-- "int*" -->
<PointerType id="_2" type="_5c"/>      <!-- "int const*" -->
<PointerType id="_3" type="_5v"/>      <!-- "int volatile*" -->
<PointerType id="_4" type="_5cv"/>     <!-- "int const volatile*" -->
<FundamentalType id="_5" name="int"/>

In this example, the type attribute of PointerType contains extra
characters to denote top-level cv-qualifiers in the type to which it
points.  While this is easy to parse when using a language like C++ or
python, it violates the ID/IDREF specification for XML:

http://www.w3.org/TR/REC-xml#id
http://www.w3.org/TR/REC-xml#idref

I'm planning to change the referencing scheme to work like this:

<PointerType id="_1" type="_5"/>       <!-- "int*" -->
<PointerType id="_2" type="_5c"/>      <!-- "int const*" -->
<PointerType id="_3" type="_5v"/>      <!-- "int volatile*" -->
<PointerType id="_4" type="_5cv"/>     <!-- "int const volatile*" -->
<FundamentalType id="_5" name="int"/>
<CvQualifiedType id="_5c" type="_5" const="1"/>
<CvQualifiedType id="_5v" type="_5" volatile="1"/>
<CvQualifiedType id="_5cv" type="_5" const="1" volatile="1"/>

In this approach, the three CvQualifiedType elements correspond to the
FundamentalType element with added cv-qualification.  They are referenced
with standard IDREF attributes by other elements.  Backward-compatibility
is maintained by the special form of the ID attributes of CvQualifiedType
elements.

I'm going to commit the changes for this sometime next week unless anyone
points out a flaw in the design.  Please be prepared to modify your
parsers to handle the new CvQualifiedType element.  The elements can be
safely ignored by parsers that already know how to handle the old
referencing scheme.  New parsers or XSL transformations will be able to
take advantage of the full ID/IDREF support in XML.

-Brad




More information about the gccxml mailing list