[GCC-XML] gccxml 0.9 doesn't parse enum values

Brad King brad.king at kitware.com
Fri Aug 3 08:05:06 EDT 2012


On 08/03/2012 01:28 AM, sundar wrote:
> I have a header file with the following enum definition. 
> 
> enum Example
> {
> one = 10,
> two = 12,
> three = 13
> };
> 
> When I parse using gccxml 0.9 version, I get the following output in xml.
>  <Enumeration id="_49" name="Example" context="_1" location="f0:135" file="f0"
> line="135" size="32" align="32">
>     <EnumValue name="one" init="0"/>
>     <EnumValue name="two" init="1"/>
>     <EnumValue name="three" init="2"/>
>   </Enumeration>
> 
> Is there any way to get the custom values of the enum?

I cannot reproduce it.  I get:

$ cat tenum.cpp
enum Example
{
 one = 10,
 two = 12,
 three = 13
};

$ gccxml tenum.cpp -fxml=tenum.xml -fxml-start=Example

$ cat tenum.xml
<?xml version="1.0"?>
<GCC_XML cvs_revision="">
  <Enumeration id="_1" name="Example" context="_2" location="f0:1" file="f0" line="1" artificial="1" size="32" align="32">
    <EnumValue name="one" init="10"/>
    <EnumValue name="two" init="12"/>
    <EnumValue name="three" init="13"/>
  </Enumeration>
  <Namespace id="_2" name="::" mangled="_Z2::" demangled="::"/>
  <File id="f0" name="tenum.cpp"/>
</GCC_XML>

You can look in GCC/gcc/cp/xml.c at xml_output_enumeral_type
to see where the dump occurs and debug your case.

-Brad



More information about the gccxml mailing list