Hello,

I've been tinkering with getting gccxml-bodies working with the latest
gccxml.  I think I've got everything playing nicely together I've
attached a patch against the latest from cvs for a couple of changes I
did to gccxml.  Thought I would pass them on.

The first fixes a seg fault when a fundamental type does not have a
name.

The second fixes a problem I found while compiling some code where
gccxml is expecting a statement list and it's getting a return
expression or an expression statement.

I've only been hacking at this for a day or two so I don't know if the
fixes I've done are a hack or proper fixes.  Please let me know.

Anyways, I'm compiling qt right now with the latest gccxml and my
version of gccxml-bodies.  And things seem to be humming along just
nicely.. I'm sure I'll find other little issues along the way if you
want patches for them let me know.

Cheers,

Kyle
? test.patch
Index: GCC/gcc/cp/xml.c
===================================================================
RCS file: /cvsroot/GCC_XML/gccxml/GCC/gcc/cp/xml.c,v
retrieving revision 1.129
diff -u -p -r1.129 xml.c
--- GCC/gcc/cp/xml.c	18 Jan 2010 16:42:37 -0000	1.129
+++ GCC/gcc/cp/xml.c	25 Jan 2010 20:00:56 -0000
@@ -648,15 +648,25 @@ xml_document_add_attribute_location(xml_
 static void
 xml_print_endline_attribute (xml_dump_info_p xdi, tree body)
 {
-  /* Get the last statement in the list.  The list may be empty if the
-     body is for an empty implicitly-generated copy-constructor.  */
-  tree_stmt_iterator t = tsi_last(body);
-  if(!tsi_end_p(t))
+  if (TREE_CODE(body) == RETURN_EXPR || TREE_CODE(body) == EXPR_STMT)
     {
-    tree stmt = tsi_stmt(t);
-    if(EXPR_HAS_LOCATION(stmt))
+    if(EXPR_HAS_LOCATION(body))
       {
-      fprintf (xdi->file, " endline=\"%d\"", EXPR_LINENO(stmt));
+      fprintf (xdi->file, " endline=\"%d\"", EXPR_LINENO(body));
+      }
+    }
+  else
+    {
+    /* Get the last statement in the list.  The list may be empty if the
+       body is for an empty implicitly-generated copy-constructor.  */
+    tree_stmt_iterator t = tsi_last(body);
+    if(!tsi_end_p(t))
+      {
+      tree stmt = tsi_stmt(t);
+      if(EXPR_HAS_LOCATION(stmt))
+        {
+        fprintf (xdi->file, " endline=\"%d\"", EXPR_LINENO(stmt));
+        }
       }
     }
 }
@@ -2415,7 +2425,11 @@ xml_output_fundamental_type (xml_dump_in
 {
   fprintf (xdi->file, "  <FundamentalType");
   xml_print_id_attribute (xdi, dn);
-  xml_print_name_attribute (xdi, DECL_NAME (TYPE_NAME (t)));
+  //some fundamental types do not have names
+  if (TYPE_NAME (t))
+    {
+    xml_print_name_attribute (xdi, DECL_NAME (TYPE_NAME (t)));
+    }
   xml_print_attributes_attribute (xdi, TYPE_ATTRIBUTES(t), 0);
   xml_print_size_attribute (xdi, t);
   xml_print_align_attribute (xdi, t);
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.gccxml.org/mailman/listinfo/gccxml

Reply via email to