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 (preferably the official grammars) is believed to make it
34 much easier to add extensions and nifty pretty-printing effects that
35 takes expression or declaration contexts into account. */
38 #define pp_c_maybe_whitespace(PP) \
40 if (pp_base (PP)->padding == pp_before) \
41 pp_c_whitespace (PP); \
44 #define pp_c_left_bracket(PP) \
46 pp_left_bracket (PP); \
47 pp_base (PP)->padding = pp_none; \
50 #define pp_c_right_bracket(PP) \
52 pp_right_bracket (PP); \
53 pp_base (PP)->padding = pp_none; \
56 #define pp_c_star(PP) \
59 pp_base (PP)->padding = pp_none; \
63 static void pp_c_char (c_pretty_printer *, int);
65 /* postfix-expression */
66 static void pp_c_initializer_list (c_pretty_printer *, tree);
68 static void pp_c_multiplicative_expression (c_pretty_printer *, tree);
69 static void pp_c_additive_expression (c_pretty_printer *, tree);
70 static void pp_c_shift_expression (c_pretty_printer *, tree);
71 static void pp_c_relational_expression (c_pretty_printer *, tree);
72 static void pp_c_equality_expression (c_pretty_printer *, tree);
73 static void pp_c_and_expression (c_pretty_printer *, tree);
74 static void pp_c_exclusive_or_expression (c_pretty_printer *, tree);
75 static void pp_c_inclusive_or_expression (c_pretty_printer *, tree);
76 static void pp_c_logical_and_expression (c_pretty_printer *, tree);
77 static void pp_c_conditional_expression (c_pretty_printer *, tree);
78 static void pp_c_assignment_expression (c_pretty_printer *, tree);
83 /* Helper functions. */
86 pp_c_whitespace (c_pretty_printer *pp)
89 pp_base (pp)->padding = pp_none;
93 pp_c_left_paren (c_pretty_printer *pp)
96 pp_base (pp)->padding = pp_none;
100 pp_c_right_paren (c_pretty_printer *pp)
103 pp_base (pp)->padding = pp_none;
107 pp_c_left_brace (c_pretty_printer *pp)
110 pp_base (pp)->padding = pp_none;
114 pp_c_right_brace (c_pretty_printer *pp)
117 pp_base (pp)->padding = pp_none;
121 pp_c_dot (c_pretty_printer *pp)
124 pp_base (pp)->padding = pp_none;
128 pp_c_ampersand (c_pretty_printer *pp)
131 pp_base (pp)->padding = pp_none;
135 pp_c_arrow (c_pretty_printer *pp)
138 pp_base (pp)->padding = pp_none;
142 pp_c_semicolon(c_pretty_printer *pp)
145 pp_base (pp)->padding = pp_none;
149 pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv)
151 const char *p = pp_last_position_in_text (pp);
152 if (p != NULL && *p == '*')
153 pp_c_whitespace (pp);
154 pp_c_identifier (pp, cv);
157 /* Pretty-print T using the type-cast notation '( type-name )'. */
159 pp_c_type_cast (c_pretty_printer *pp, tree t)
161 pp_c_left_paren (pp);
163 pp_c_right_paren (pp);
167 pp_c_space_for_pointer_operator (c_pretty_printer *pp, tree t)
169 if (POINTER_TYPE_P (t))
171 tree pointee = strip_pointer_operator (TREE_TYPE (t));
172 if (TREE_CODE (pointee) != ARRAY_TYPE
173 && TREE_CODE (pointee) != FUNCTION_TYPE)
174 pp_c_whitespace (pp);
181 /* C++ cv-qualifiers are called type-qualifiers in C. Print out the
182 cv-qualifiers of T. If T is a declaration then it is the cv-qualifier
183 of its type. Take care of possible extensions.
187 type-qualifier-list type-qualifier
192 __restrict__ -- GNU C
195 pp_c_type_qualifier_list (c_pretty_printer *pp, tree t)
202 qualifiers = TYPE_QUALS (t);
203 if (qualifiers & TYPE_QUAL_CONST)
204 pp_c_cv_qualifier (pp, "const");
205 if (qualifiers & TYPE_QUAL_VOLATILE)
206 pp_c_cv_qualifier (pp, "volatile");
207 if (qualifiers & TYPE_QUAL_RESTRICT)
208 pp_c_cv_qualifier (pp, flag_isoc99 ? "restrict" : "__restrict__");
212 * type-qualifier-list(opt)
213 * type-qualifier-list(opt) pointer */
215 pp_c_pointer (c_pretty_printer *pp, tree t)
217 if (!TYPE_P (t) && TREE_CODE (t) != TYPE_DECL)
219 switch (TREE_CODE (t))
222 /* It is easier to handle C++ reference types here. */
224 if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE)
225 pp_c_pointer (pp, TREE_TYPE (t));
226 if (TREE_CODE (t) == POINTER_TYPE)
230 pp_c_type_qualifier_list (pp, t);
234 pp_unsupported_tree (pp, t);
251 struct-or-union-specifier
256 simple-type-specifier:
260 pp_c_type_specifier (c_pretty_printer *pp, tree t)
262 const enum tree_code code = TREE_CODE (t);
266 pp_c_identifier (pp, "<type-error>");
269 case IDENTIFIER_NODE:
270 pp_c_tree_identifier (pp, t);
278 pp_c_type_specifier (pp, TYPE_NAME (t));
283 pp_id_expression (pp, t);
285 pp_c_identifier (pp, "<typedef-error>");
291 if (code == UNION_TYPE)
292 pp_c_identifier (pp, "union");
293 else if (code == RECORD_TYPE)
294 pp_c_identifier (pp, "struct");
295 else if (code == ENUMERAL_TYPE)
296 pp_c_identifier (pp, "enum");
298 pp_c_identifier (pp, "<tag-error>");
301 pp_id_expression (pp, TYPE_NAME (t));
303 pp_c_identifier (pp, "<anonymous>");
307 pp_unsupported_tree (pp, t);
312 /* specifier-qualifier-list:
313 type-specifier specifier-qualifier-list-opt
314 type-qualifier specifier-qualifier-list-opt
317 Implementation note: Because of the non-linearities in array or
318 function declarations, this routine prints not just the
319 specifier-qualifier-list of such entities or types of such entities,
320 but also the 'pointer' production part of their declarators. The
321 remaining part is done by pp_declarator or pp_c_abstract_declarator. */
323 pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
325 const enum tree_code code = TREE_CODE (t);
327 if (TREE_CODE (t) != POINTER_TYPE)
328 pp_c_type_qualifier_list (pp, t);
334 /* Get the types-specifier of this type. */
335 tree pointee = strip_pointer_operator (TREE_TYPE (t));
336 pp_c_specifier_qualifier_list (pp, pointee);
337 if (TREE_CODE (pointee) == ARRAY_TYPE
338 || TREE_CODE (pointee) == FUNCTION_TYPE)
340 pp_c_whitespace (pp);
341 pp_c_left_paren (pp);
343 pp_ptr_operator (pp, t);
349 pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
354 pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
355 if (code == COMPLEX_TYPE)
356 pp_c_identifier (pp, flag_isoc99 ? "_Complex" : "__complex__");
357 else if (code == VECTOR_TYPE)
358 pp_c_identifier (pp, "__vector__");
362 pp_simple_type_specifier (pp, t);
367 /* parameter-type-list:
372 parameter-declaration
373 parameter-list , parameter-declaration
375 parameter-declaration:
376 declaration-specifiers declarator
377 declaration-specifiers abstract-declarator(opt) */
379 pp_c_parameter_type_list (c_pretty_printer *pp, tree t)
381 bool want_parm_decl = DECL_P (t) && !(pp->flags & pp_c_flag_abstract);
382 tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t);
383 pp_c_left_paren (pp);
384 if (parms == void_list_node)
385 pp_c_identifier (pp, "void");
389 for ( ; parms && parms != void_list_node; parms = TREE_CHAIN (parms))
392 pp_separate_with (pp, ',');
394 pp_declaration_specifiers
395 (pp, want_parm_decl ? parms : TREE_VALUE (parms));
397 pp_declarator (pp, parms);
399 pp_abstract_declarator (pp, TREE_VALUE (parms));
402 pp_c_right_paren (pp);
405 /* abstract-declarator:
407 pointer(opt) direct-abstract-declarator */
409 pp_c_abstract_declarator (c_pretty_printer *pp, tree t)
411 if (TREE_CODE (t) == POINTER_TYPE)
413 if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
414 || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
415 pp_c_right_paren (pp);
419 pp_direct_abstract_declarator (pp, t);
422 /* direct-abstract-declarator:
423 ( abstract-declarator )
424 direct-abstract-declarator(opt) [ assignment-expression(opt) ]
425 direct-abstract-declarator(opt) [ * ]
426 direct-abstract-declarator(opt) ( parameter-type-list(opt) ) */
428 pp_c_direct_abstract_declarator (c_pretty_printer *pp, tree t)
430 switch (TREE_CODE (t))
433 pp_abstract_declarator (pp, t);
437 pp_c_parameter_type_list (pp, t);
438 pp_direct_abstract_declarator (pp, TREE_TYPE (t));
442 pp_c_left_bracket (pp);
444 pp_expression (pp, TYPE_MAX_VALUE (TYPE_DOMAIN (t)));
445 pp_c_right_bracket (pp);
446 pp_direct_abstract_declarator (pp, TREE_TYPE (t));
449 case IDENTIFIER_NODE:
463 pp_unsupported_tree (pp, t);
469 specifier-qualifier-list abstract-declarator(opt) */
471 pp_c_type_id (c_pretty_printer *pp, tree t)
473 pp_c_specifier_qualifier_list (pp, t);
474 pp_abstract_declarator (pp, t);
477 /* storage-class-specifier:
484 pp_c_storage_class_specifier (c_pretty_printer *pp, tree t)
486 if (TREE_CODE (t) == TYPE_DECL)
487 pp_c_identifier (pp, "typedef");
490 if (DECL_REGISTER (t))
491 pp_c_identifier (pp, "register");
492 else if (TREE_STATIC (t) && TREE_CODE (t) == VAR_DECL)
493 pp_c_identifier (pp, "static");
497 /* function-specifier:
500 pp_c_function_specifier (c_pretty_printer *pp, tree t)
502 if (TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (t))
503 pp_c_identifier (pp, "inline");
506 /* declaration-specifiers:
507 storage-class-specifier declaration-specifiers(opt)
508 type-specifier declaration-specifiers(opt)
509 type-qualifier declaration-specifiers(opt)
510 function-specifier declaration-specifiers(opt) */
512 pp_c_declaration_specifiers (c_pretty_printer *pp, tree t)
514 pp_storage_class_specifier (pp, t);
515 pp_function_specifier (pp, t);
516 pp_c_specifier_qualifier_list (pp, DECL_P (t) ? TREE_TYPE (t) : t);
522 direct-declarator [ type-qualifier-list(opt) assignment-expression(opt) ]
523 direct-declarator [ static type-qualifier-list(opt) assignment-expression(opt)]
524 direct-declarator [ type-qualifier-list static assignment-exression ]
525 direct-declarator [ type-qualifier-list * ]
526 direct-declaratpr ( parameter-type-list )
527 direct-declarator ( identifier-list(opt) ) */
529 pp_c_direct_declarator (c_pretty_printer *pp, tree t)
531 switch (TREE_CODE (t))
540 pp_c_space_for_pointer_operator (pp, TREE_TYPE (t));
541 pp_c_tree_identifier (pp, DECL_NAME (t));
545 pp_abstract_declarator (pp, TREE_TYPE (t));
549 pp_parameter_list (pp, t);
550 pp_abstract_declarator (pp, TREE_TYPE (t));
554 pp_c_space_for_pointer_operator (pp, TREE_TYPE (TREE_TYPE (t)));
555 pp_c_tree_identifier (pp, DECL_NAME (t));
556 if (pp_c_base (pp)->flags & pp_c_flag_abstract)
557 pp_abstract_declarator (pp, TREE_TYPE (t));
560 pp_parameter_list (pp, t);
561 pp_abstract_declarator (pp, TREE_TYPE (TREE_TYPE (t)));
573 pp_unsupported_tree (pp, t);
580 pointer(opt) direct-declarator */
582 pp_c_declarator (c_pretty_printer *pp, tree t)
584 switch (TREE_CODE (t))
600 pp_direct_declarator (pp, t);
605 pp_unsupported_tree (pp, t);
611 declaration-specifiers init-declarator-list(opt) ; */
613 pp_c_declaration (c_pretty_printer *pp, tree t)
615 pp_declaration_specifiers (pp, t);
616 pp_c_init_declarator (pp, t);
619 /* Pretty-print ATTRIBUTES using GNU C extension syntax. */
621 pp_c_attributes (c_pretty_printer *pp, tree attributes)
623 if (attributes == NULL_TREE)
626 pp_c_identifier (pp, "__attribute__");
627 pp_c_left_paren (pp);
628 pp_c_left_paren (pp);
629 for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
631 pp_tree_identifier (pp, TREE_PURPOSE (attributes));
632 if (TREE_VALUE (attributes))
633 pp_c_call_argument_list (pp, TREE_VALUE (attributes));
635 if (TREE_CHAIN (attributes))
636 pp_separate_with (pp, ',');
638 pp_c_right_paren (pp);
639 pp_c_right_paren (pp);
642 /* function-definition:
643 declaration-specifiers declarator compound-statement */
645 pp_c_function_definition (c_pretty_printer *pp, tree t)
647 pp_declaration_specifiers (pp, t);
648 pp_declarator (pp, t);
649 pp_needs_newline (pp) = true;
650 pp_statement (pp, DECL_SAVED_TREE (t));
658 /* Print out a c-char. */
660 pp_c_char (c_pretty_printer *pp, int c)
665 pp_string (pp, "\\n");
668 pp_string (pp, "\\t");
671 pp_string (pp, "\\v");
674 pp_string (pp, "\\b");
677 pp_string (pp, "\\r");
680 pp_string (pp, "\\f");
683 pp_string (pp, "\\a");
686 pp_string (pp, "\\\\");
689 pp_string (pp, "\\'");
692 pp_string (pp, "\\\"");
696 pp_character (pp, c);
698 pp_scalar (pp, "\\%03o", (unsigned) c);
703 /* Print out a STRING literal. */
705 pp_c_string_literal (c_pretty_printer *pp, tree s)
707 const char *p = TREE_STRING_POINTER (s);
708 int n = TREE_STRING_LENGTH (s) - 1;
711 for (i = 0; i < n; ++i)
712 pp_c_char (pp, p[i]);
717 pp_c_integer_constant (c_pretty_printer *pp, tree i)
719 if (host_integerp (i, 0))
720 pp_wide_integer (pp, TREE_INT_CST_LOW (i));
723 if (tree_int_cst_sgn (i) < 0)
726 i = build_int_2 (-TREE_INT_CST_LOW (i),
727 ~TREE_INT_CST_HIGH (i) + !TREE_INT_CST_LOW (i));
729 sprintf (pp_buffer (pp)->digit_buffer,
730 HOST_WIDE_INT_PRINT_DOUBLE_HEX,
731 TREE_INT_CST_HIGH (i), TREE_INT_CST_LOW (i));
732 pp_string (pp, pp_buffer (pp)->digit_buffer);
736 /* Print out a CHARACTER literal. */
738 pp_c_character_constant (c_pretty_printer *pp, tree c)
740 tree type = TREE_TYPE (c);
741 if (type == wchar_type_node)
742 pp_character (pp, 'L');
744 if (host_integerp (c, TREE_UNSIGNED (type)))
745 pp_c_char (pp, tree_low_cst (c, TREE_UNSIGNED (type)));
747 pp_scalar (pp, "\\x%x", (unsigned) TREE_INT_CST_LOW (c));
751 /* Print out a BOOLEAN literal. */
753 pp_c_bool_constant (c_pretty_printer *pp, tree b)
755 if (b == boolean_false_node)
757 if (c_dialect_cxx ())
758 pp_c_identifier (pp, "false");
759 else if (flag_isoc99)
760 pp_c_identifier (pp, "_False");
762 pp_unsupported_tree (pp, b);
764 else if (b == boolean_true_node)
766 if (c_dialect_cxx ())
767 pp_c_identifier (pp, "true");
768 else if (flag_isoc99)
769 pp_c_identifier (pp, "_True");
771 pp_unsupported_tree (pp, b);
773 else if (TREE_CODE (b) == INTEGER_CST)
774 pp_c_integer_constant (pp, b);
776 pp_unsupported_tree (pp, b);
779 /* Attempt to print out an ENUMERATOR. Return true on success. Else return
780 false; that means the value was obtained by a cast, in which case
781 print out the type-id part of the cast-expression -- the casted value
782 is then printed by pp_c_integer_literal. */
784 pp_c_enumeration_constant (c_pretty_printer *pp, tree e)
786 bool value_is_named = true;
787 tree type = TREE_TYPE (e);
790 /* Find the name of this constant. */
791 for (value = TYPE_VALUES (type);
792 value != NULL_TREE && !tree_int_cst_equal (TREE_VALUE (value), e);
793 value = TREE_CHAIN (value))
796 if (value != NULL_TREE)
797 pp_id_expression (pp, TREE_PURPOSE (value));
800 /* Value must have been cast. */
801 pp_c_type_cast (pp, type);
802 value_is_named = false;
805 return value_is_named;
808 /* Print out a REAL value as a decimal-floating-constant. */
811 pp_c_floating_constant (c_pretty_printer *pp, tree r)
813 real_to_decimal (pp_buffer (pp)->digit_buffer, &TREE_REAL_CST (r),
814 sizeof (pp_buffer (pp)->digit_buffer), 0, 1);
815 pp_string (pp, pp_buffer(pp)->digit_buffer);
816 if (TREE_TYPE (r) == float_type_node)
817 pp_character (pp, 'f');
818 else if (TREE_TYPE (r) == long_double_type_node)
819 pp_character (pp, 'l');
826 chatracter-constant */
828 pp_c_constant (c_pretty_printer *pp, tree e)
830 switch (TREE_CODE (e))
834 tree type = TREE_TYPE (e);
835 if (type == boolean_type_node)
836 pp_c_bool_constant (pp, e);
837 else if (type == char_type_node)
838 pp_c_character_constant (pp, e);
839 else if (TREE_CODE (type) == ENUMERAL_TYPE
840 && pp_c_enumeration_constant (pp, e))
843 pp_c_integer_constant (pp, e);
848 pp_c_floating_constant (pp, e);
852 pp_c_string_literal (pp, e);
856 pp_unsupported_tree (pp, e);
862 pp_c_identifier (c_pretty_printer *pp, const char *id)
864 pp_c_maybe_whitespace (pp);
865 pp_identifier (pp, id);
866 pp_base (pp)->padding = pp_before;
869 /* Pretty-print a C primary-expression.
876 pp_c_primary_expression (c_pretty_printer *pp, tree e)
878 switch (TREE_CODE (e))
888 case IDENTIFIER_NODE:
889 pp_c_tree_identifier (pp, e);
893 pp_c_identifier (pp, "<erroneous-expression>");
897 pp_c_identifier (pp, "<return-value>");
903 pp_c_constant (pp, e);
907 pp_c_left_paren (pp);
908 pp_statement (pp, STMT_EXPR_STMT (e));
909 pp_c_right_paren (pp);
913 /* FIXME: Make sure we won't get into an infinie loop. */
914 pp_c_left_paren (pp);
915 pp_expression (pp, e);
916 pp_c_right_paren (pp);
921 /* Print out a C initializer -- also support C compound-literals.
923 assignment-expression:
925 { initializer-list , } */
928 pp_c_initializer (c_pretty_printer *pp, tree e)
930 if (TREE_CODE (e) == CONSTRUCTOR)
932 enum tree_code code = TREE_CODE (TREE_TYPE (e));
933 if (code == RECORD_TYPE || code == UNION_TYPE || code == ARRAY_TYPE)
935 pp_c_left_brace (pp);
936 pp_c_initializer_list (pp, e);
937 pp_c_right_brace (pp);
940 pp_unsupported_tree (pp, TREE_OPERAND (e, 1));
943 pp_expression (pp, e);
948 declarator = initializer */
950 pp_c_init_declarator (c_pretty_printer *pp, tree t)
952 pp_declarator (pp, t);
953 if (DECL_INITIAL (t))
955 tree init = DECL_INITIAL (t);
956 /* This C++ bit is handled here because it is easier to do so.
957 In templates, the C++ parser builds a TREE_LIST for a
958 direct-initialization; the TREE_PURPOSE is the variable to
959 initialize and the TREE_VALUE is the initializer. */
960 if (TREE_CODE (init) == TREE_LIST)
962 pp_c_left_paren (pp);
963 pp_expression (pp, TREE_VALUE (init));
971 pp_c_initializer (pp, init);
977 designation(opt) initializer
978 initializer-list , designation(opt) initializer
985 designator-list designator
988 [ constant-expression ]
991 pp_c_initializer_list (c_pretty_printer *pp, tree e)
993 tree type = TREE_TYPE (e);
994 const enum tree_code code = TREE_CODE (type);
996 if (code == RECORD_TYPE || code == UNION_TYPE || code == ARRAY_TYPE)
998 tree init = TREE_OPERAND (e, 0);
999 for (; init != NULL_TREE; init = TREE_CHAIN (init))
1001 if (code == RECORD_TYPE || code == UNION_TYPE)
1004 pp_c_primary_expression (pp, TREE_PURPOSE (init));
1008 pp_c_left_bracket (pp);
1009 if (TREE_PURPOSE (init))
1010 pp_c_constant (pp, TREE_PURPOSE (init));
1011 pp_c_right_bracket (pp);
1013 pp_c_whitespace (pp);
1015 pp_c_whitespace (pp);
1016 pp_initializer (pp, TREE_VALUE (init));
1017 if (TREE_CHAIN (init))
1018 pp_separate_with (pp, ',');
1022 pp_unsupported_tree (pp, type);
1025 /* This is a convenient function, used to bridge gap between C and C++
1031 pp_c_id_expression (c_pretty_printer *pp, tree t)
1033 switch (TREE_CODE (t))
1043 case IDENTIFIER_NODE:
1044 pp_c_tree_identifier (pp, t);
1048 pp_unsupported_tree (pp, t);
1053 /* postfix-expression:
1055 postfix-expression [ expression ]
1056 postfix-expression ( argument-expression-list(opt) )
1057 postfix-expression . identifier
1058 postfix-expression -> identifier
1059 postfix-expression ++
1060 postfix-expression --
1061 ( type-name ) { initializer-list }
1062 ( type-name ) { initializer-list , } */
1064 pp_c_postfix_expression (c_pretty_printer *pp, tree e)
1066 enum tree_code code = TREE_CODE (e);
1069 case POSTINCREMENT_EXPR:
1070 case POSTDECREMENT_EXPR:
1071 pp_postfix_expression (pp, TREE_OPERAND (e, 0));
1072 pp_identifier (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
1076 pp_postfix_expression (pp, TREE_OPERAND (e, 0));
1081 pp_postfix_expression (pp, TREE_OPERAND (e, 0));
1082 pp_c_left_bracket (pp);
1083 pp_expression (pp, TREE_OPERAND (e, 1));
1084 pp_c_right_bracket (pp);
1088 pp_postfix_expression (pp, TREE_OPERAND (e, 0));
1089 pp_c_call_argument_list (pp, TREE_OPERAND (e, 1));
1094 pp_c_identifier (pp,
1095 code == ABS_EXPR ? "__builtin_abs" : "__builtin_ffs");
1096 pp_c_left_paren (pp);
1097 pp_expression (pp, TREE_OPERAND (e, 0));
1098 pp_c_right_paren (pp);
1103 tree object = TREE_OPERAND (e, 0);
1104 if (TREE_CODE (object) == INDIRECT_REF)
1106 pp_postfix_expression (pp, TREE_OPERAND (object, 0));
1111 pp_postfix_expression (pp, object);
1114 pp_expression (pp, TREE_OPERAND (e, 1));
1121 pp_c_type_cast (pp, TREE_TYPE (e));
1122 pp_c_left_brace (pp);
1124 if (code == COMPLEX_CST)
1126 pp_expression (pp, TREE_REALPART (e));
1127 pp_separate_with (pp, ',');
1128 pp_expression (pp, TREE_IMAGPART (e));
1130 else if (code == VECTOR_CST)
1131 pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e));
1132 else if (code == COMPLEX_EXPR)
1134 pp_expression (pp, TREE_OPERAND (e, 0));
1135 pp_separate_with (pp, ',');
1136 pp_expression (pp, TREE_OPERAND (e, 1));
1139 pp_c_right_brace (pp);
1142 case COMPOUND_LITERAL_EXPR:
1143 e = DECL_INITIAL (e);
1146 pp_initializer (pp, e);
1150 pp_c_identifier (pp, "__builtin_va_arg");
1151 pp_c_left_paren (pp);
1152 pp_assignment_expression (pp, TREE_OPERAND (e, 0));
1153 pp_separate_with (pp, ',');
1154 pp_type_id (pp, TREE_TYPE (e));
1155 pp_c_right_paren (pp);
1159 if (TREE_CODE (TREE_OPERAND (e, 0)) == FUNCTION_DECL)
1161 pp_c_id_expression (pp, TREE_OPERAND (e, 0));
1164 /* else fall through. */
1167 pp_primary_expression (pp, e);
1172 /* Print out an expression-list; E is expected to be a TREE_LIST */
1174 pp_c_expression_list (c_pretty_printer *pp, tree e)
1176 for (; e != NULL_TREE; e = TREE_CHAIN (e))
1178 pp_expression (pp, TREE_VALUE (e));
1180 pp_separate_with (pp, ',');
1184 /* Print out an expression-list in parens, as in a function call. */
1186 pp_c_call_argument_list (c_pretty_printer *pp, tree t)
1188 pp_c_left_paren (pp);
1189 if (t && TREE_CODE (t) == TREE_LIST)
1190 pp_c_expression_list (pp, t);
1191 pp_c_right_paren (pp);
1194 /* unary-expression:
1198 unary-operator cast-expression
1199 sizeof unary-expression
1202 unary-operator: one of
1207 __alignof__ unary-expression
1208 __alignof__ ( type-id )
1209 __real__ unary-expression
1210 __imag__ unary-expression */
1212 pp_c_unary_expression (c_pretty_printer *pp, tree e)
1214 enum tree_code code = TREE_CODE (e);
1217 case PREINCREMENT_EXPR:
1218 case PREDECREMENT_EXPR:
1219 pp_identifier (pp, code == PREINCREMENT_EXPR ? "++" : "--");
1220 pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
1227 case TRUTH_NOT_EXPR:
1229 /* String literal are used by address. */
1230 if (code == ADDR_EXPR && TREE_CODE (TREE_OPERAND (e, 0)) != STRING_CST)
1232 else if (code == INDIRECT_REF)
1234 else if (code == NEGATE_EXPR)
1236 else if (code == BIT_NOT_EXPR || code == CONJ_EXPR)
1238 else if (code == TRUTH_NOT_EXPR)
1239 pp_exclamation (pp);
1240 pp_c_cast_expression (pp, TREE_OPERAND (e, 0));
1245 pp_c_identifier (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
1246 pp_c_whitespace (pp);
1247 if (TYPE_P (TREE_OPERAND (e, 0)))
1248 pp_c_type_cast (pp, TREE_OPERAND (e, 0));
1250 pp_unary_expression (pp, TREE_OPERAND (e, 0));
1255 pp_c_identifier (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
1256 pp_c_whitespace (pp);
1257 pp_unary_expression (pp, TREE_OPERAND (e, 0));
1261 pp_postfix_expression (pp, e);
1268 ( type-name ) cast-expression */
1270 pp_c_cast_expression (c_pretty_printer *pp, tree e)
1272 switch (TREE_CODE (e))
1275 case FIX_TRUNC_EXPR:
1277 pp_c_type_cast (pp, TREE_TYPE (e));
1278 pp_c_cast_expression (pp, TREE_OPERAND (e, 0));
1282 pp_unary_expression (pp, e);
1286 /* multiplicative-expression:
1288 multiplicative-expression * cast-expression
1289 multiplicative-expression / cast-expression
1290 multiplicative-expression % cast-expression */
1292 pp_c_multiplicative_expression (c_pretty_printer *pp, tree e)
1294 enum tree_code code = TREE_CODE (e);
1298 case TRUNC_DIV_EXPR:
1299 case TRUNC_MOD_EXPR:
1300 pp_multiplicative_expression (pp, TREE_OPERAND (e, 0));
1301 pp_c_whitespace (pp);
1302 if (code == MULT_EXPR)
1304 else if (code == TRUNC_DIV_EXPR)
1308 pp_c_whitespace (pp);
1309 pp_c_cast_expression (pp, TREE_OPERAND (e, 1));
1313 pp_c_cast_expression (pp, e);
1318 /* additive-expression:
1319 multiplicative-expression
1320 additive-expression + multiplicative-expression
1321 additive-expression - multiplicative-expression */
1323 pp_c_additive_expression (c_pretty_printer *pp, tree e)
1325 enum tree_code code = TREE_CODE (e);
1330 pp_c_additive_expression (pp, TREE_OPERAND (e, 0));
1331 pp_c_whitespace (pp);
1332 if (code == PLUS_EXPR)
1336 pp_c_whitespace (pp);
1337 pp_multiplicative_expression (pp, TREE_OPERAND (e, 1));
1341 pp_multiplicative_expression (pp, e);
1346 /* additive-expression:
1348 shift-expression << additive-expression
1349 shift-expression >> additive-expression */
1351 pp_c_shift_expression (c_pretty_printer *pp, tree e)
1353 enum tree_code code = TREE_CODE (e);
1358 pp_c_shift_expression (pp, TREE_OPERAND (e, 0));
1359 pp_c_whitespace (pp);
1360 pp_identifier (pp, code == LSHIFT_EXPR ? "<<" : ">>");
1361 pp_c_whitespace (pp);
1362 pp_c_additive_expression (pp, TREE_OPERAND (e, 1));
1366 pp_c_additive_expression (pp, e);
1370 /* relational-expression:
1372 relational-expression < shift-expression
1373 relational-expression > shift-expression
1374 relational-expression <= shift-expression
1375 relational-expression >= shift-expression */
1377 pp_c_relational_expression (c_pretty_printer *pp, tree e)
1379 enum tree_code code = TREE_CODE (e);
1386 pp_c_relational_expression (pp, TREE_OPERAND (e, 0));
1387 pp_c_whitespace (pp);
1388 if (code == LT_EXPR)
1390 else if (code == GT_EXPR)
1392 else if (code == LE_EXPR)
1393 pp_identifier (pp, "<=");
1394 else if (code == GE_EXPR)
1395 pp_identifier (pp, ">=");
1396 pp_c_whitespace (pp);
1397 pp_c_shift_expression (pp, TREE_OPERAND (e, 1));
1401 pp_c_shift_expression (pp, e);
1406 /* equality-expression:
1407 relational-expression
1408 equality-expression == relational-expression
1409 equality-equality != relational-expression */
1411 pp_c_equality_expression (c_pretty_printer *pp, tree e)
1413 enum tree_code code = TREE_CODE (e);
1418 pp_c_equality_expression (pp, TREE_OPERAND (e, 0));
1419 pp_c_whitespace (pp);
1420 pp_identifier (pp, code == EQ_EXPR ? "==" : "!=");
1421 pp_c_whitespace (pp);
1422 pp_c_relational_expression (pp, TREE_OPERAND (e, 1));
1426 pp_c_relational_expression (pp, e);
1433 AND-expression & equality-equality */
1435 pp_c_and_expression (c_pretty_printer *pp, tree e)
1437 if (TREE_CODE (e) == BIT_AND_EXPR)
1439 pp_c_and_expression (pp, TREE_OPERAND (e, 0));
1440 pp_c_whitespace (pp);
1442 pp_c_whitespace (pp);
1443 pp_c_equality_expression (pp, TREE_OPERAND (e, 1));
1446 pp_c_equality_expression (pp, e);
1449 /* exclusive-OR-expression:
1451 exclusive-OR-expression ^ AND-expression */
1453 pp_c_exclusive_or_expression (c_pretty_printer *pp, tree e)
1455 if (TREE_CODE (e) == BIT_XOR_EXPR)
1457 pp_c_exclusive_or_expression (pp, TREE_OPERAND (e, 0));
1458 pp_c_maybe_whitespace (pp);
1460 pp_c_whitespace (pp);
1461 pp_c_and_expression (pp, TREE_OPERAND (e, 1));
1464 pp_c_and_expression (pp, e);
1467 /* inclusive-OR-expression:
1468 exclusive-OR-expression
1469 inclusive-OR-expression | exclusive-OR-expression */
1471 pp_c_inclusive_or_expression (c_pretty_printer *pp, tree e)
1473 if (TREE_CODE (e) == BIT_IOR_EXPR)
1475 pp_c_exclusive_or_expression (pp, TREE_OPERAND (e, 0));
1476 pp_c_whitespace (pp);
1478 pp_c_whitespace (pp);
1479 pp_c_exclusive_or_expression (pp, TREE_OPERAND (e, 1));
1482 pp_c_exclusive_or_expression (pp, e);
1485 /* logical-AND-expression:
1486 inclusive-OR-expression
1487 logical-AND-expression && inclusive-OR-expression */
1489 pp_c_logical_and_expression (c_pretty_printer *pp, tree e)
1491 if (TREE_CODE (e) == TRUTH_ANDIF_EXPR)
1493 pp_c_logical_and_expression (pp, TREE_OPERAND (e, 0));
1494 pp_c_whitespace (pp);
1495 pp_identifier (pp, "&&");
1496 pp_c_whitespace (pp);
1497 pp_c_inclusive_or_expression (pp, TREE_OPERAND (e, 1));
1500 pp_c_inclusive_or_expression (pp, e);
1503 /* logical-OR-expression:
1504 logical-AND-expression
1505 logical-OR-expression || logical-AND-expression */
1507 pp_c_logical_or_expression (c_pretty_printer *pp, tree e)
1509 if (TREE_CODE (e) == TRUTH_ORIF_EXPR)
1511 pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
1512 pp_c_whitespace (pp);
1513 pp_identifier (pp, "||");
1514 pp_c_whitespace (pp);
1515 pp_c_logical_and_expression (pp, TREE_OPERAND (e, 1));
1518 pp_c_logical_and_expression (pp, e);
1521 /* conditional-expression:
1522 logical-OR-expression
1523 logical-OR-expression ? expression : conditional-expression */
1525 pp_c_conditional_expression (c_pretty_printer *pp, tree e)
1527 if (TREE_CODE (e) == COND_EXPR)
1529 pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
1530 pp_c_whitespace (pp);
1532 pp_c_whitespace (pp);
1533 pp_expression (pp, TREE_OPERAND (e, 1));
1534 pp_c_whitespace (pp);
1536 pp_c_whitespace (pp);
1537 pp_c_conditional_expression (pp, TREE_OPERAND (e, 2));
1540 pp_c_logical_or_expression (pp, e);
1544 /* assignment-expression:
1545 conditional-expression
1546 unary-expression assignment-operator assignment-expression
1548 assignment-expression: one of
1549 = *= /= %= += -= >>= <<= &= ^= |= */
1551 pp_c_assignment_expression (c_pretty_printer *pp, tree e)
1553 if (TREE_CODE (e) == MODIFY_EXPR || TREE_CODE (e) == INIT_EXPR)
1555 pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
1556 pp_c_whitespace (pp);
1559 pp_c_expression (pp, TREE_OPERAND (e, 1));
1562 pp_c_conditional_expression (pp, e);
1566 assignment-expression
1567 expression , assignment-expression
1569 Implementation note: instead of going through the usual recursion
1570 chain, I take the liberty of dispatching nodes to the appropriate
1571 functions. This makes some redundancy, but it worths it. That also
1572 prevents a possible infinite recursion between pp_c_primary_expression ()
1573 and pp_c_expression (). */
1575 pp_c_expression (c_pretty_printer *pp, tree e)
1577 switch (TREE_CODE (e))
1580 pp_c_integer_constant (pp, e);
1584 pp_c_floating_constant (pp, e);
1588 pp_c_string_literal (pp, e);
1591 case IDENTIFIER_NODE:
1601 pp_primary_expression (pp, e);
1604 case POSTINCREMENT_EXPR:
1605 case POSTDECREMENT_EXPR:
1615 case COMPOUND_LITERAL_EXPR:
1618 pp_postfix_expression (pp, e);
1626 case TRUTH_NOT_EXPR:
1627 case PREINCREMENT_EXPR:
1628 case PREDECREMENT_EXPR:
1633 pp_c_unary_expression (pp, e);
1637 case FIX_TRUNC_EXPR:
1639 pp_c_cast_expression (pp, e);
1643 case TRUNC_MOD_EXPR:
1644 case TRUNC_DIV_EXPR:
1645 pp_multiplicative_expression (pp, e);
1650 pp_c_shift_expression (pp, e);
1657 pp_c_relational_expression (pp, e);
1661 pp_c_and_expression (pp, e);
1665 pp_c_exclusive_or_expression (pp, e);
1669 pp_c_inclusive_or_expression (pp, e);
1672 case TRUTH_ANDIF_EXPR:
1673 pp_c_logical_and_expression (pp, e);
1676 case TRUTH_ORIF_EXPR:
1677 pp_c_logical_or_expression (pp, e);
1682 pp_c_equality_expression (pp, e);
1686 pp_conditional_expression (pp, e);
1691 pp_c_additive_expression (pp, e);
1696 pp_assignment_expression (pp, e);
1700 pp_c_left_paren (pp);
1701 pp_expression (pp, TREE_OPERAND (e, 0));
1702 pp_separate_with (pp, ',');
1703 pp_assignment_expression (pp, TREE_OPERAND (e, 1));
1704 pp_c_right_paren (pp);
1708 case NON_LVALUE_EXPR:
1711 pp_expression (pp, TREE_OPERAND (e, 0));
1715 pp_postfix_expression (pp, TREE_OPERAND (e, 1));
1719 pp_unsupported_tree (pp, e);
1731 expression-statement
1736 pp_c_statement (c_pretty_printer *pp, tree stmt)
1738 enum tree_code code;
1743 code = TREE_CODE (stmt);
1746 /* labeled-statement:
1747 identifier : statement
1748 case constant-expression : statement
1749 default : statement */
1752 if (pp_needs_newline (pp))
1753 pp_newline_and_indent (pp, -3);
1755 pp_indentation (pp) -= 3;
1756 if (code == LABEL_STMT)
1757 pp_tree_identifier (pp, DECL_NAME (LABEL_STMT_LABEL (stmt)));
1758 else if (code == CASE_LABEL)
1760 if (CASE_LOW (stmt) == NULL_TREE)
1761 pp_identifier (pp, "default");
1764 pp_c_identifier (pp, "case");
1765 pp_c_whitespace (pp);
1766 pp_conditional_expression (pp, CASE_LOW (stmt));
1767 if (CASE_HIGH (stmt))
1769 pp_identifier (pp, "...");
1770 pp_conditional_expression (pp, CASE_HIGH (stmt));
1775 pp_indentation (pp) += 3;
1776 pp_needs_newline (pp) = true;
1779 /* coumpound-statement:
1780 { block-item-list(opt) }
1784 block-item-list block-item
1790 if (pp_needs_newline (pp))
1791 pp_newline_and_indent (pp, 0);
1792 pp_c_left_brace (pp);
1793 pp_newline_and_indent (pp, 3);
1794 for (stmt = COMPOUND_BODY (stmt); stmt; stmt = TREE_CHAIN (stmt))
1795 pp_statement (pp, stmt);
1796 pp_newline_and_indent (pp, -3);
1797 pp_c_right_brace (pp);
1798 pp_needs_newline (pp) = true;
1801 /* expression-statement:
1802 expression(opt) ; */
1805 if (pp_needs_newline (pp))
1806 pp_newline_and_indent (pp, 0);
1808 tree e = code == EXPR_STMT
1809 ? EXPR_STMT_EXPR (stmt)
1810 : CLEANUP_EXPR (stmt);
1812 pp_expression (pp, e);
1814 pp_c_semicolon (pp);
1815 pp_needs_newline (pp) = true;
1818 /* selection-statement:
1819 if ( expression ) statement
1820 if ( expression ) statement else statement
1821 switch ( expression ) statement */
1823 if (pp_needs_newline (pp))
1824 pp_newline_and_indent (pp, 0);
1825 pp_c_identifier (pp, "if");
1826 pp_c_whitespace (pp);
1827 pp_c_left_paren (pp);
1828 pp_expression (pp, IF_COND (stmt));
1829 pp_c_right_paren (pp);
1830 pp_newline_and_indent (pp, 3);
1831 pp_statement (pp, THEN_CLAUSE (stmt));
1832 pp_newline_and_indent (pp, -3);
1833 if (ELSE_CLAUSE (stmt))
1835 tree else_clause = ELSE_CLAUSE (stmt);
1836 pp_c_identifier (pp, "else");
1837 if (TREE_CODE (else_clause) == IF_STMT)
1838 pp_c_whitespace (pp);
1840 pp_newline_and_indent (pp, 3);
1841 pp_statement (pp, else_clause);
1842 if (TREE_CODE (else_clause) != IF_STMT)
1843 pp_newline_and_indent (pp, -3);
1848 if (pp_needs_newline (pp))
1849 pp_newline_and_indent (pp, 0);
1850 pp_c_identifier (pp, "switch");
1852 pp_c_left_paren (pp);
1853 pp_expression (pp, SWITCH_COND (stmt));
1854 pp_c_right_paren (pp);
1855 pp_indentation (pp) += 3;
1856 pp_needs_newline (pp) = true;
1857 pp_statement (pp, SWITCH_BODY (stmt));
1858 pp_newline_and_indent (pp, -3);
1861 /* iteration-statement:
1862 while ( expression ) statement
1863 do statement while ( expression ) ;
1864 for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
1865 for ( declaration expression(opt) ; expression(opt) ) statement */
1867 if (pp_needs_newline (pp))
1868 pp_newline_and_indent (pp, 0);
1869 pp_c_identifier (pp, "while");
1871 pp_c_left_paren (pp);
1872 pp_expression (pp, WHILE_COND (stmt));
1873 pp_c_right_paren (pp);
1874 pp_newline_and_indent (pp, 3);
1875 pp_statement (pp, WHILE_BODY (stmt));
1876 pp_indentation (pp) -= 3;
1877 pp_needs_newline (pp) = true;
1881 if (pp_needs_newline (pp))
1882 pp_newline_and_indent (pp, 0);
1883 pp_c_identifier (pp, "do");
1884 pp_newline_and_indent (pp, 3);
1885 pp_statement (pp, DO_BODY (stmt));
1886 pp_newline_and_indent (pp, -3);
1887 pp_c_identifier (pp, "while");
1889 pp_c_left_paren (pp);
1890 pp_expression (pp, DO_COND (stmt));
1891 pp_c_right_paren (pp);
1892 pp_c_semicolon (pp);
1893 pp_needs_newline (pp) = true;
1897 if (pp_needs_newline (pp))
1898 pp_newline_and_indent (pp, 0);
1899 pp_c_identifier (pp, "for");
1901 pp_c_left_paren (pp);
1902 if (FOR_INIT_STMT (stmt))
1903 pp_statement (pp, FOR_INIT_STMT (stmt));
1905 pp_c_semicolon (pp);
1906 pp_needs_newline (pp) = false;
1907 pp_c_whitespace (pp);
1908 if (FOR_COND (stmt))
1909 pp_expression (pp, FOR_COND (stmt));
1910 pp_c_semicolon (pp);
1911 pp_needs_newline (pp) = false;
1912 pp_c_whitespace (pp);
1913 if (FOR_EXPR (stmt))
1914 pp_expression (pp, FOR_EXPR (stmt));
1915 pp_c_right_paren (pp);
1916 pp_newline_and_indent (pp, 3);
1917 pp_statement (pp, FOR_BODY (stmt));
1918 pp_indentation (pp) -= 3;
1919 pp_needs_newline (pp) = true;
1925 return expression(opt) ; */
1928 if (pp_needs_newline (pp))
1929 pp_newline_and_indent (pp, 0);
1930 pp_identifier (pp, code == BREAK_STMT ? "break" : "continue");
1931 pp_c_semicolon (pp);
1932 pp_needs_newline (pp) = true;
1938 tree e = code == RETURN_STMT
1939 ? RETURN_STMT_EXPR (stmt)
1940 : GOTO_DESTINATION (stmt);
1941 if (pp_needs_newline (pp))
1942 pp_newline_and_indent (pp, 0);
1943 pp_c_identifier (pp, code == RETURN_STMT ? "return" : "goto");
1944 pp_c_whitespace (pp);
1947 if (TREE_CODE (e) == INIT_EXPR
1948 && TREE_CODE (TREE_OPERAND (e, 0)) == RESULT_DECL)
1949 e = TREE_OPERAND (e, 1);
1950 pp_expression (pp, e);
1952 pp_c_semicolon (pp);
1953 pp_needs_newline (pp) = true;
1958 if (!SCOPE_NULLIFIED_P (stmt) && SCOPE_NO_CLEANUPS_P (stmt))
1961 if (pp_needs_newline (pp))
1962 pp_newline_and_indent (pp, 0);
1963 if (SCOPE_BEGIN_P (stmt))
1968 else if (SCOPE_END_P (stmt))
1970 pp_right_brace (pp);
1973 pp_indentation (pp) += i;
1974 pp_needs_newline (pp) = true;
1979 if (pp_needs_newline (pp))
1980 pp_newline_and_indent (pp, 0);
1981 pp_declaration (pp, DECL_STMT_DECL (stmt));
1982 pp_needs_newline (pp) = true;
1987 bool has_volatile_p = ASM_VOLATILE_P (stmt);
1988 bool is_extended = has_volatile_p || ASM_INPUTS (stmt)
1989 || ASM_OUTPUTS (stmt) || ASM_CLOBBERS (stmt);
1990 pp_c_identifier (pp, is_extended ? "__asm__" : "asm");
1992 pp_c_identifier (pp, "__volatile__");
1994 pp_c_left_paren (pp);
1995 pp_c_string_literal (pp, ASM_STRING (stmt));
1999 pp_separate_with (pp, ':');
2000 if (ASM_OUTPUTS (stmt))
2001 pp_expression (pp, ASM_OUTPUTS (stmt));
2003 pp_separate_with (pp, ':');
2004 if (ASM_INPUTS (stmt))
2005 pp_expression (pp, ASM_INPUTS (stmt));
2007 pp_separate_with (pp, ':');
2008 if (ASM_CLOBBERS (stmt))
2009 pp_expression (pp, ASM_CLOBBERS (stmt));
2011 pp_c_right_paren (pp);
2017 pp_c_identifier (pp, "__FILE__");
2020 pp_c_whitespace (pp);
2021 pp_c_identifier (pp, FILE_STMT_FILENAME (stmt));
2022 pp_c_semicolon (pp);
2023 pp_needs_newline (pp) = true;
2027 pp_unsupported_tree (pp, stmt);
2032 /* Initialize the PRETTY-PRINTER for handling C codes. */
2034 pp_c_pretty_printer_init (c_pretty_printer *pp)
2036 pp->offset_list = 0;
2038 pp->declaration = pp_c_declaration;
2039 pp->declaration_specifiers = pp_c_declaration_specifiers;
2040 pp->declarator = pp_c_declarator;
2041 pp->direct_declarator = pp_c_direct_declarator;
2042 pp->type_specifier_seq = pp_c_specifier_qualifier_list;
2043 pp->abstract_declarator = pp_c_abstract_declarator;
2044 pp->direct_abstract_declarator = pp_c_direct_abstract_declarator;
2045 pp->ptr_operator = pp_c_pointer;
2046 pp->parameter_list = pp_c_parameter_type_list;
2047 pp->type_id = pp_c_type_id;
2048 pp->simple_type_specifier = pp_c_type_specifier;
2049 pp->function_specifier = pp_c_function_specifier;
2050 pp->storage_class_specifier = pp_c_storage_class_specifier;
2052 pp->statement = pp_c_statement;
2054 pp->id_expression = pp_c_id_expression;
2055 pp->primary_expression = pp_c_primary_expression;
2056 pp->postfix_expression = pp_c_postfix_expression;
2057 pp->unary_expression = pp_c_unary_expression;
2058 pp->initializer = pp_c_initializer;
2059 pp->multiplicative_expression = pp_c_multiplicative_expression;
2060 pp->conditional_expression = pp_c_conditional_expression;
2061 pp->assignment_expression = pp_c_assignment_expression;
2062 pp->expression = pp_c_expression;