[Bug c/56980] C pretty-printer does not handle well pointer to typedef of struct

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 23 19:24:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56980

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This patch seems to fix it, but I haven't tested it.

--- gcc/c-family/c-pretty-print.c
+++ gcc/c-family/c-pretty-print.c
@@ -416,7 +416,9 @@ c_pretty_printer::simple_type_specifier (tree t)
     case UNION_TYPE:
     case RECORD_TYPE:
     case ENUMERAL_TYPE:
-      if (code == UNION_TYPE)
+      if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
+        ;
+      else if (code == UNION_TYPE)
        pp_c_ws_string (this, "union");
       else if (code == RECORD_TYPE)
        pp_c_ws_string (this, "struct");



More information about the Gcc-bugs mailing list