Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 217 lines (188 sloc) 9.15 kB
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
1 /* Various declarations for the C and C++ pretty-printers.
d91f752 Update Copyright years for files modified in 2010.
jakub authored
2 Copyright (C) 2002, 2003, 2004, 2007, 2009, 2010
3 Free Software Foundation, Inc.
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
4 Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
8c4c00c Change copyright header to refer to version 3 of the GNU General Publ…
nickc authored
10 Software Foundation; either version 3, or (at your option) any later
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
8c4c00c Change copyright header to refer to version 3 of the GNU General Publ…
nickc authored
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
21
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
22 #ifndef GCC_C_PRETTY_PRINTER
23 #define GCC_C_PRETTY_PRINTER
24
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
25 #include "tree.h"
6ee9792 behalf of romain.geissler@gmail.com. Fix plugin file installation
chrbr authored
26 #include "c-family/c-common.h"
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
27 #include "pretty-print.h"
28
29
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
30 typedef enum
31 {
32 pp_c_flag_abstract = 1 << 1,
8a47db4 2012-06-04 Sterling Augustine <saugustine@google.com>
sterling authored
33 pp_c_flag_gnu_v3 = 1 << 2,
34 pp_c_flag_last_bit = 3
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
35 } pp_c_pretty_print_flags;
36
37
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
38 /* The data type used to bundle information necessary for pretty-printing
39 a C or C++ entity. */
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
40 typedef struct c_pretty_print_info c_pretty_printer;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
41
42 /* The type of a C pretty-printer 'member' function. */
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
43 typedef void (*c_pretty_print_fn) (c_pretty_printer *, tree);
44
45 /* The datatype that contains information necessary for pretty-printing
46 a tree that represents a C construct. Any pretty-printer for a
47 language using C/c++ syntax can derive from this datatype and reuse
48 facilities provided here. It can do so by having a subobject of type
49 c_pretty_printer and override the macro pp_c_base to return a pointer
f024691 * c-pretty-print.c: Fix comment typos.
kazu authored
50 to that subobject. Such a pretty-printer has the responsibility to
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
51 initialize the pp_base() part, then call pp_c_pretty_printer_init
52 to set up the components that are specific to the C pretty-printer.
53 A derived pretty-printer can override any function listed in the
54 vtable below. See cp/cxx-pretty-print.h and cp/cxx-pretty-print.c
55 for an example of derivation. */
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
56 struct c_pretty_print_info
57 {
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
58 pretty_printer base;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
59 /* Points to the first element of an array of offset-list.
60 Not used yet. */
61 int *offset_list;
62
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
63 pp_flags flags;
a0c938f Whitespace fixups
mrs authored
64
87fcb60 * c-pretty-print.h: Fix comment typos.
kazu authored
65 /* These must be overridden by each of the C and C++ front-end to
d716ce7 * alias.c: Fix comment typos.
kazu authored
66 reflect their understanding of syntactic productions when they differ. */
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
67 c_pretty_print_fn declaration;
68 c_pretty_print_fn declaration_specifiers;
69 c_pretty_print_fn declarator;
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
70 c_pretty_print_fn abstract_declarator;
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
71 c_pretty_print_fn direct_abstract_declarator;
72 c_pretty_print_fn type_specifier_seq;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
73 c_pretty_print_fn direct_declarator;
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
74 c_pretty_print_fn ptr_operator;
75 c_pretty_print_fn parameter_list;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
76 c_pretty_print_fn type_id;
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
77 c_pretty_print_fn simple_type_specifier;
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
78 c_pretty_print_fn function_specifier;
79 c_pretty_print_fn storage_class_specifier;
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
80 c_pretty_print_fn initializer;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
81
82 c_pretty_print_fn statement;
83
bb0c6c2 2005-12-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
gdr authored
84 c_pretty_print_fn constant;
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
85 c_pretty_print_fn id_expression;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
86 c_pretty_print_fn primary_expression;
87 c_pretty_print_fn postfix_expression;
88 c_pretty_print_fn unary_expression;
89 c_pretty_print_fn multiplicative_expression;
90 c_pretty_print_fn conditional_expression;
91 c_pretty_print_fn assignment_expression;
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
92 c_pretty_print_fn expression;
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
93 };
94
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
95 /* Override the pp_base macro. Derived pretty-printers should not
96 touch this macro. Instead they should override pp_c_base instead. */
aa6db49 Remove pedwarn_with_decl, warning_with_decl and error_with_decl
gdr authored
97 #undef pp_base
98 #define pp_base(PP) (&pp_c_base (PP)->base)
99
4ee9c68 Merge tree-ssa-20020619-branch into mainline.
dnovillo authored
100
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
101 #define pp_c_tree_identifier(PPI, ID) \
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
102 pp_c_identifier (PPI, IDENTIFIER_POINTER (ID))
103
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
104 #define pp_declaration(PPI, T) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
105 pp_c_base (PPI)->declaration (pp_c_base (PPI), T)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
106 #define pp_declaration_specifiers(PPI, D) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
107 pp_c_base (PPI)->declaration_specifiers (pp_c_base (PPI), D)
108 #define pp_abstract_declarator(PP, D) \
109 pp_c_base (PP)->abstract_declarator (pp_c_base (PP), D)
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
110 #define pp_type_specifier_seq(PPI, D) \
d7b8e04 * c-pretty-print.h (pp_type_specifier_seq): Fix thinko.
gdr authored
111 pp_c_base (PPI)->type_specifier_seq (pp_c_base (PPI), D)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
112 #define pp_declarator(PPI, D) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
113 pp_c_base (PPI)->declarator (pp_c_base (PPI), D)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
114 #define pp_direct_declarator(PPI, D) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
115 pp_c_base (PPI)->direct_declarator (pp_c_base (PPI), D)
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
116 #define pp_direct_abstract_declarator(PP, D) \
117 pp_c_base (PP)->direct_abstract_declarator (pp_c_base (PP), D)
118 #define pp_ptr_operator(PP, D) \
119 pp_c_base (PP)->ptr_operator (pp_c_base (PP), D)
120 #define pp_parameter_list(PPI, T) \
121 pp_c_base (PPI)->parameter_list (pp_c_base (PPI), T)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
122 #define pp_type_id(PPI, D) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
123 pp_c_base (PPI)->type_id (pp_c_base (PPI), D)
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
124 #define pp_simple_type_specifier(PP, T) \
125 pp_c_base (PP)->simple_type_specifier (pp_c_base (PP), T)
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
126 #define pp_function_specifier(PP, D) \
127 pp_c_base (PP)->function_specifier (pp_c_base (PP), D)
128 #define pp_storage_class_specifier(PP, D) \
129 pp_c_base (PP)->storage_class_specifier (pp_c_base (PP), D);
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
130
131 #define pp_statement(PPI, S) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
132 pp_c_base (PPI)->statement (pp_c_base (PPI), S)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
133
bb0c6c2 2005-12-30 Gabriel Dos Reis <gdr@integrable-solutions.net>
gdr authored
134 #define pp_constant(PP, E) \
135 pp_c_base (PP)->constant (pp_c_base (PP), E)
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
136 #define pp_id_expression(PP, E) \
137 pp_c_base (PP)->id_expression (pp_c_base (PP), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
138 #define pp_primary_expression(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
139 pp_c_base (PPI)->primary_expression (pp_c_base (PPI), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
140 #define pp_postfix_expression(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
141 pp_c_base (PPI)->postfix_expression (pp_c_base (PPI), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
142 #define pp_unary_expression(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
143 pp_c_base (PPI)->unary_expression (pp_c_base (PPI), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
144 #define pp_initializer(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
145 pp_c_base (PPI)->initializer (pp_c_base (PPI), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
146 #define pp_multiplicative_expression(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
147 pp_c_base (PPI)->multiplicative_expression (pp_c_base (PPI), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
148 #define pp_conditional_expression(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
149 pp_c_base (PPI)->conditional_expression (pp_c_base (PPI), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
150 #define pp_assignment_expression(PPI, E) \
bfdec0d * pretty-print.c (pp_base_indent): Rename from pp_indent.
gdr authored
151 pp_c_base (PPI)->assignment_expression (pp_c_base (PPI), E)
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
152 #define pp_expression(PP, E) \
153 pp_c_base (PP)->expression (pp_c_base (PP), E)
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
154
155
156 /* Returns the c_pretty_printer base object of PRETTY-PRINTER. This
87fcb60 * c-pretty-print.h: Fix comment typos.
kazu authored
157 macro must be overridden by any subclass of c_pretty_print_info. */
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
158 #define pp_c_base(PP) (PP)
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
159
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
160 extern void pp_c_pretty_printer_init (c_pretty_printer *);
161 void pp_c_whitespace (c_pretty_printer *);
162 void pp_c_left_paren (c_pretty_printer *);
163 void pp_c_right_paren (c_pretty_printer *);
2a9d763 * c-pretty-print.h (pp_c_left_brace): Declare.
gdr authored
164 void pp_c_left_brace (c_pretty_printer *);
165 void pp_c_right_brace (c_pretty_printer *);
f97c44f * c-pretty-print.c (pp_c_left_bracket): Make a function.
gdr authored
166 void pp_c_left_bracket (c_pretty_printer *);
167 void pp_c_right_bracket (c_pretty_printer *);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
168 void pp_c_dot (c_pretty_printer *);
169 void pp_c_ampersand (c_pretty_printer *);
f97c44f * c-pretty-print.c (pp_c_left_bracket): Make a function.
gdr authored
170 void pp_c_star (c_pretty_printer *);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
171 void pp_c_arrow (c_pretty_printer *);
172 void pp_c_semicolon (c_pretty_printer *);
f97c44f * c-pretty-print.c (pp_c_left_bracket): Make a function.
gdr authored
173 void pp_c_complement (c_pretty_printer *);
174 void pp_c_exclamation (c_pretty_printer *);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
175 void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
ed22b9f * c-pretty-print.c: #include "c-tree.h".
gdr authored
176
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
177 /* Declarations. */
4ee9c68 Merge tree-ssa-20020619-branch into mainline.
dnovillo authored
178 void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
179 void pp_c_function_definition (c_pretty_printer *, tree);
180 void pp_c_attributes (c_pretty_printer *, tree);
ee21242 ChangeLog gcc/c-family
ktietz authored
181 void pp_c_attributes_display (c_pretty_printer *, tree);
754eb2f 2010-06-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
manu authored
182 void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
183 void pp_c_type_qualifier_list (c_pretty_printer *, tree);
184 void pp_c_parameter_type_list (c_pretty_printer *, tree);
185 void pp_c_declaration (c_pretty_printer *, tree);
186 void pp_c_declaration_specifiers (c_pretty_printer *, tree);
187 void pp_c_declarator (c_pretty_printer *, tree);
188 void pp_c_direct_declarator (c_pretty_printer *, tree);
189 void pp_c_specifier_qualifier_list (c_pretty_printer *, tree);
190 void pp_c_function_specifier (c_pretty_printer *, tree);
191 void pp_c_type_id (c_pretty_printer *, tree);
192 void pp_c_direct_abstract_declarator (c_pretty_printer *, tree);
193 void pp_c_type_specifier (c_pretty_printer *, tree);
194 void pp_c_storage_class_specifier (c_pretty_printer *, tree);
1501e78 * c-pretty-print.h (pp_c_statement): Declare.
gdr authored
195 /* Statements. */
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
196 void pp_c_statement (c_pretty_printer *, tree);
ba21936 2002-07-29 Gabriel Dos Reis <gdr@nerim.net>
gdr authored
197 /* Expressions. */
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
198 void pp_c_expression (c_pretty_printer *, tree);
199 void pp_c_logical_or_expression (c_pretty_printer *, tree);
200 void pp_c_expression_list (c_pretty_printer *, tree);
c75b459 Make CONSTRUCTOR use VEC to store initializers.
giovannibajo authored
201 void pp_c_constructor_elts (c_pretty_printer *, VEC(constructor_elt,gc) *);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
202 void pp_c_call_argument_list (c_pretty_printer *, tree);
203 void pp_c_unary_expression (c_pretty_printer *, tree);
204 void pp_c_cast_expression (c_pretty_printer *, tree);
205 void pp_c_postfix_expression (c_pretty_printer *, tree);
206 void pp_c_primary_expression (c_pretty_printer *, tree);
207 void pp_c_init_declarator (c_pretty_printer *, tree);
208 void pp_c_constant (c_pretty_printer *, tree);
209 void pp_c_id_expression (c_pretty_printer *, tree);
1e00012 * c-objc-common.c (c_tree_printer): Print identifiers with
jsm28 authored
210 void pp_c_ws_string (c_pretty_printer *, const char *);
c10de5e * pretty-print.h (pp_maybe_newline_and_indent): New macro.
gdr authored
211 void pp_c_identifier (c_pretty_printer *, const char *);
212 void pp_c_string_literal (c_pretty_printer *, tree);
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
213
4ee9c68 Merge tree-ssa-20020619-branch into mainline.
dnovillo authored
214 void print_c_tree (FILE *file, tree t);
215
980451f * c-pretty-print.h: Guard against multiple inclusion.
gdr authored
216 #endif /* GCC_C_PRETTY_PRINTER */
Something went wrong with that request. Please try again.