diff options
author | Marek Polacek <polacek@redhat.com> | 2014-10-24 16:29:56 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-10-24 16:29:56 +0000 |
commit | 90f3520ea50cee07c83bd51a1eced989915a8523 (patch) | |
tree | 3825e01b2814f972b29c284a1989ce1e281e6078 /gcc/c-family/c-pretty-print.c | |
parent | 820aecbf23385cd7c2acc8247dee468e02eeb8e7 (diff) | |
download | gcc-90f3520ea50cee07c83bd51a1eced989915a8523.zip gcc-90f3520ea50cee07c83bd51a1eced989915a8523.tar.gz gcc-90f3520ea50cee07c83bd51a1eced989915a8523.tar.bz2 |
re PR c/56980 (C pretty-printer does not handle well pointer to typedef of struct)
PR c/56980
* c-pretty-print.c (c_pretty_printer::simple_type_specifier): Don't
print "struct"/"union"/"enum" for typedefed names.
* gcc.dg/pr56980.c: New test.
From-SVN: r216674
Diffstat (limited to 'gcc/c-family/c-pretty-print.c')
-rw-r--r-- | gcc/c-family/c-pretty-print.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 3b2dbc1..a4dd93d 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/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) + /* Don't decorate the type if this is a typedef name. */; + else if (code == UNION_TYPE) pp_c_ws_string (this, "union"); else if (code == RECORD_TYPE) pp_c_ws_string (this, "struct"); |