]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gcc/c-tree.h
This commit was generated by cvs2svn to compensate for changes in r99461,
[FreeBSD/FreeBSD.git] / contrib / gcc / c-tree.h
1 /* Definitions for C parsing and type checking.
2    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3    1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
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
10 version.
11
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
15 for more details.
16
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
20 02111-1307, USA.  */
21
22 /* $FreeBSD$ */
23
24 #ifndef GCC_C_TREE_H
25 #define GCC_C_TREE_H
26
27 #include "c-common.h"
28
29 /* Language-dependent contents of an identifier.  */
30
31 /* The limbo_value is used for block level extern declarations, which need
32    to be type checked against subsequent extern declarations.  They can't
33    be referenced after they fall out of scope, so they can't be global.
34
35    The rid_code field is used for keywords.  It is in all
36    lang_identifier nodes, because some keywords are only special in a
37    particular context.  */
38
39 struct lang_identifier
40 {
41   struct c_common_identifier ignore;
42   tree global_value, local_value, label_value, implicit_decl;
43   tree error_locus, limbo_value;
44 };
45
46 /* Language-specific declaration information.  */
47
48 struct lang_decl
49 {
50   struct c_lang_decl base;
51   /* The return types and parameter types may have variable size.
52      This is a list of any SAVE_EXPRs that need to be evaluated to
53      compute those sizes.  */
54   tree pending_sizes;
55 };
56
57 /* Macros for access to language-specific slots in an identifier.  */
58 /* Each of these slots contains a DECL node or null.  */
59
60 /* This represents the value which the identifier has in the
61    file-scope namespace.  */
62 #define IDENTIFIER_GLOBAL_VALUE(NODE)   \
63   (((struct lang_identifier *) (NODE))->global_value)
64 /* This represents the value which the identifier has in the current
65    scope.  */
66 #define IDENTIFIER_LOCAL_VALUE(NODE)    \
67   (((struct lang_identifier *) (NODE))->local_value)
68 /* This represents the value which the identifier has as a label in
69    the current label scope.  */
70 #define IDENTIFIER_LABEL_VALUE(NODE)    \
71   (((struct lang_identifier *) (NODE))->label_value)
72 /* This records the extern decl of this identifier, if it has had one
73    at any point in this compilation.  */
74 #define IDENTIFIER_LIMBO_VALUE(NODE)    \
75   (((struct lang_identifier *) (NODE))->limbo_value)
76 /* This records the implicit function decl of this identifier, if it
77    has had one at any point in this compilation.  */
78 #define IDENTIFIER_IMPLICIT_DECL(NODE)  \
79   (((struct lang_identifier *) (NODE))->implicit_decl)
80 /* This is the last function in which we printed an "undefined variable"
81    message for this identifier.  Value is a FUNCTION_DECL or null.  */
82 #define IDENTIFIER_ERROR_LOCUS(NODE)    \
83   (((struct lang_identifier *) (NODE))->error_locus)
84
85 /* In identifiers, C uses the following fields in a special way:
86    TREE_PUBLIC        to record that there was a previous local extern decl.
87    TREE_USED          to record that such a decl was used.
88    TREE_ADDRESSABLE   to record that the address of such a decl was used.  */
89
90 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
91 #define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
92
93 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile.  */
94 #define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE)
95
96 /* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
97    nonzero if the definition of the type has already started.  */
98 #define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
99
100 /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
101    keyword.  C_RID_CODE (node) is then the RID_* value of the keyword,
102    and C_RID_YYCODE is the token number wanted by Yacc.  */
103 #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
104
105 /* This function was declared inline.  This flag controls the linkage
106    semantics of 'inline'; whether or not the function is inlined is
107    controlled by DECL_INLINE.  */
108 #define DECL_DECLARED_INLINE_P(NODE) \
109   (DECL_LANG_SPECIFIC (NODE)->base.declared_inline)
110
111 /* In a RECORD_TYPE, a sorted array of the fields of the type.  */
112 struct lang_type
113 {
114   int len;
115   tree elts[1];
116 };
117
118 /* Record whether a type or decl was written with nonconstant size.
119    Note that TYPE_SIZE may have simplified to a constant.  */
120 #define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
121 #define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
122
123 #if 0 /* Not used.  */
124 /* Record whether a decl for a function or function pointer has
125    already been mentioned (in a warning) because it was called
126    but didn't have a prototype.  */
127 #define C_MISSING_PROTOTYPE_WARNED(DECL) DECL_LANG_FLAG_2 (DECL)
128 #endif
129
130 /* Store a value in that field.  */
131 #define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
132   (TREE_COMPLEXITY (EXP) = (int) (CODE))
133
134 /* Record whether a typedef for type `int' was actually `signed int'.  */
135 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
136
137 /* For a FUNCTION_DECL, nonzero if it was defined without an explicit
138    return type.  */
139 #define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP)
140
141 /* Nonzero for a declaration of a built in function if there has been no
142    occasion that would declare the function in ordinary C.
143    Using the function draws a pedantic warning in this case.  */
144 #define C_DECL_ANTICIPATED(EXP) DECL_LANG_FLAG_3 (EXP)
145
146 /* For FUNCTION_TYPE, a hidden list of types of arguments.  The same as
147    TYPE_ARG_TYPES for functions with prototypes, but created for functions
148    without prototypes.  */
149 #define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE)
150
151 \f
152 /* in c-lang.c and objc-act.c */
153 extern tree lookup_interface                    PARAMS ((tree));
154 extern tree is_class_name                       PARAMS ((tree));
155 extern void maybe_objc_check_decl               PARAMS ((tree));
156 extern void finish_file                         PARAMS ((void));
157 extern int maybe_objc_comptypes                 PARAMS ((tree, tree, int));
158 extern tree maybe_building_objc_message_expr    PARAMS ((void));
159 extern int recognize_objc_keyword               PARAMS ((void));
160 extern tree lookup_objc_ivar                    PARAMS ((tree));
161
162 \f
163 /* in c-parse.in */
164 extern void c_parse_init                        PARAMS ((void));
165 extern void c_set_yydebug                       PARAMS ((int));
166 extern int yyparse_1                            PARAMS ((void));
167
168 /* in c-aux-info.c */
169 extern void gen_aux_info_record                 PARAMS ((tree, int, int, int));
170
171 /* in c-decl.c */
172 extern void c_init_decl_processing              PARAMS ((void));
173 extern void c_print_identifier                  PARAMS ((FILE *, tree, int));
174 extern tree build_array_declarator              PARAMS ((tree, tree, int, int));
175 extern tree build_enumerator                    PARAMS ((tree, tree));
176 extern int  c_decode_option                     PARAMS ((int, char **));
177 extern void c_mark_varargs                      PARAMS ((void));
178 extern void check_for_loop_decls                PARAMS ((void));
179 extern void clear_parm_order                    PARAMS ((void));
180 extern int  complete_array_type                 PARAMS ((tree, tree, int));
181 extern void declare_parm_level                  PARAMS ((int));
182 extern tree define_label                        PARAMS ((const char *, int,
183                                                          tree));
184 extern void finish_decl                         PARAMS ((tree, tree, tree));
185 extern tree finish_enum                         PARAMS ((tree, tree, tree));
186 extern void finish_function                     PARAMS ((int, int));
187 extern tree finish_struct                       PARAMS ((tree, tree, tree));
188 extern tree get_parm_info                       PARAMS ((int));
189 extern tree grokfield                           PARAMS ((const char *, int, tree, tree, tree));
190 extern tree groktypename                        PARAMS ((tree));
191 extern tree groktypename_in_parm_context        PARAMS ((tree));
192 extern tree implicitly_declare                  PARAMS ((tree));
193 extern void implicit_decl_warning               PARAMS ((tree));
194 extern int  in_parm_level_p                     PARAMS ((void));
195 extern void keep_next_level                     PARAMS ((void));
196 extern int  kept_level_p                        PARAMS ((void));
197 extern tree lookup_name                         PARAMS ((tree));
198 extern tree lookup_name_current_level           PARAMS ((tree));
199 extern void parmlist_tags_warning               PARAMS ((void));
200 extern void pending_xref_error                  PARAMS ((void));
201 extern void mark_c_function_context             PARAMS ((struct function *));
202 extern void push_c_function_context             PARAMS ((struct function *));
203 extern void pop_c_function_context              PARAMS ((struct function *));
204 extern void pop_label_level                     PARAMS ((void));
205 extern void push_label_level                    PARAMS ((void));
206 extern void push_parm_decl                      PARAMS ((tree));
207 extern tree pushdecl_top_level                  PARAMS ((tree));
208 extern void pushtag                             PARAMS ((tree, tree));
209 extern tree set_array_declarator_type           PARAMS ((tree, tree, int));
210 extern tree shadow_label                        PARAMS ((tree));
211 extern void shadow_tag                          PARAMS ((tree));
212 extern void shadow_tag_warned                   PARAMS ((tree, int));
213 extern tree start_enum                          PARAMS ((tree));
214 extern int  start_function                      PARAMS ((tree, tree, tree));
215 extern tree start_decl                          PARAMS ((tree, tree, int,
216                                                          tree));
217 extern tree start_struct                        PARAMS ((enum tree_code, tree));
218 extern void store_parm_decls                    PARAMS ((void));
219 extern tree xref_tag                            PARAMS ((enum tree_code, tree));
220 extern tree c_begin_compound_stmt               PARAMS ((void));
221 extern void c_expand_deferred_function          PARAMS ((tree));
222 extern void c_expand_decl_stmt                  PARAMS ((tree));
223
224
225 /* in c-objc-common.c */
226 extern int c_disregard_inline_limits            PARAMS ((tree));
227 extern int c_cannot_inline_tree_fn              PARAMS ((tree *));
228 extern const char *c_objc_common_init           PARAMS ((const char *));
229 extern int c_missing_noreturn_ok_p              PARAMS ((tree));
230 extern void c_objc_common_finish_file           PARAMS ((void));
231 extern int defer_fn                             PARAMS ((tree));
232
233 #define c_build_type_variant(TYPE, CONST_P, VOLATILE_P)           \
234   c_build_qualified_type ((TYPE),                                 \
235                           ((CONST_P) ? TYPE_QUAL_CONST : 0) |     \
236                           ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
237
238 /* in c-typeck.c */
239 extern tree require_complete_type               PARAMS ((tree));
240 extern int comptypes                            PARAMS ((tree, tree));
241 extern tree c_sizeof_nowarn                     PARAMS ((tree));
242 extern tree c_size_in_bytes                     PARAMS ((tree));
243 extern tree build_component_ref                 PARAMS ((tree, tree));
244 extern tree build_indirect_ref                  PARAMS ((tree, const char *));
245 extern tree build_array_ref                     PARAMS ((tree, tree));
246 extern tree build_external_ref                  PARAMS ((tree, int));
247 extern tree parser_build_binary_op              PARAMS ((enum tree_code,
248                                                          tree, tree));
249 extern void readonly_warning                    PARAMS ((tree, const char *));
250 extern tree build_conditional_expr              PARAMS ((tree, tree, tree));
251 extern tree build_compound_expr                 PARAMS ((tree));
252 extern tree c_cast_expr                         PARAMS ((tree, tree));
253 extern tree build_c_cast                        PARAMS ((tree, tree));
254 extern tree build_modify_expr                   PARAMS ((tree, enum tree_code,
255                                                          tree));
256 extern void store_init_value                    PARAMS ((tree, tree));
257 extern void error_init                          PARAMS ((const char *));
258 extern void pedwarn_init                        PARAMS ((const char *));
259 extern void start_init                          PARAMS ((tree, tree, int));
260 extern void finish_init                         PARAMS ((void));
261 extern void really_start_incremental_init       PARAMS ((tree));
262 extern void push_init_level                     PARAMS ((int));
263 extern tree pop_init_level                      PARAMS ((int));
264 extern void set_init_index                      PARAMS ((tree, tree));
265 extern void set_init_label                      PARAMS ((tree));
266 extern void process_init_element                PARAMS ((tree));
267 extern tree build_compound_literal              PARAMS ((tree, tree));
268 extern void pedwarn_c99                         PARAMS ((const char *, ...))
269                                                         ATTRIBUTE_PRINTF_1;
270 extern tree c_start_case                        PARAMS ((tree));
271 extern void c_finish_case                       PARAMS ((void));
272 extern tree simple_asm_stmt                     PARAMS ((tree));
273 extern tree build_asm_stmt                      PARAMS ((tree, tree, tree,
274                                                          tree, tree));
275 extern tree c_convert_parm_for_inlining         PARAMS ((tree, tree, tree));
276
277 /* Set to 0 at beginning of a function definition, set to 1 if
278    a return statement that specifies a return value is seen.  */
279
280 extern int current_function_returns_value;
281
282 /* Set to 0 at beginning of a function definition, set to 1 if
283    a return statement with no argument is seen.  */
284
285 extern int current_function_returns_null;
286
287 /* Set to 0 at beginning of a function definition, set to 1 if
288    a call to a noreturn function is seen.  */
289
290 extern int current_function_returns_abnormally;
291
292 /* Nonzero means the expression being parsed will never be evaluated.
293    This is a count, since unevaluated expressions can nest.  */
294
295 extern int skip_evaluation;
296
297 /* Nonzero means `$' can be in an identifier.  */
298
299 extern int dollars_in_ident;
300
301 /* Nonzero means allow type mismatches in conditional expressions;
302    just make their values `void'.  */
303
304 extern int flag_cond_mismatch;
305
306 /* Nonzero means don't recognize the keyword `asm'.  */
307
308 extern int flag_no_asm;
309
310 /* Nonzero means warn about implicit declarations.  */
311
312 extern int warn_implicit;
313
314 /* Nonzero means warn for all old-style non-prototype function decls.  */
315
316 extern int warn_strict_prototypes;
317
318 /* Nonzero means warn about multiple (redundant) decls for the same single
319    variable or function.  */
320
321 extern int warn_redundant_decls;
322
323 /* Nonzero means warn about extern declarations of objects not at
324    file-scope level and about *all* declarations of functions (whether
325    extern or static) not at file-scope level.  Note that we exclude
326    implicit function declarations.  To get warnings about those, use
327    -Wimplicit.  */
328
329 extern int warn_nested_externs;
330
331 /* Nonzero means warn about pointer casts that can drop a type qualifier
332    from the pointer target type.  */
333
334 extern int warn_cast_qual;
335
336 /* Nonzero means warn when casting a function call to a type that does
337    not match the return type (e.g. (float)sqrt() or (anything*)malloc()
338    when there is no previous declaration of sqrt or malloc.  */
339
340 extern int warn_bad_function_cast;
341
342 /* Warn about traditional constructs whose meanings changed in ANSI C.  */
343
344 extern int warn_traditional;
345
346 /* Warn about a subscript that has type char.  */
347
348 extern int warn_char_subscripts;
349
350 /* Warn if main is suspicious.  */
351
352 extern int warn_main;
353
354 /* Nonzero means to allow single precision math even if we're generally
355    being traditional.  */
356 extern int flag_allow_single_precision;
357
358 /* Warn if initializer is not completely bracketed.  */
359
360 extern int warn_missing_braces;
361
362 /* Warn about comparison of signed and unsigned values.  */
363
364 extern int warn_sign_compare;
365
366 /* Warn about testing equality of floating point numbers.  */
367
368 extern int warn_float_equal;
369
370 /* Warn about multicharacter constants.  */
371
372 extern int warn_multichar;
373
374 /* Nonzero means we are reading code that came from a system header file.  */
375
376 extern int system_header_p;
377
378 /* Warn about implicit declarations.  1 = warning, 2 = error.  */
379 extern int mesg_implicit_function_declaration;
380
381 /* In c-decl.c */
382 extern void finish_incomplete_decl PARAMS ((tree));
383
384 extern tree static_ctors;
385 extern tree static_dtors;
386
387 #endif /* ! GCC_C_TREE_H */