oops - omitted from previous delta fixing UNIQUE_SECTION
[official-gcc.git] / gcc / c-tree.h
blob67013e3d8ae8bf0e2601f80483abafbb47dc1ae4
1 /* Definitions for C parsing and type checking.
2 Copyright (C) 1987, 93-95, 97-99, 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 #ifndef _C_TREE_H
22 #define _C_TREE_H
24 #include "c-common.h"
26 /* Language-dependent contents of an identifier. */
28 /* The limbo_value is used for block level extern declarations, which need
29 to be type checked against subsequent extern declarations. They can't
30 be referenced after they fall out of scope, so they can't be global. */
32 struct lang_identifier
34 struct tree_identifier ignore;
35 tree global_value, local_value, label_value, implicit_decl;
36 tree error_locus, limbo_value;
39 /* Macros for access to language-specific slots in an identifier. */
40 /* Each of these slots contains a DECL node or null. */
42 /* This represents the value which the identifier has in the
43 file-scope namespace. */
44 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
45 (((struct lang_identifier *) (NODE))->global_value)
46 /* This represents the value which the identifier has in the current
47 scope. */
48 #define IDENTIFIER_LOCAL_VALUE(NODE) \
49 (((struct lang_identifier *) (NODE))->local_value)
50 /* This represents the value which the identifier has as a label in
51 the current label scope. */
52 #define IDENTIFIER_LABEL_VALUE(NODE) \
53 (((struct lang_identifier *) (NODE))->label_value)
54 /* This records the extern decl of this identifier, if it has had one
55 at any point in this compilation. */
56 #define IDENTIFIER_LIMBO_VALUE(NODE) \
57 (((struct lang_identifier *) (NODE))->limbo_value)
58 /* This records the implicit function decl of this identifier, if it
59 has had one at any point in this compilation. */
60 #define IDENTIFIER_IMPLICIT_DECL(NODE) \
61 (((struct lang_identifier *) (NODE))->implicit_decl)
62 /* This is the last function in which we printed an "undefined variable"
63 message for this identifier. Value is a FUNCTION_DECL or null. */
64 #define IDENTIFIER_ERROR_LOCUS(NODE) \
65 (((struct lang_identifier *) (NODE))->error_locus)
67 /* In identifiers, C uses the following fields in a special way:
68 TREE_PUBLIC to record that there was a previous local extern decl.
69 TREE_USED to record that such a decl was used.
70 TREE_ADDRESSABLE to record that the address of such a decl was used. */
72 /* Nonzero means reject anything that ANSI standard C forbids. */
73 extern int pedantic;
75 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
76 #define C_TYPE_FIELDS_READONLY(type) TREE_LANG_FLAG_1 (type)
78 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */
79 #define C_TYPE_FIELDS_VOLATILE(type) TREE_LANG_FLAG_2 (type)
81 /* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
82 nonzero if the definition of the type has already started. */
83 #define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type)
85 /* C types are partitioned into three subsets: object, function, and
86 incomplete types. */
87 #define C_TYPE_OBJECT_P(type) \
88 (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type))
90 #define C_TYPE_FUNCTION_P(type) \
91 (TREE_CODE (type) == FUNCTION_TYPE)
93 #define C_TYPE_INCOMPLETE_P(type) \
94 (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0)
96 /* For convenience we define a single macro to identify the class of
97 object or incomplete types. */
98 #define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
99 (!C_TYPE_FUNCTION_P (type))
101 /* In a RECORD_TYPE, a sorted array of the fields of the type. */
102 struct lang_type
104 int len;
105 tree elts[1];
108 /* Mark which labels are explicitly declared.
109 These may be shadowed, and may be referenced from nested functions. */
110 #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
112 /* Record whether a type or decl was written with nonconstant size.
113 Note that TYPE_SIZE may have simplified to a constant. */
114 #define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type)
115 #define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_0 (type)
117 /* Record in each node resulting from a binary operator
118 what operator was specified for it. */
119 #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
121 #if 0 /* Not used. */
122 /* Record whether a decl for a function or function pointer has
123 already been mentioned (in a warning) because it was called
124 but didn't have a prototype. */
125 #define C_MISSING_PROTOTYPE_WARNED(decl) DECL_LANG_FLAG_2(decl)
126 #endif
128 /* Store a value in that field. */
129 #define C_SET_EXP_ORIGINAL_CODE(exp, code) \
130 (TREE_COMPLEXITY (exp) = (int) (code))
132 /* Record whether a typedef for type `int' was actually `signed int'. */
133 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
135 /* Nonzero for a declaration of a built in function if there has been no
136 occasion that would declare the function in ordinary C.
137 Using the function draws a pedantic warning in this case. */
138 #define C_DECL_ANTICIPATED(exp) DECL_LANG_FLAG_3 ((exp))
140 /* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
141 TYPE_ARG_TYPES for functions with prototypes, but created for functions
142 without prototypes. */
143 #define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_NONCOPIED_PARTS (NODE)
145 /* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */
146 #define DECL_C_BIT_FIELD(NODE) DECL_LANG_FLAG_4 (NODE)
148 /* In a VAR_DECL, means the variable is really an iterator. */
149 #define ITERATOR_P(D) (DECL_LANG_FLAG_4(D))
151 /* In a VAR_DECL for an iterator, means we are within
152 an explicit loop over that iterator. */
153 #define ITERATOR_BOUND_P(NODE) ((NODE)->common.readonly_flag)
155 /* in c-lang.c and objc-act.c */
156 extern tree lookup_interface PARAMS ((tree));
157 extern tree is_class_name PARAMS ((tree));
158 extern void maybe_objc_check_decl PARAMS ((tree));
159 extern void finish_file PARAMS ((void));
160 extern int maybe_objc_comptypes PARAMS ((tree, tree, int));
161 extern tree maybe_building_objc_message_expr PARAMS ((void));
162 extern tree maybe_objc_method_name PARAMS ((tree));
163 extern int recognize_objc_keyword PARAMS ((void));
164 extern tree build_objc_string PARAMS ((int, const char *));
166 /* in c-parse.in */
167 extern void c_parse_init PARAMS ((void));
169 /* in c-aux-info.c */
170 extern void gen_aux_info_record PARAMS ((tree, int, int, int));
172 /* in c-convert.c */
173 extern tree convert PARAMS ((tree, tree));
175 /* in c-decl.c */
176 extern tree build_enumerator PARAMS ((tree, tree));
177 /* Add qualifiers to a type, in the fashion for C. */
178 extern tree c_build_qualified_type PARAMS ((tree, int));
179 #define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \
180 c_build_qualified_type (TYPE, \
181 ((CONST_P) ? TYPE_QUAL_CONST : 0) | \
182 ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
183 extern int c_decode_option PARAMS ((int, char **));
184 extern void c_mark_varargs PARAMS ((void));
185 extern tree check_identifier PARAMS ((tree, tree));
186 extern void clear_parm_order PARAMS ((void));
187 extern tree combine_parm_decls PARAMS ((tree, tree, int));
188 extern int complete_array_type PARAMS ((tree, tree, int));
189 extern void declare_parm_level PARAMS ((int));
190 extern tree define_label PARAMS ((char *, int, tree));
191 extern void delete_block PARAMS ((tree));
192 extern void finish_decl PARAMS ((tree, tree, tree));
193 extern void finish_decl_top_level PARAMS ((tree, tree, tree));
194 extern tree finish_enum PARAMS ((tree, tree, tree));
195 extern void finish_function PARAMS ((int));
196 extern tree finish_struct PARAMS ((tree, tree, tree));
197 extern tree get_parm_info PARAMS ((int));
198 extern tree getdecls PARAMS ((void));
199 extern tree gettags PARAMS ((void));
200 extern int global_bindings_p PARAMS ((void));
201 extern tree grokfield PARAMS ((const char *, int, tree, tree, tree));
202 extern tree groktypename PARAMS ((tree));
203 extern tree groktypename_in_parm_context PARAMS ((tree));
204 extern tree implicitly_declare PARAMS ((tree));
205 extern int in_parm_level_p PARAMS ((void));
206 extern void init_decl_processing PARAMS ((void));
207 extern void insert_block PARAMS ((tree));
208 extern void keep_next_level PARAMS ((void));
209 extern int kept_level_p PARAMS ((void));
210 extern tree lookup_label PARAMS ((tree));
211 extern tree lookup_name PARAMS ((tree));
212 extern tree lookup_name_current_level PARAMS ((tree));
213 extern tree lookup_name_current_level_global PARAMS ((tree));
214 extern tree maybe_build_cleanup PARAMS ((tree));
215 extern void parmlist_tags_warning PARAMS ((void));
216 extern void pending_xref_error PARAMS ((void));
217 extern void mark_c_function_context PARAMS ((struct function *));
218 extern void push_c_function_context PARAMS ((struct function *));
219 extern void pop_c_function_context PARAMS ((struct function *));
220 extern void pop_label_level PARAMS ((void));
221 extern tree poplevel PARAMS ((int, int, int));
222 extern void print_lang_decl PARAMS ((FILE *, tree, int));
223 extern void print_lang_identifier PARAMS ((FILE *, tree, int));
224 extern void print_lang_type PARAMS ((FILE *, tree, int));
225 extern void push_label_level PARAMS ((void));
226 extern void push_parm_decl PARAMS ((tree));
227 extern tree pushdecl PARAMS ((tree));
228 extern tree pushdecl_top_level PARAMS ((tree));
229 extern void pushlevel PARAMS ((int));
230 extern void pushtag PARAMS ((tree, tree));
231 extern void set_block PARAMS ((tree));
232 extern tree shadow_label PARAMS ((tree));
233 extern void shadow_record_fields PARAMS ((tree));
234 extern void shadow_tag PARAMS ((tree));
235 extern void shadow_tag_warned PARAMS ((tree, int));
236 extern tree start_enum PARAMS ((tree));
237 extern int start_function PARAMS ((tree, tree, tree,
238 tree));
239 extern tree start_decl PARAMS ((tree, tree, int,
240 tree, tree));
241 extern tree start_struct PARAMS ((enum tree_code, tree));
242 extern void store_parm_decls PARAMS ((void));
243 extern tree xref_tag PARAMS ((enum tree_code, tree));
245 /* in c-typeck.c */
246 extern tree require_complete_type PARAMS ((tree));
247 extern void incomplete_type_error PARAMS ((tree, tree));
248 /* Given two integer or real types, return the type for their sum.
249 Given two compatible ANSI C types, returns the merged type. */
250 extern tree common_type PARAMS ((tree, tree));
251 extern int comptypes PARAMS ((tree, tree));
252 extern tree c_sizeof PARAMS ((tree));
253 extern tree c_sizeof_nowarn PARAMS ((tree));
254 extern tree c_size_in_bytes PARAMS ((tree));
255 extern tree c_alignof PARAMS ((tree));
256 extern tree c_alignof_expr PARAMS ((tree));
257 extern tree default_conversion PARAMS ((tree));
258 extern tree build_component_ref PARAMS ((tree, tree));
259 extern tree build_indirect_ref PARAMS ((tree, const char *));
260 extern tree build_array_ref PARAMS ((tree, tree));
261 extern tree build_function_call PARAMS ((tree, tree));
262 extern tree parser_build_binary_op PARAMS ((enum tree_code,
263 tree, tree));
264 extern tree build_binary_op PARAMS ((enum tree_code,
265 tree, tree, int));
266 extern tree build_unary_op PARAMS ((enum tree_code,
267 tree, int));
268 extern int lvalue_p PARAMS ((tree));
269 extern int lvalue_or_else PARAMS ((tree, const char *));
270 extern void readonly_warning PARAMS ((tree, const char *));
271 extern int mark_addressable PARAMS ((tree));
272 extern tree build_conditional_expr PARAMS ((tree, tree, tree));
273 extern tree build_compound_expr PARAMS ((tree));
274 extern tree build_c_cast PARAMS ((tree, tree));
275 extern tree build_modify_expr PARAMS ((tree, enum tree_code,
276 tree));
277 extern void store_init_value PARAMS ((tree, tree));
278 extern void error_init PARAMS ((const char *));
279 extern void pedwarn_init PARAMS ((const char *));
280 extern void start_init PARAMS ((tree, tree, int));
281 extern void finish_init PARAMS ((void));
282 extern void really_start_incremental_init PARAMS ((tree));
283 extern void push_init_level PARAMS ((int));
284 extern tree pop_init_level PARAMS ((int));
285 extern void set_init_index PARAMS ((tree, tree));
286 extern void set_init_label PARAMS ((tree));
287 extern void process_init_element PARAMS ((tree));
288 extern void c_expand_asm_operands PARAMS ((tree, tree, tree,
289 tree, int, char *,
290 int));
291 extern void c_expand_return PARAMS ((tree));
292 extern tree c_expand_start_case PARAMS ((tree));
294 /* in c-iterate.c */
295 extern void init_iterators PARAMS ((void));
296 extern void iterator_expand PARAMS ((tree));
297 extern void iterator_for_loop_start PARAMS ((tree));
298 extern void iterator_for_loop_end PARAMS ((tree));
299 extern void iterator_for_loop_record PARAMS ((tree));
300 extern void push_iterator_stack PARAMS ((void));
301 extern void pop_iterator_stack PARAMS ((void));
303 /* Set to 0 at beginning of a function definition, set to 1 if
304 a return statement that specifies a return value is seen. */
306 extern int current_function_returns_value;
308 /* Set to 0 at beginning of a function definition, set to 1 if
309 a return statement with no argument is seen. */
311 extern int current_function_returns_null;
313 /* Nonzero means the expression being parsed will never be evaluated.
314 This is a count, since unevaluated expressions can nest. */
316 extern int skip_evaluation;
318 /* Nonzero means `$' can be in an identifier. */
320 extern int dollars_in_ident;
322 /* Nonzero means allow type mismatches in conditional expressions;
323 just make their values `void'. */
325 extern int flag_cond_mismatch;
327 /* Nonzero means don't recognize the keyword `asm'. */
329 extern int flag_no_asm;
331 /* Nonzero means environment is hosted (i.e., not freestanding) */
333 extern int flag_hosted;
335 /* Nonzero means warn about implicit declarations. */
337 extern int warn_implicit;
339 /* Nonzero means give string constants the type `const char *'
340 to get extra warnings from them. These warnings will be too numerous
341 to be useful, except in thoroughly ANSIfied programs. */
343 extern int flag_const_strings;
345 /* Nonzero means warn about sizeof (function) or addition/subtraction
346 of function pointers. */
348 extern int warn_pointer_arith;
350 /* Nonzero means warn for all old-style non-prototype function decls. */
352 extern int warn_strict_prototypes;
354 /* Nonzero means warn about multiple (redundant) decls for the same single
355 variable or function. */
357 extern int warn_redundant_decls;
359 /* Nonzero means warn about extern declarations of objects not at
360 file-scope level and about *all* declarations of functions (whether
361 extern or static) not at file-scope level. Note that we exclude
362 implicit function declarations. To get warnings about those, use
363 -Wimplicit. */
365 extern int warn_nested_externs;
367 /* Nonzero means warn about pointer casts that can drop a type qualifier
368 from the pointer target type. */
370 extern int warn_cast_qual;
372 /* Nonzero means warn when casting a function call to a type that does
373 not match the return type (e.g. (float)sqrt() or (anything*)malloc()
374 when there is no previous declaration of sqrt or malloc. */
376 extern int warn_bad_function_cast;
378 /* Warn about functions which might be candidates for attribute noreturn. */
380 extern int warn_missing_noreturn;
382 /* Warn about traditional constructs whose meanings changed in ANSI C. */
384 extern int warn_traditional;
386 /* Warn about *printf or *scanf format/argument anomalies. */
388 extern int warn_format;
390 /* Warn about a subscript that has type char. */
392 extern int warn_char_subscripts;
394 /* Warn if a type conversion is done that might have confusing results. */
396 extern int warn_conversion;
398 /* Warn if main is suspicious. */
400 extern int warn_main;
402 /* Nonzero means do some things the same way PCC does. */
404 extern int flag_traditional;
406 /* Nonzero means use the ISO C99 dialect of C. */
408 extern int flag_isoc99;
410 /* Nonzero means to allow single precision math even if we're generally
411 being traditional. */
412 extern int flag_allow_single_precision;
414 /* Nonzero means warn about suggesting putting in ()'s. */
416 extern int warn_parentheses;
418 /* Warn if initializer is not completely bracketed. */
420 extern int warn_missing_braces;
422 /* Warn about comparison of signed and unsigned values. */
424 extern int warn_sign_compare;
426 /* Warn about testing equality of floating point numbers. */
428 extern int warn_float_equal;
430 /* Warn about multicharacter constants. */
432 extern int warn_multichar;
434 /* Warn about long long. */
436 extern int warn_long_long;
438 /* Nonzero means we are reading code that came from a system header file. */
440 extern int system_header_p;
442 /* Nonzero enables objc features. */
444 extern int doing_objc_thang;
446 /* In c-decl.c */
447 extern void finish_incomplete_decl PARAMS ((tree));
449 #endif /* not _C_TREE_H */