diff options
Diffstat (limited to 'gcc/c-pretty-print.c')
-rw-r--r-- | gcc/c-pretty-print.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 6276923e794..bbc19be9fd4 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -1137,14 +1137,14 @@ pp_c_initializer_list (c_pretty_printer *pp, tree e) if (TREE_CODE (e) == VECTOR_CST) pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e)); else if (TREE_CODE (e) == CONSTRUCTOR) - pp_c_expression_list (pp, CONSTRUCTOR_ELTS (e)); + pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); else break; return; case COMPLEX_TYPE: if (TREE_CODE (e) == CONSTRUCTOR) - pp_c_expression_list (pp, CONSTRUCTOR_ELTS (e)); + pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) { const bool cst = TREE_CODE (e) == COMPLEX_CST; @@ -1369,6 +1369,22 @@ pp_c_expression_list (c_pretty_printer *pp, tree e) } } +/* Print out V, which contains the elements of a constructor. */ + +void +pp_c_constructor_elts (c_pretty_printer *pp, VEC(constructor_elt,gc) *v) +{ + unsigned HOST_WIDE_INT ix; + tree value; + + FOR_EACH_CONSTRUCTOR_VALUE (v, ix, value) + { + pp_expression (pp, value); + if (ix != VEC_length (constructor_elt, v) - 1) + pp_separate_with (pp, ','); + } +} + /* Print out an expression-list in parens, as in a function call. */ void |