------- Comment #2 from janus at gcc dot gnu dot org  2009-08-24 19:44 -------
(In reply to comment #1)
> Seems like by design, see tree-pretty-print.c:print_call_name

Thanks for pointing me at the right place.


> Likely for printing prettier member function names.  IMHO we should just
> drop this function on the floor

I wouldn't go as far as dropping the whole function, but at least the part
concerning COMPONENT_REF seems pretty braindead to me. I'd propose to just drop
this and replace it by something more sane, like here:


Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c     (revision 151053)
+++ gcc/tree-pretty-print.c     (working copy)
@@ -2705,19 +2705,6 @@ print_call_name (pretty_printer *buffer,
       dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
       break;

-    case COMPONENT_REF:
-      /* The function is a pointer contained in a structure.  */
-      if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
-         TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
-       dump_function_name (buffer, TREE_OPERAND (op0, 1), flags);
-      else
-       dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
-      /* else
-        We can have several levels of structures and a function
-        pointer inside.  This is not implemented yet...  */
-      /*                 NIY;*/
-      break;
-
     case ARRAY_REF:
       if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
        dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
@@ -2725,6 +2712,7 @@ print_call_name (pretty_printer *buffer,
        dump_generic_node (buffer, op0, 0, flags, false);
       break;

+    case COMPONENT_REF:
     case SSA_NAME:
     case OBJ_TYPE_REF:
       dump_generic_node (buffer, op0, 0, flags, false);


This seems to do the right thing (also for multiply nested function pointers as
in comment #1). Regtesting now ...


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-08-24 09:21:23         |2009-08-24 19:44:09
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41149

Reply via email to