summaryrefslogtreecommitdiff
path: root/gcc/c-pretty-print.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-03 03:30:36 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-03 03:30:36 +0000
commit1d0e61270790687bc7b3d1bb1d6fd4f08da2c17d (patch)
tree0bb7ecb15bb976867a17f2fbee102eb3956a45b4 /gcc/c-pretty-print.c
parent567925e3b55e2cc7285b116f6460365f12e530ed (diff)
downloadgcc-1d0e61270790687bc7b3d1bb1d6fd4f08da2c17d.tar.gz
PR c/24329
* c-pretty-print.c (pp_c_type_specifier): Do not recurse if c_common_type_for_mode returns an unnamed type. testsuite: * gcc.dg/format/unnamed-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106421 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-pretty-print.c')
-rw-r--r--gcc/c-pretty-print.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c
index bbc19be9fd4..5e67a96cf4e 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-pretty-print.c
@@ -323,11 +323,32 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
{
int prec = TYPE_PRECISION (t);
t = c_common_type_for_mode (TYPE_MODE (t), TYPE_UNSIGNED (t));
- pp_c_type_specifier (pp, t);
- if (TYPE_PRECISION (t) != prec)
+ if (TYPE_NAME (t))
+ {
+ pp_c_type_specifier (pp, t);
+ if (TYPE_PRECISION (t) != prec)
+ {
+ pp_string (pp, ":");
+ pp_decimal_int (pp, prec);
+ }
+ }
+ else
{
- pp_string (pp, ":");
+ switch (code)
+ {
+ case INTEGER_TYPE:
+ pp_string (pp, (TYPE_UNSIGNED (t)
+ ? "<unnamed-unsigned:"
+ : "<unnamed-signed:"));
+ break;
+ case REAL_TYPE:
+ pp_string (pp, "<unnamed-float:");
+ break;
+ default:
+ gcc_unreachable ();
+ }
pp_decimal_int (pp, prec);
+ pp_string (pp, ">");
}
}
break;