1 /* Subroutines common to both C and C++ pretty-printers.
2 Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #include "coretypes.h"
27 #include "c-pretty-print.h"
30 /* The pretty-printer code is primarily designed to closely follow
31 (GNU) C and C++ grammars. That is to be contrasted with spaghetti
32 codes we used to have in the past. Following a structured
33 approach (preferaably the official grammars) is believed to make it
34 much easier o add extensions and nifty pretty-printing effects that
35 takes expresssion or declaration contexts into account. */
38 #define pp_c_whitespace(PP) \
41 pp_base (PP)->padding = pp_none; \
43 #define pp_c_maybe_whitespace(PP) \
45 if (pp_base (PP)->padding == pp_before) \
46 pp_c_whitespace (PP); \
49 #define pp_c_left_paren(PP) \
52 pp_base (PP)->padding = pp_none; \
55 #define pp_c_right_paren(PP) \
57 pp_right_paren (PP); \
58 pp_base (PP)->padding = pp_none; \
61 #define pp_c_left_brace(PP) \
64 pp_base (PP)->padding = pp_none; \
67 #define pp_c_right_brace(PP) \
69 pp_right_brace (PP); \
70 pp_base (PP)->padding = pp_none; \
73 #define pp_c_left_bracket(PP) \
75 pp_left_bracket (PP); \
76 pp_base (PP)->padding = pp_none; \
79 #define pp_c_right_bracket(PP) \
81 pp_right_bracket (PP); \
82 pp_base (PP)->padding = pp_none; \
85 #define pp_c_arrow(PP) \
88 pp_base (PP)->padding = pp_none; \
91 #define pp_c_star(PP) \
94 pp_base (PP)->padding = pp_none; \
97 #define pp_c_dot(PP) \
100 pp_base (PP)->padding = pp_none; \
103 #define pp_c_semicolon(PP) \
106 pp_base (PP)->padding = pp_none; \
110 static void pp_c_char (c_pretty_printer
, int);
111 static void pp_c_primary_expression (c_pretty_printer
, tree
);
113 /* postfix-expression */
114 static void pp_c_initializer_list (c_pretty_printer
, tree
);
116 static void pp_c_multiplicative_expression (c_pretty_printer
, tree
);
117 static void pp_c_additive_expression (c_pretty_printer
, tree
);
118 static void pp_c_shift_expression (c_pretty_printer
, tree
);
119 static void pp_c_relational_expression (c_pretty_printer
, tree
);
120 static void pp_c_equality_expression (c_pretty_printer
, tree
);
121 static void pp_c_and_expression (c_pretty_printer
, tree
);
122 static void pp_c_exclusive_or_expression (c_pretty_printer
, tree
);
123 static void pp_c_inclusive_or_expression (c_pretty_printer
, tree
);
124 static void pp_c_logical_and_expression (c_pretty_printer
, tree
);
125 static void pp_c_conditional_expression (c_pretty_printer
, tree
);
126 static void pp_c_assignment_expression (c_pretty_printer
, tree
);
129 static void pp_c_declaration_specifiers (c_pretty_printer
, tree
);
130 static void pp_c_direct_abstract_declarator (c_pretty_printer
, tree
);
131 static void pp_c_init_declarator (c_pretty_printer
, tree
);
132 static void pp_c_simple_type_specifier (c_pretty_printer
, tree
);
133 static void pp_c_parameter_declaration (c_pretty_printer
, tree
);
134 static void pp_c_storage_class_specifier (c_pretty_printer
, tree
);
135 static void pp_c_function_specifier (c_pretty_printer
, tree
);
142 pp_c_cv_qualifier (c_pretty_printer pp
, const char *cv
)
144 const char *p
= pp_last_position_in_text (pp
);
145 if (p
!= NULL
&& *p
== '*')
146 pp_c_whitespace (pp
);
147 pp_c_identifier (pp
, cv
);
150 /* C++ cv-qualifiers are called type-qualifiers in C. Print out the
151 cv-qualifiers of T. If T is a declaration then it is the cv-qualifier
152 of its type. Take care of possible extensions.
159 pp_c_type_qualifier_list (c_pretty_printer pp
, tree t
)
166 qualifiers
= TYPE_QUALS (t
);
167 if (qualifiers
& TYPE_QUAL_CONST
)
168 pp_c_cv_qualifier (pp
, "const");
169 if (qualifiers
& TYPE_QUAL_VOLATILE
)
170 pp_c_cv_qualifier (pp
, "volatile");
171 if (qualifiers
& TYPE_QUAL_RESTRICT
)
172 pp_c_cv_qualifier (pp
, flag_isoc99
? "restrict" : "__restrict__");
176 * type-qualifier-list(opt)
177 * type-qualifier-list(opt) pointer */
179 pp_c_pointer (c_pretty_printer pp
, tree t
)
181 if (!TYPE_P (t
) && TREE_CODE (t
) != TYPE_DECL
)
183 switch (TREE_CODE (t
))
186 if (TREE_CODE (TREE_TYPE (t
)) == POINTER_TYPE
)
187 pp_c_pointer (pp
, TREE_TYPE (t
));
189 pp_c_type_qualifier_list (pp
, t
);
193 pp_unsupported_tree (pp
, t
);
198 simple-type-specifier:
214 simple-type-specifier:
218 pp_c_simple_type_specifier (c_pretty_printer ppi
, tree t
)
222 if (DECL_P (t
) && TREE_CODE (t
) != TYPE_DECL
)
225 code
= TREE_CODE (t
);
229 pp_c_identifier (ppi
, "<type-error>");
234 pp_c_identifier (ppi
, "<unkown-type>");
238 case IDENTIFIER_NODE
:
239 pp_c_tree_identifier (ppi
, t
);
247 pp_c_simple_type_specifier (ppi
, TYPE_NAME (t
));
252 pp_c_simple_type_specifier (ppi
, TYPE_MAIN_VARIANT (TREE_TYPE (t
)));
253 if (code
== COMPLEX_TYPE
)
254 pp_c_identifier (ppi
, flag_isoc99
? "_Complex" : "__complex__");
255 else if (code
== VECTOR_TYPE
)
256 pp_c_identifier (ppi
, "__vector__");
261 pp_id_expression (ppi
, t
);
263 pp_c_identifier (ppi
, "<typedef-error>");
269 if (code
== UNION_TYPE
)
270 pp_c_identifier (ppi
, "union");
271 else if (code
== RECORD_TYPE
)
272 pp_c_identifier (ppi
, "struct");
273 else if (code
== ENUMERAL_TYPE
)
274 pp_c_identifier (ppi
, "enum");
276 pp_c_identifier (ppi
, "<tag-error>");
279 pp_id_expression (ppi
, TYPE_NAME (t
));
281 pp_c_identifier (ppi
, "<anonymous>");
287 pp_c_simple_type_specifier (ppi
, TREE_TYPE (t
));
291 pp_unsupported_tree (ppi
, t
);
296 /* specifier-qualifier-list:
297 type-specifier specifier-qualifier-list-opt
298 cv-qualifier specifier-qualifier-list-opt
301 Implementation note: Because of the non-linearities in array or
302 function declarations, this routinie prints not just the
303 specifier-qualifier-list of such entities or types of such entities,
304 but also the 'pointer' production part of their declarators. The
305 remaining part is done by pp_declarator or pp_c_abstract_declarator. */
307 pp_c_specifier_qualifier_list (c_pretty_printer pp
, tree t
)
309 if (TREE_CODE (t
) != POINTER_TYPE
)
310 pp_c_type_qualifier_list (pp
, t
);
311 switch (TREE_CODE (t
))
315 /* Get the types-specifier of this type. */
316 tree pointee
= TREE_TYPE (t
);
317 while (TREE_CODE (pointee
) == POINTER_TYPE
)
318 pointee
= TREE_TYPE (pointee
);
319 pp_c_specifier_qualifier_list (pp
, pointee
);
320 if (TREE_CODE (pointee
) == ARRAY_TYPE
321 || TREE_CODE (pointee
) == FUNCTION_TYPE
)
323 pp_c_whitespace (pp
);
324 pp_c_left_paren (pp
);
326 pp_c_pointer (pp
, t
);
327 if (TREE_CODE (pointee
) != FUNCTION_TYPE
328 && TREE_CODE (pointee
) != ARRAY_TYPE
)
329 pp_c_whitespace (pp
);
335 pp_c_specifier_qualifier_list (pp
, TREE_TYPE (t
));
340 pp_c_specifier_qualifier_list (pp
, TREE_TYPE (t
));
342 pp_c_simple_type_specifier (pp
, t
);
346 pp_c_simple_type_specifier (pp
, t
);
351 /* parameter-type-list:
356 parameter-declaration
357 parameter-list , parameter-declaration
359 parameter-declaration:
360 declaration-specifiers declarator
361 declaration-specifiers abstract-declarator(opt) */
363 pp_c_parameter_type_list (c_pretty_printer pp
, tree t
)
365 pp_c_left_paren (pp
);
366 if (t
== void_list_node
)
367 pp_c_identifier (pp
, "void");
371 bool want_parm_decl
= t
&& DECL_P (t
);
372 for ( ; t
!= NULL
&& t
!= void_list_node
; t
= TREE_CHAIN (t
))
375 pp_separate_with (pp
, ',');
377 pp_declaration_specifiers (pp
, want_parm_decl
? t
: TREE_VALUE (t
));
379 pp_declarator (pp
, t
);
381 pp_abstract_declarator (pp
, TREE_VALUE (t
));
384 pp_c_right_paren (pp
);
387 /* abstract-declarator:
389 pointer(opt) direct-abstract-declarator */
391 pp_c_abstract_declarator (c_pretty_printer pp
, tree t
)
393 if (TREE_CODE (t
) == POINTER_TYPE
)
395 if (TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
396 || TREE_CODE (TREE_TYPE (t
)) == FUNCTION_TYPE
)
397 pp_c_right_paren (pp
);
401 pp_c_direct_abstract_declarator (pp
, t
);
404 /* direct-abstract-declarator:
405 ( abstract-declarator )
406 direct-abstract-declarator(opt) [ assignment-expression(opt) ]
407 direct-abstract-declarator(opt) [ * ]
408 direct-abstract-declarator(opt) ( parameter-type-list(opt) ) */
410 pp_c_direct_abstract_declarator (c_pretty_printer pp
, tree t
)
412 switch (TREE_CODE (t
))
415 pp_c_abstract_declarator (pp
, t
);
419 pp_c_parameter_type_list (pp
, TYPE_ARG_TYPES (t
));
420 pp_c_direct_abstract_declarator (pp
, TREE_TYPE (t
));
424 pp_c_left_bracket (pp
);
426 pp_c_expression (pp
, TYPE_MAX_VALUE (TYPE_DOMAIN (t
)));
427 pp_c_right_bracket (pp
);
428 pp_c_direct_abstract_declarator (pp
, TREE_TYPE (t
));
431 case IDENTIFIER_NODE
:
445 pp_unsupported_tree (pp
, t
);
451 pp_c_type_id (c_pretty_printer ppi
, tree t
)
453 pp_c_specifier_qualifier_list (ppi
, t
);
454 pp_abstract_declarator (ppi
, t
);
458 pp_c_storage_class_specifier (c_pretty_printer pp
, tree t
)
460 if (TREE_CODE (t
) == TYPE_DECL
)
461 pp_c_identifier (pp
, "typedef");
464 if (DECL_REGISTER (t
))
465 pp_c_identifier (pp
, "register");
466 else if (TREE_STATIC (t
) && TREE_CODE (t
) == VAR_DECL
)
467 pp_c_identifier (pp
, "static");
472 pp_c_function_specifier (c_pretty_printer pp
, tree t
)
474 if (TREE_CODE (t
) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (t
))
475 pp_c_identifier (pp
, "inline");
478 /* declaration-specifiers:
479 storage-class-specifier declaration-specifiers(opt)
480 type-specifier declaration-specifiers(opt)
481 type-qualifier declaration-specifiers(opt)
482 function-specifier declaration-specifiers(opt) */
484 pp_c_declaration_specifiers (c_pretty_printer pp
, tree t
)
486 pp_storage_class_specifier (pp
, t
);
487 pp_function_specifier (pp
, t
);
488 pp_c_specifier_qualifier_list (pp
, DECL_P (t
) ? TREE_TYPE (t
) : t
);
494 direct-declarator [ type-qualifier-list(opt) assignment-expression(opt) ]
495 direct-declarator [ static type-qualifier-list(opt) assignment-expression(opt)]
496 direct-declarator [ type-qualifier-list static assignment-exression ]
497 direct-declarator [ type-qualifier-list * ]
498 direct-declaratpr ( parameter-type-list )
499 direct-declarator ( identifier-list(opt) ) */
501 pp_c_direct_declarator (c_pretty_printer pp
, tree t
)
503 switch (TREE_CODE (t
))
510 pp_c_tree_identifier (pp
, DECL_NAME (t
));
513 pp_abstract_declarator (pp
, TREE_TYPE (t
));
517 pp_c_parameter_type_list (pp
, TYPE_ARG_TYPES (t
));
518 pp_c_abstract_declarator (pp
, TREE_TYPE (t
));
522 pp_c_tree_identifier (pp
, DECL_NAME (t
));
523 if (pp_c_base (pp
)->flags
& pp_c_flag_abstract
)
524 pp_c_abstract_declarator (pp
, TREE_TYPE (t
));
527 pp_c_parameter_type_list (pp
, DECL_ARGUMENTS (t
));
528 pp_c_abstract_declarator (pp
, TREE_TYPE (TREE_TYPE (t
)));
540 pp_unsupported_tree (pp
, t
);
547 pointer(opt) direct-declarator */
549 pp_c_declarator (c_pretty_printer pp
, tree t
)
551 switch (TREE_CODE (t
))
567 pp_direct_declarator (pp
, t
);
572 pp_unsupported_tree (pp
, t
);
579 declarator = initializer */
581 pp_c_init_declarator (c_pretty_printer pp
, tree t
)
583 pp_declarator (pp
, t
);
584 if (DECL_INITIAL (t
))
589 pp_c_initializer (pp
, DECL_INITIAL (t
));
594 declaration-specifiers init-declarator-list(opt) ; */
597 pp_c_declaration (c_pretty_printer pp
, tree t
)
599 pp_declaration_specifiers (pp
, t
);
600 pp_c_init_declarator (pp
, t
);
604 pp_c_parameter_declaration (c_pretty_printer pp
, tree t
)
606 pp_unsupported_tree (pp
, t
);
609 /* Pretty-print ATTRIBUTES using GNU C extension syntax. */
611 pp_c_attributes (c_pretty_printer pp
, tree attributes
)
613 if (attributes
== NULL_TREE
)
616 pp_c_identifier (pp
, "__attribute__");
617 pp_c_left_paren (pp
);
618 pp_c_left_paren (pp
);
619 for (; attributes
!= NULL_TREE
; attributes
= TREE_CHAIN (attributes
))
621 pp_tree_identifier (pp
, TREE_PURPOSE (attributes
));
622 if (TREE_VALUE (attributes
))
624 pp_c_left_paren (pp
);
625 pp_c_expression_list (pp
, TREE_VALUE (attributes
));
626 pp_c_right_paren (pp
);
629 if (TREE_CHAIN (attributes
))
630 pp_separate_with (pp
, ',');
632 pp_c_right_paren (pp
);
633 pp_c_right_paren (pp
);
636 /* function-definition:
637 declaration-specifiers declarator compound-statement */
639 pp_c_function_definition (c_pretty_printer pp
, tree t
)
641 pp_declaration_specifiers (pp
, t
);
642 pp_declarator (pp
, t
);
643 pp_needs_newline (pp
) = true;
644 pp_statement (pp
, DECL_SAVED_TREE (t
));
652 /* Print out a c-char. */
654 pp_c_char (c_pretty_printer ppi
, int c
)
659 pp_string (ppi
, "\\n");
662 pp_string (ppi
, "\\t");
665 pp_string (ppi
, "\\v");
668 pp_string (ppi
, "\\b");
671 pp_string (ppi
, "\\r");
674 pp_string (ppi
, "\\f");
677 pp_string (ppi
, "\\a");
680 pp_string (ppi
, "\\\\");
683 pp_string (ppi
, "\\'");
686 pp_string (ppi
, "\\\"");
690 pp_character (ppi
, c
);
692 pp_scalar (ppi
, "\\%03o", (unsigned) c
);
697 /* Print out a STRING literal. */
699 pp_c_string_literal (c_pretty_printer ppi
, tree s
)
701 const char *p
= TREE_STRING_POINTER (s
);
702 int n
= TREE_STRING_LENGTH (s
) - 1;
704 pp_doublequote (ppi
);
705 for (i
= 0; i
< n
; ++i
)
706 pp_c_char (ppi
, p
[i
]);
707 pp_doublequote (ppi
);
711 pp_c_integer_constant (c_pretty_printer pp
, tree i
)
713 if (host_integerp (i
, 0))
714 pp_wide_integer (pp
, TREE_INT_CST_LOW (i
));
717 if (tree_int_cst_sgn (i
) < 0)
720 i
= build_int_2 (-TREE_INT_CST_LOW (i
),
721 ~TREE_INT_CST_HIGH (i
) + !TREE_INT_CST_LOW (i
));
723 sprintf (pp_buffer (pp
)->digit_buffer
,
724 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
725 TREE_INT_CST_HIGH (i
), TREE_INT_CST_LOW (i
));
726 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
730 /* Print out a CHARACTER literal. */
732 pp_c_character_constant (c_pretty_printer pp
, tree c
)
734 tree type
= TREE_TYPE (c
);
735 if (type
== wchar_type_node
)
736 pp_character (pp
, 'L');
738 if (host_integerp (c
, TREE_UNSIGNED (type
)))
739 pp_c_char (pp
, tree_low_cst (c
, TREE_UNSIGNED (type
)));
741 pp_scalar (pp
, "\\x%x", (unsigned) TREE_INT_CST_LOW (c
));
745 /* Print out a BOOLEAN literal. */
747 pp_c_bool_constant (c_pretty_printer pp
, tree b
)
749 if (b
== boolean_false_node
)
751 if (c_dialect_cxx ())
752 pp_c_identifier (pp
, "false");
753 else if (flag_isoc99
)
754 pp_c_identifier (pp
, "_False");
756 pp_unsupported_tree (pp
, b
);
758 else if (b
== boolean_true_node
)
760 if (c_dialect_cxx ())
761 pp_c_identifier (pp
, "true");
762 else if (flag_isoc99
)
763 pp_c_identifier (pp
, "_True");
765 pp_unsupported_tree (pp
, b
);
767 else if (TREE_CODE (b
) == INTEGER_CST
)
768 pp_c_integer_constant (pp
, b
);
770 pp_unsupported_tree (pp
, b
);
773 /* Attempt to print out an ENUMERATOR. Return true on success. Else return
774 false; that means the value was obtained by a cast, in which case
775 print out the type-id part of the cast-expression -- the casted value
776 is then printed by pp_c_integer_literal. */
778 pp_c_enumeration_constant (c_pretty_printer ppi
, tree e
)
780 bool value_is_named
= true;
781 tree type
= TREE_TYPE (e
);
784 /* Find the name of this constant. */
785 for (value
= TYPE_VALUES (type
);
786 value
!= NULL_TREE
&& !tree_int_cst_equal (TREE_VALUE (value
), e
);
787 value
= TREE_CHAIN (value
))
790 if (value
!= NULL_TREE
)
791 pp_id_expression (ppi
, TREE_PURPOSE (value
));
794 /* Value must have been cast. */
795 pp_c_left_paren (ppi
);
796 pp_type_id (ppi
, type
);
797 pp_c_right_paren (ppi
);
798 value_is_named
= false;
801 return value_is_named
;
804 /* Print out a REAL value. */
806 pp_c_floating_constant (c_pretty_printer pp
, tree r
)
808 real_to_decimal (pp_buffer (pp
)->digit_buffer
, &TREE_REAL_CST (r
),
809 sizeof (pp_buffer (pp
)->digit_buffer
), 0, 1);
810 pp_string (pp
, pp_buffer(pp
)->digit_buffer
);
817 chatracter-constant */
819 pp_c_constant (c_pretty_printer pp
, tree e
)
821 switch (TREE_CODE (e
))
825 tree type
= TREE_TYPE (e
);
826 if (type
== boolean_type_node
)
827 pp_c_bool_constant (pp
, e
);
828 else if (type
== char_type_node
)
829 pp_c_character_constant (pp
, e
);
830 else if (TREE_CODE (type
) == ENUMERAL_TYPE
831 && pp_c_enumeration_constant (pp
, e
))
834 pp_c_integer_constant (pp
, e
);
839 pp_c_floating_constant (pp
, e
);
843 pp_c_string_literal (pp
, e
);
847 pp_unsupported_tree (pp
, e
);
853 pp_c_identifier (c_pretty_printer pp
, const char *id
)
855 pp_c_maybe_whitespace (pp
);
856 pp_identifier (pp
, id
);
857 pp_base (pp
)->padding
= pp_before
;
860 /* Pretty-print a C primary-expression.
867 pp_c_primary_expression (c_pretty_printer ppi
, tree e
)
869 switch (TREE_CODE (e
))
879 case IDENTIFIER_NODE
:
880 pp_c_tree_identifier (ppi
, e
);
884 pp_c_identifier (ppi
, "<erroneous-expression>");
888 pp_c_identifier (ppi
, "<return-value>");
894 pp_c_constant (ppi
, e
);
898 pp_c_left_paren (ppi
);
899 pp_c_identifier (ppi
, "__builtin_memcpy");
900 pp_c_left_paren (ppi
);
902 pp_primary_expression (ppi
, TREE_OPERAND (e
, 0));
903 pp_separate_with (ppi
, ',');
905 pp_initializer (ppi
, TREE_OPERAND (e
, 1));
906 if (TREE_OPERAND (e
, 2))
908 pp_separate_with (ppi
, ',');
909 pp_c_expression (ppi
, TREE_OPERAND (e
, 2));
911 pp_c_right_paren (ppi
);
914 pp_c_left_paren (ppi
);
915 pp_statement (ppi
, STMT_EXPR_STMT (e
));
916 pp_c_right_paren (ppi
);
920 /* FIXME: Make sure we won't get into an infinie loop. */
921 pp_c_left_paren (ppi
);
922 pp_c_expression (ppi
, e
);
923 pp_c_right_paren (ppi
);
928 /* Print out a C initializer -- also support C compound-literals.
930 assignment-expression:
932 { initializer-list , } */
935 pp_c_initializer (c_pretty_printer ppi
, tree e
)
937 if (TREE_CODE (e
) == CONSTRUCTOR
)
939 enum tree_code code
= TREE_CODE (TREE_TYPE (e
));
940 if (code
== RECORD_TYPE
|| code
== UNION_TYPE
|| code
== ARRAY_TYPE
)
942 pp_c_left_brace (ppi
);
943 pp_c_initializer_list (ppi
, e
);
944 pp_c_right_brace (ppi
);
947 pp_unsupported_tree (ppi
, TREE_OPERAND (e
, 1));
950 pp_assignment_expression (ppi
, e
);
954 designation(opt) initializer
955 initializer-list , designation(opt) initializer
962 designator-list designator
965 [ constant-expression ]
968 pp_c_initializer_list (c_pretty_printer ppi
, tree e
)
970 tree type
= TREE_TYPE (e
);
971 const enum tree_code code
= TREE_CODE (type
);
973 if (code
== RECORD_TYPE
|| code
== UNION_TYPE
|| code
== ARRAY_TYPE
)
975 tree init
= TREE_OPERAND (e
, 0);
976 for (; init
!= NULL_TREE
; init
= TREE_CHAIN (init
))
978 if (code
== RECORD_TYPE
|| code
== UNION_TYPE
)
981 pp_c_primary_expression (ppi
, TREE_PURPOSE (init
));
985 pp_c_left_bracket (ppi
);
986 if (TREE_PURPOSE (init
))
987 pp_c_constant (ppi
, TREE_PURPOSE (init
));
988 pp_c_right_bracket (ppi
);
990 pp_c_whitespace (ppi
);
992 pp_c_whitespace (ppi
);
993 pp_initializer (ppi
, TREE_VALUE (init
));
994 if (TREE_CHAIN (init
))
995 pp_separate_with (ppi
, ',');
999 pp_unsupported_tree (ppi
, type
);
1002 /* This is a convenient function, used to bridge gap between C and C++
1008 pp_c_id_expression (c_pretty_printer pp
, tree t
)
1010 switch (TREE_CODE (t
))
1020 case IDENTIFIER_NODE
:
1021 pp_c_tree_identifier (pp
, t
);
1025 pp_unsupported_tree (pp
, t
);
1030 /* postfix-expression:
1032 postfix-expression [ expression ]
1033 postfix-expression ( argument-expression-list(opt) )
1034 postfix-expression . identifier
1035 postfix-expression -> identifier
1036 postfix-expression ++
1037 postfix-expression --
1038 ( type-name ) { initializer-list }
1039 ( type-name ) { initializer-list , } */
1041 pp_c_postfix_expression (c_pretty_printer ppi
, tree e
)
1043 enum tree_code code
= TREE_CODE (e
);
1046 case POSTINCREMENT_EXPR
:
1047 case POSTDECREMENT_EXPR
:
1048 pp_postfix_expression (ppi
, TREE_OPERAND (e
, 0));
1049 pp_identifier (ppi
, code
== POSTINCREMENT_EXPR
? "++" : "--");
1053 pp_postfix_expression (ppi
, TREE_OPERAND (e
, 0));
1058 pp_postfix_expression (ppi
, TREE_OPERAND (e
, 0));
1059 pp_c_left_bracket (ppi
);
1060 pp_c_expression (ppi
, TREE_OPERAND (e
, 1));
1061 pp_c_right_bracket (ppi
);
1065 pp_postfix_expression (ppi
, TREE_OPERAND (e
, 0));
1066 pp_c_left_paren (ppi
);
1067 pp_c_expression_list (ppi
, TREE_OPERAND (e
, 1));
1068 pp_c_right_paren (ppi
);
1073 pp_c_identifier (ppi
,
1074 code
== ABS_EXPR
? "__builtin_abs" : "__builtin_ffs");
1075 pp_c_left_paren (ppi
);
1076 pp_c_expression (ppi
, TREE_OPERAND (e
, 0));
1077 pp_c_right_paren (ppi
);
1082 tree object
= TREE_OPERAND (e
, 0);
1083 if (TREE_CODE (object
) == INDIRECT_REF
)
1085 pp_postfix_expression (ppi
, TREE_OPERAND (object
, 0));
1090 pp_postfix_expression (ppi
, object
);
1093 pp_c_expression (ppi
, TREE_OPERAND (e
, 1));
1100 pp_c_left_paren (ppi
);
1101 pp_type_id (ppi
, TREE_TYPE (e
));
1102 pp_c_right_paren (ppi
);
1103 pp_c_left_brace (ppi
);
1105 if (code
== COMPLEX_CST
)
1107 pp_c_expression (ppi
, TREE_REALPART (e
));
1108 pp_separate_with (ppi
, ',');
1109 pp_c_expression (ppi
, TREE_IMAGPART (e
));
1111 else if (code
== VECTOR_CST
)
1112 pp_c_expression_list (ppi
, TREE_VECTOR_CST_ELTS (e
));
1113 else if (code
== COMPLEX_EXPR
)
1115 pp_c_expression (ppi
, TREE_OPERAND (e
, 0));
1116 pp_separate_with (ppi
, ',');
1117 pp_c_expression (ppi
, TREE_OPERAND (e
, 1));
1120 pp_c_right_brace (ppi
);
1123 case COMPOUND_LITERAL_EXPR
:
1124 e
= DECL_INITIAL (e
);
1127 pp_initializer (ppi
, e
);
1131 pp_c_identifier (ppi
, "__builtin_va_arg");
1132 pp_c_left_paren (ppi
);
1133 pp_assignment_expression (ppi
, TREE_OPERAND (e
, 0));
1134 pp_separate_with (ppi
, ',');
1135 pp_type_id (ppi
, TREE_TYPE (e
));
1136 pp_c_right_paren (ppi
);
1140 if (TREE_CODE (TREE_OPERAND (e
, 0)) == FUNCTION_DECL
)
1142 pp_c_id_expression (ppi
, TREE_OPERAND (e
, 0));
1145 /* else fall through. */
1148 pp_primary_expression (ppi
, e
);
1153 /* Print out an expression-list; E is expected to be a TREE_LIST */
1155 pp_c_expression_list (c_pretty_printer ppi
, tree e
)
1157 for (; e
!= NULL_TREE
; e
= TREE_CHAIN (e
))
1159 pp_c_assignment_expression (ppi
, TREE_VALUE (e
));
1161 pp_separate_with (ppi
, ',');
1165 /* unary-expression:
1169 unary-operator cast-expression
1170 sizeof unary-expression
1173 unary-operator: one of
1178 __alignof__ unary-expression
1179 __alignof__ ( type-id )
1180 __real__ unary-expression
1181 __imag__ unary-expression */
1183 pp_c_unary_expression (c_pretty_printer ppi
, tree e
)
1185 enum tree_code code
= TREE_CODE (e
);
1188 case PREINCREMENT_EXPR
:
1189 case PREDECREMENT_EXPR
:
1190 pp_identifier (ppi
, code
== PREINCREMENT_EXPR
? "++" : "--");
1191 pp_c_unary_expression (ppi
, TREE_OPERAND (e
, 0));
1198 case TRUTH_NOT_EXPR
:
1200 /* String literal are used by address. */
1201 if (code
== ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (e
, 0)) != STRING_CST
)
1203 else if (code
== INDIRECT_REF
)
1205 else if (code
== NEGATE_EXPR
)
1207 else if (code
== BIT_NOT_EXPR
|| code
== CONJ_EXPR
)
1208 pp_complement (ppi
);
1209 else if (code
== TRUTH_NOT_EXPR
)
1210 pp_exclamation (ppi
);
1211 pp_c_cast_expression (ppi
, TREE_OPERAND (e
, 0));
1216 pp_c_identifier (ppi
, code
== SIZEOF_EXPR
? "sizeof" : "__alignof__");
1217 pp_c_whitespace (ppi
);
1218 if (TYPE_P (TREE_OPERAND (e
, 0)))
1220 pp_c_left_paren (ppi
);
1221 pp_type_id (ppi
, TREE_OPERAND (e
, 0));
1222 pp_c_right_paren (ppi
);
1225 pp_unary_expression (ppi
, TREE_OPERAND (e
, 0));
1230 pp_c_identifier (ppi
, code
== REALPART_EXPR
? "__real__" : "__imag__");
1231 pp_c_whitespace (ppi
);
1232 pp_unary_expression (ppi
, TREE_OPERAND (e
, 0));
1236 pp_postfix_expression (ppi
, e
);
1242 pp_c_cast_expression (c_pretty_printer ppi
, tree e
)
1244 switch (TREE_CODE (e
))
1247 case FIX_TRUNC_EXPR
:
1249 pp_c_left_paren (ppi
);
1250 pp_type_id (ppi
, TREE_TYPE (e
));
1251 pp_c_right_paren (ppi
);
1252 pp_c_cast_expression (ppi
, TREE_OPERAND (e
, 0));
1256 pp_unary_expression (ppi
, e
);
1261 pp_c_multiplicative_expression (c_pretty_printer ppi
, tree e
)
1263 enum tree_code code
= TREE_CODE (e
);
1267 case TRUNC_DIV_EXPR
:
1268 case TRUNC_MOD_EXPR
:
1269 pp_multiplicative_expression (ppi
, TREE_OPERAND (e
, 0));
1270 pp_c_whitespace (ppi
);
1271 if (code
== MULT_EXPR
)
1273 else if (code
== TRUNC_DIV_EXPR
)
1277 pp_c_whitespace (ppi
);
1278 pp_c_cast_expression (ppi
, TREE_OPERAND (e
, 1));
1282 pp_c_cast_expression (ppi
, e
);
1288 pp_c_additive_expression (c_pretty_printer ppi
, tree e
)
1290 enum tree_code code
= TREE_CODE (e
);
1295 pp_c_additive_expression (ppi
, TREE_OPERAND (e
, 0));
1296 pp_c_whitespace (ppi
);
1297 if (code
== PLUS_EXPR
)
1301 pp_c_whitespace (ppi
);
1302 pp_multiplicative_expression (ppi
, TREE_OPERAND (e
, 1));
1306 pp_multiplicative_expression (ppi
, e
);
1312 pp_c_shift_expression (c_pretty_printer ppi
, tree e
)
1314 enum tree_code code
= TREE_CODE (e
);
1319 pp_c_shift_expression (ppi
, TREE_OPERAND (e
, 0));
1320 pp_c_whitespace (ppi
);
1321 pp_identifier (ppi
, code
== LSHIFT_EXPR
? "<<" : ">>");
1322 pp_c_whitespace (ppi
);
1323 pp_c_additive_expression (ppi
, TREE_OPERAND (e
, 1));
1327 pp_c_additive_expression (ppi
, e
);
1332 pp_c_relational_expression (c_pretty_printer ppi
, tree e
)
1334 enum tree_code code
= TREE_CODE (e
);
1341 pp_c_relational_expression (ppi
, TREE_OPERAND (e
, 0));
1342 pp_c_whitespace (ppi
);
1343 if (code
== LT_EXPR
)
1345 else if (code
== GT_EXPR
)
1347 else if (code
== LE_EXPR
)
1348 pp_identifier (ppi
, "<=");
1349 else if (code
== GE_EXPR
)
1350 pp_identifier (ppi
, ">=");
1351 pp_c_whitespace (ppi
);
1352 pp_c_shift_expression (ppi
, TREE_OPERAND (e
, 1));
1356 pp_c_shift_expression (ppi
, e
);
1362 pp_c_equality_expression (c_pretty_printer ppi
, tree e
)
1364 enum tree_code code
= TREE_CODE (e
);
1369 pp_c_equality_expression (ppi
, TREE_OPERAND (e
, 0));
1370 pp_c_whitespace (ppi
);
1371 pp_identifier (ppi
, code
== EQ_EXPR
? "==" : "!=");
1372 pp_c_whitespace (ppi
);
1373 pp_c_relational_expression (ppi
, TREE_OPERAND (e
, 1));
1377 pp_c_relational_expression (ppi
, e
);
1383 pp_c_and_expression (c_pretty_printer ppi
, tree e
)
1385 if (TREE_CODE (e
) == BIT_AND_EXPR
)
1387 pp_c_and_expression (ppi
, TREE_OPERAND (e
, 0));
1388 pp_c_whitespace (ppi
);
1390 pp_c_whitespace (ppi
);
1391 pp_c_equality_expression (ppi
, TREE_OPERAND (e
, 1));
1394 pp_c_equality_expression (ppi
, e
);
1398 pp_c_exclusive_or_expression (c_pretty_printer ppi
, tree e
)
1400 if (TREE_CODE (e
) == BIT_XOR_EXPR
)
1402 pp_c_exclusive_or_expression (ppi
, TREE_OPERAND (e
, 0));
1403 pp_c_maybe_whitespace (ppi
);
1405 pp_c_whitespace (ppi
);
1406 pp_c_and_expression (ppi
, TREE_OPERAND (e
, 1));
1409 pp_c_and_expression (ppi
, e
);
1413 pp_c_inclusive_or_expression (c_pretty_printer ppi
, tree e
)
1415 if (TREE_CODE (e
) == BIT_IOR_EXPR
)
1417 pp_c_exclusive_or_expression (ppi
, TREE_OPERAND (e
, 0));
1418 pp_c_whitespace (ppi
);
1420 pp_c_whitespace (ppi
);
1421 pp_c_exclusive_or_expression (ppi
, TREE_OPERAND (e
, 1));
1424 pp_c_exclusive_or_expression (ppi
, e
);
1428 pp_c_logical_and_expression (c_pretty_printer ppi
, tree e
)
1430 if (TREE_CODE (e
) == TRUTH_ANDIF_EXPR
)
1432 pp_c_logical_and_expression (ppi
, TREE_OPERAND (e
, 0));
1433 pp_c_whitespace (ppi
);
1434 pp_identifier (ppi
, "&&");
1435 pp_c_whitespace (ppi
);
1436 pp_c_inclusive_or_expression (ppi
, TREE_OPERAND (e
, 1));
1439 pp_c_inclusive_or_expression (ppi
, e
);
1443 pp_c_logical_or_expression (c_pretty_printer ppi
, tree e
)
1445 if (TREE_CODE (e
) == TRUTH_ORIF_EXPR
)
1447 pp_c_logical_or_expression (ppi
, TREE_OPERAND (e
, 0));
1448 pp_c_whitespace (ppi
);
1449 pp_identifier (ppi
, "||");
1450 pp_c_whitespace (ppi
);
1451 pp_c_logical_and_expression (ppi
, TREE_OPERAND (e
, 1));
1454 pp_c_logical_and_expression (ppi
, e
);
1458 pp_c_conditional_expression (c_pretty_printer ppi
, tree e
)
1460 if (TREE_CODE (e
) == COND_EXPR
)
1462 pp_c_logical_or_expression (ppi
, TREE_OPERAND (e
, 0));
1463 pp_c_whitespace (ppi
);
1465 pp_c_whitespace (ppi
);
1466 pp_c_expression (ppi
, TREE_OPERAND (e
, 1));
1467 pp_c_maybe_whitespace (ppi
);
1469 pp_c_whitespace (ppi
);
1470 pp_c_conditional_expression (ppi
, TREE_OPERAND (e
, 2));
1473 pp_c_logical_or_expression (ppi
, e
);
1477 /* Pretty-print a C assignment-expression. */
1479 pp_c_assignment_expression (c_pretty_printer ppi
, tree e
)
1481 if (TREE_CODE (e
) == MODIFY_EXPR
|| TREE_CODE (e
) == INIT_EXPR
)
1483 pp_c_unary_expression (ppi
, TREE_OPERAND (e
, 0));
1484 pp_c_maybe_whitespace (ppi
);
1487 pp_c_assignment_expression (ppi
, TREE_OPERAND (e
, 1));
1490 pp_c_conditional_expression (ppi
, e
);
1493 /* Pretty-print an expression. */
1495 pp_c_expression (c_pretty_printer ppi
, tree e
)
1497 switch (TREE_CODE (e
))
1500 pp_c_integer_constant (ppi
, e
);
1504 pp_c_floating_constant (ppi
, e
);
1508 pp_c_string_literal (ppi
, e
);
1521 pp_primary_expression (ppi
, e
);
1524 case POSTINCREMENT_EXPR
:
1525 case POSTDECREMENT_EXPR
:
1535 case COMPOUND_LITERAL_EXPR
:
1538 pp_postfix_expression (ppi
, e
);
1546 case TRUTH_NOT_EXPR
:
1547 case PREINCREMENT_EXPR
:
1548 case PREDECREMENT_EXPR
:
1553 pp_c_unary_expression (ppi
, e
);
1557 case FIX_TRUNC_EXPR
:
1559 pp_c_cast_expression (ppi
, e
);
1563 case TRUNC_MOD_EXPR
:
1564 case TRUNC_DIV_EXPR
:
1565 pp_multiplicative_expression (ppi
, e
);
1570 pp_c_shift_expression (ppi
, e
);
1577 pp_c_relational_expression (ppi
, e
);
1581 pp_c_and_expression (ppi
, e
);
1585 pp_c_exclusive_or_expression (ppi
, e
);
1589 pp_c_inclusive_or_expression (ppi
, e
);
1592 case TRUTH_ANDIF_EXPR
:
1593 pp_c_logical_and_expression (ppi
, e
);
1596 case TRUTH_ORIF_EXPR
:
1597 pp_c_logical_or_expression (ppi
, e
);
1602 pp_c_equality_expression (ppi
, e
);
1606 pp_conditional_expression (ppi
, e
);
1611 pp_c_additive_expression (ppi
, e
);
1616 pp_assignment_expression (ppi
, e
);
1620 pp_c_left_paren (ppi
);
1621 pp_c_expression (ppi
, TREE_OPERAND (e
, 0));
1622 pp_separate_with (ppi
, ',');
1623 pp_assignment_expression (ppi
, TREE_OPERAND (e
, 1));
1624 pp_c_right_paren (ppi
);
1628 case NON_LVALUE_EXPR
:
1631 pp_c_expression (ppi
, TREE_OPERAND (e
, 0));
1635 pp_unsupported_tree (ppi
, e
);
1644 pp_c_statement (c_pretty_printer ppi
, tree stmt
)
1646 enum tree_code code
;
1651 code
= TREE_CODE (stmt
);
1656 if (pp_needs_newline (ppi
))
1657 pp_newline_and_indent (ppi
, -3);
1659 pp_indentation (ppi
) -= 3;
1660 if (code
== LABEL_STMT
)
1661 pp_tree_identifier (ppi
, DECL_NAME (LABEL_STMT_LABEL (stmt
)));
1662 else if (code
== CASE_LABEL
)
1664 if (CASE_LOW (stmt
) == NULL_TREE
)
1665 pp_identifier (ppi
, "default");
1668 pp_c_identifier (ppi
, "case");
1669 pp_c_whitespace (ppi
);
1670 pp_conditional_expression (ppi
, CASE_LOW (stmt
));
1671 if (CASE_HIGH (stmt
))
1673 pp_identifier (ppi
, "...");
1674 pp_conditional_expression (ppi
, CASE_HIGH (stmt
));
1679 pp_indentation (ppi
) += 3;
1680 pp_needs_newline (ppi
) = true;
1684 if (pp_needs_newline (ppi
))
1685 pp_newline_and_indent (ppi
, 0);
1686 pp_c_left_brace (ppi
);
1687 pp_newline_and_indent (ppi
, 3);
1688 for (stmt
= COMPOUND_BODY (stmt
); stmt
; stmt
= TREE_CHAIN (stmt
))
1689 pp_c_statement (ppi
, stmt
);
1690 pp_newline_and_indent (ppi
, -3);
1691 pp_c_right_brace (ppi
);
1692 pp_needs_newline (ppi
) = true;
1697 if (pp_needs_newline (ppi
))
1698 pp_newline_and_indent (ppi
, 0);
1700 tree e
= code
== EXPR_STMT
1701 ? EXPR_STMT_EXPR (stmt
)
1702 : CLEANUP_EXPR (stmt
);
1704 pp_c_expression (ppi
, e
);
1706 pp_c_semicolon (ppi
);
1707 pp_needs_newline (ppi
) = true;
1711 if (pp_needs_newline (ppi
))
1712 pp_newline_and_indent (ppi
, 0);
1713 pp_c_identifier (ppi
, "if");
1714 pp_c_whitespace (ppi
);
1715 pp_c_left_paren (ppi
);
1716 pp_c_expression (ppi
, IF_COND (stmt
));
1717 pp_c_right_paren (ppi
);
1718 pp_newline_and_indent (ppi
, 3);
1719 pp_statement (ppi
, THEN_CLAUSE (stmt
));
1720 pp_newline_and_indent (ppi
, -3);
1721 if (ELSE_CLAUSE (stmt
))
1723 tree else_clause
= ELSE_CLAUSE (stmt
);
1724 pp_c_identifier (ppi
, "else");
1725 if (TREE_CODE (else_clause
) == IF_STMT
)
1726 pp_c_whitespace (ppi
);
1728 pp_newline_and_indent (ppi
, 3);
1729 pp_statement (ppi
, else_clause
);
1730 if (TREE_CODE (else_clause
) != IF_STMT
)
1731 pp_newline_and_indent (ppi
, -3);
1736 if (pp_needs_newline (ppi
))
1737 pp_newline_and_indent (ppi
, 0);
1738 pp_c_identifier (ppi
, "switch");
1740 pp_c_left_paren (ppi
);
1741 pp_c_expression (ppi
, SWITCH_COND (stmt
));
1742 pp_c_right_paren (ppi
);
1743 pp_indentation (ppi
) += 3;
1744 pp_needs_newline (ppi
) = true;
1745 pp_statement (ppi
, SWITCH_BODY (stmt
));
1746 pp_newline_and_indent (ppi
, -3);
1750 if (pp_needs_newline (ppi
))
1751 pp_newline_and_indent (ppi
, 0);
1752 pp_c_identifier (ppi
, "while");
1754 pp_c_left_paren (ppi
);
1755 pp_c_expression (ppi
, WHILE_COND (stmt
));
1756 pp_c_right_paren (ppi
);
1757 pp_newline_and_indent (ppi
, 3);
1758 pp_statement (ppi
, WHILE_BODY (stmt
));
1759 pp_indentation (ppi
) -= 3;
1760 pp_needs_newline (ppi
) = true;
1764 if (pp_needs_newline (ppi
))
1765 pp_newline_and_indent (ppi
, 0);
1766 pp_c_identifier (ppi
, "do");
1767 pp_newline_and_indent (ppi
, 3);
1768 pp_statement (ppi
, DO_BODY (stmt
));
1769 pp_newline_and_indent (ppi
, -3);
1770 pp_c_identifier (ppi
, "while");
1772 pp_c_left_paren (ppi
);
1773 pp_c_expression (ppi
, DO_COND (stmt
));
1774 pp_c_right_paren (ppi
);
1775 pp_c_semicolon (ppi
);
1776 pp_needs_newline (ppi
) = true;
1780 if (pp_needs_newline (ppi
))
1781 pp_newline_and_indent (ppi
, 0);
1782 pp_c_identifier (ppi
, "for");
1784 pp_c_left_paren (ppi
);
1785 if (FOR_INIT_STMT (stmt
))
1786 pp_statement (ppi
, FOR_INIT_STMT (stmt
));
1788 pp_c_semicolon (ppi
);
1789 pp_needs_newline (ppi
) = false;
1790 pp_c_whitespace (ppi
);
1791 if (FOR_COND (stmt
))
1792 pp_c_expression (ppi
, FOR_COND (stmt
));
1793 pp_c_semicolon (ppi
);
1794 pp_needs_newline (ppi
) = false;
1795 pp_c_whitespace (ppi
);
1796 if (FOR_EXPR (stmt
))
1797 pp_c_expression (ppi
, FOR_EXPR (stmt
));
1798 pp_c_right_paren (ppi
);
1799 pp_newline_and_indent (ppi
, 3);
1800 pp_statement (ppi
, FOR_BODY (stmt
));
1801 pp_indentation (ppi
) -= 3;
1802 pp_needs_newline (ppi
) = true;
1807 if (pp_needs_newline (ppi
))
1808 pp_newline_and_indent (ppi
, 0);
1809 pp_identifier (ppi
, code
== BREAK_STMT
? "break" : "continue");
1810 pp_c_semicolon (ppi
);
1811 pp_needs_newline (ppi
) = true;
1817 tree e
= code
== RETURN_STMT
1818 ? RETURN_STMT_EXPR (stmt
)
1819 : GOTO_DESTINATION (stmt
);
1820 if (pp_needs_newline (ppi
))
1821 pp_newline_and_indent (ppi
, 0);
1822 pp_c_identifier (ppi
, code
== RETURN_STMT
? "return" : "goto");
1824 pp_c_expression (ppi
, e
);
1825 pp_c_semicolon (ppi
);
1826 pp_needs_newline (ppi
) = true;
1831 if (!SCOPE_NULLIFIED_P (stmt
) && SCOPE_NO_CLEANUPS_P (stmt
))
1834 if (pp_needs_newline (ppi
))
1835 pp_newline_and_indent (ppi
, 0);
1836 if (SCOPE_BEGIN_P (stmt
))
1838 pp_left_brace (ppi
);
1841 else if (SCOPE_END_P (stmt
))
1843 pp_right_brace (ppi
);
1846 pp_indentation (ppi
) += i
;
1847 pp_needs_newline (ppi
) = true;
1852 if (pp_needs_newline (ppi
))
1853 pp_newline_and_indent (ppi
, 0);
1854 pp_declaration (ppi
, DECL_STMT_DECL (stmt
));
1855 pp_c_semicolon (ppi
);
1856 pp_needs_newline (ppi
) = true;
1861 bool has_volatile_p
= ASM_VOLATILE_P (stmt
);
1862 bool is_extended
= has_volatile_p
|| ASM_INPUTS (stmt
)
1863 || ASM_OUTPUTS (stmt
) || ASM_CLOBBERS (stmt
);
1864 pp_c_identifier (ppi
, is_extended
? "__asm__" : "asm");
1866 pp_c_identifier (ppi
, "__volatile__");
1868 pp_c_left_paren (ppi
);
1869 pp_c_string_literal (ppi
, ASM_STRING (stmt
));
1873 pp_separate_with (ppi
, ':');
1874 if (ASM_OUTPUTS (stmt
))
1875 pp_c_expression (ppi
, ASM_OUTPUTS (stmt
));
1877 pp_separate_with (ppi
, ':');
1878 if (ASM_INPUTS (stmt
))
1879 pp_c_expression (ppi
, ASM_INPUTS (stmt
));
1881 pp_separate_with (ppi
, ':');
1882 if (ASM_CLOBBERS (stmt
))
1883 pp_c_expression (ppi
, ASM_CLOBBERS (stmt
));
1885 pp_c_right_paren (ppi
);
1891 pp_c_identifier (ppi
, "__FILE__");
1894 pp_c_whitespace (ppi
);
1895 pp_c_identifier (ppi
, FILE_STMT_FILENAME (stmt
));
1896 pp_c_semicolon (ppi
);
1897 pp_needs_newline (ppi
) = true;
1901 pp_unsupported_tree (ppi
, stmt
);
1907 /* Initialize the PRETTY-PRINTER for handling C codes. */
1909 pp_c_pretty_printer_init (c_pretty_printer pp
)
1911 pp
->offset_list
= 0;
1913 pp
->declaration
= pp_c_declaration
;
1914 pp
->declaration_specifiers
= pp_c_declaration_specifiers
;
1915 pp
->declarator
= pp_c_declarator
;
1916 pp
->direct_declarator
= pp_c_direct_declarator
;
1917 pp
->type_specifier
= pp_c_simple_type_specifier
;
1918 pp
->abstract_declarator
= pp_c_abstract_declarator
;
1919 pp
->parameter_declaration
= pp_c_parameter_declaration
;
1920 pp
->type_id
= pp_c_type_id
;
1921 pp
->function_specifier
= pp_c_function_specifier
;
1922 pp
->storage_class_specifier
= pp_c_storage_class_specifier
;
1924 pp
->statement
= pp_c_statement
;
1926 pp
->id_expression
= pp_c_id_expression
;
1927 pp
->primary_expression
= pp_c_primary_expression
;
1928 pp
->postfix_expression
= pp_c_postfix_expression
;
1929 pp
->unary_expression
= pp_c_unary_expression
;
1930 pp
->initializer
= pp_c_initializer
;
1931 pp
->multiplicative_expression
= pp_c_multiplicative_expression
;
1932 pp
->conditional_expression
= pp_c_conditional_expression
;
1933 pp
->assignment_expression
= pp_c_assignment_expression
;