]> gcc.gnu.org Git - gcc.git/blame - gcc/c-tree.h
(finish_enum, finish_struct): Add ATTRIBUTES argument.
[gcc.git] / gcc / c-tree.h
CommitLineData
40754343 1/* Definitions for C parsing and type checking.
2a4f6a61 2 Copyright (C) 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
40754343
RS
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
7c57c798
RS
20#ifndef _C_TREE_H
21#define _C_TREE_H
cf1c49cb 22
40754343
RS
23/* Language-dependent contents of an identifier. */
24
ff92a691
JW
25/* The limbo_value is used for block level extern declarations, which need
26 to be type checked against subsequent extern declarations. They can't
27 be referenced after they fall out of scope, so they can't be global. */
28
40754343
RS
29struct lang_identifier
30{
31 struct tree_identifier ignore;
32 tree global_value, local_value, label_value, implicit_decl;
f2a02c3a 33 tree error_locus, limbo_value;
40754343
RS
34};
35
36/* Macros for access to language-specific slots in an identifier. */
db69cfcb 37/* Each of these slots contains a DECL node or null. */
40754343 38
db69cfcb
RS
39/* This represents the value which the identifier has in the
40 file-scope namespace. */
40754343
RS
41#define IDENTIFIER_GLOBAL_VALUE(NODE) \
42 (((struct lang_identifier *)(NODE))->global_value)
db69cfcb
RS
43/* This represents the value which the identifier has in the current
44 scope. */
40754343
RS
45#define IDENTIFIER_LOCAL_VALUE(NODE) \
46 (((struct lang_identifier *)(NODE))->local_value)
db69cfcb
RS
47/* This represents the value which the identifier has as a label in
48 the current label scope. */
40754343
RS
49#define IDENTIFIER_LABEL_VALUE(NODE) \
50 (((struct lang_identifier *)(NODE))->label_value)
db69cfcb
RS
51/* This records the extern decl of this identifier, if it has had one
52 at any point in this compilation. */
f2a02c3a
RS
53#define IDENTIFIER_LIMBO_VALUE(NODE) \
54 (((struct lang_identifier *)(NODE))->limbo_value)
db69cfcb
RS
55/* This records the implicit function decl of this identifier, if it
56 has had one at any point in this compilation. */
40754343
RS
57#define IDENTIFIER_IMPLICIT_DECL(NODE) \
58 (((struct lang_identifier *)(NODE))->implicit_decl)
db69cfcb
RS
59/* This is the last function in which we printed an "undefined variable"
60 message for this identifier. Value is a FUNCTION_DECL or null. */
40754343
RS
61#define IDENTIFIER_ERROR_LOCUS(NODE) \
62 (((struct lang_identifier *)(NODE))->error_locus)
63
64/* In identifiers, C uses the following fields in a special way:
65 TREE_PUBLIC to record that there was a previous local extern decl.
66 TREE_USED to record that such a decl was used.
67 TREE_ADDRESSABLE to record that the address of such a decl was used. */
68
69/* Nonzero means reject anything that ANSI standard C forbids. */
70extern int pedantic;
71
72/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
73#define C_TYPE_FIELDS_READONLY(type) TREE_LANG_FLAG_1 (type)
74
75/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */
76#define C_TYPE_FIELDS_VOLATILE(type) TREE_LANG_FLAG_2 (type)
77
78/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
79 nonzero if the definition of the type has already started. */
80#define C_TYPE_BEING_DEFINED(type) TYPE_LANG_FLAG_0 (type)
81
82/* In a RECORD_TYPE, a sorted array of the fields of the type. */
83struct lang_type
84{
85 int len;
86 tree elts[1];
87};
88
89/* Mark which labels are explicitly declared.
90 These may be shadowed, and may be referenced from nested functions. */
91#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
92
93/* Record whether a type or decl was written with nonconstant size.
94 Note that TYPE_SIZE may have simplified to a constant. */
95#define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type)
96#define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_0 (type)
97
98/* Record in each node resulting from a binary operator
99 what operator was specified for it. */
100#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
101
102#if 0 /* Not used. */
103/* Record whether a decl for a function or function pointer has
104 already been mentioned (in a warning) because it was called
105 but didn't have a prototype. */
106#define C_MISSING_PROTOTYPE_WARNED(decl) DECL_LANG_FLAG_2(decl)
107#endif
108
109/* Store a value in that field. */
110#define C_SET_EXP_ORIGINAL_CODE(exp, code) \
111 (TREE_COMPLEXITY (exp) = (int)(code))
112
113/* Record whether a typedef for type `int' was actually `signed int'. */
114#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
115
96735c06
RS
116/* Nonzero for a declaration of a built in function if there has been no
117 occasion that would declare the function in ordinary C.
118 Using the function draws a pedantic warning in this case. */
119#define C_DECL_ANTICIPATED(exp) DECL_LANG_FLAG_3 ((exp))
120
40754343
RS
121/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
122 TYPE_ARG_TYPES for functions with prototypes, but created for functions
123 without prototypes. */
124#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_NONCOPIED_PARTS (NODE)
4e28fa00
RS
125
126/* Nonzero if the type T promotes to itself.
127 ANSI C states explicitly the list of types that promote;
128 in particular, short promotes to int even if they have the same width. */
129#define C_PROMOTING_INTEGER_TYPE_P(t) \
130 (TREE_CODE ((t)) == INTEGER_TYPE \
131 && (TYPE_MAIN_VARIANT (t) == char_type_node \
132 || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
133 || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
134 || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
135 || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
42981920
RS
136
137/* In a VAR_DECL, means the variable is really an iterator. */
138#define ITERATOR_P(D) (DECL_LANG_FLAG_4(D))
139
140/* In a VAR_DECL for an iterator, means we are within
141 an explicit loop over that iterator. */
142#define ITERATOR_BOUND_P(NODE) ((NODE)->common.readonly_flag)
40754343 143\f
bfb73556
TW
144/* in c-lang.c and objc-act.c */
145extern tree lookup_interface PROTO((tree));
146extern tree is_class_name PROTO((tree));
147extern void maybe_objc_check_decl PROTO((tree));
148extern int maybe_objc_comptypes PROTO((tree, tree, int));
7c57c798 149extern tree maybe_building_objc_message_expr PROTO((void));
bfb73556
TW
150extern tree maybe_objc_method_name PROTO((tree));
151extern int recognize_objc_keyword PROTO((void));
152extern tree build_objc_string PROTO((int, char *));
7c57c798
RS
153\f
154/* in c-aux-info.c */
155extern void gen_aux_info_record PROTO((tree, int, int, int));
40754343 156
7c57c798 157/* in c-common.c */
01e9c1c9 158extern void declare_function_name PROTO((void));
2a4f6a61 159extern void decl_attributes PROTO((tree, tree, tree));
01e9c1c9
RK
160extern void init_function_format_info PROTO((void));
161extern void record_function_format PROTO((tree, tree, int, int, int));
162extern void check_function_format PROTO((tree, tree, tree));
40754343
RS
163/* Print an error message for invalid operands to arith operation CODE.
164 NOP_EXPR is used as a special case (see truthvalue_conversion). */
7c57c798
RS
165extern void binary_op_error PROTO((enum tree_code));
166extern void c_expand_expr_stmt PROTO((tree));
167/* Validate the expression after `case' and apply default promotions. */
168extern tree check_case_value PROTO((tree));
169/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
170extern tree combine_strings PROTO((tree));
171extern void constant_expression_warning PROTO((tree));
ed3eea74 172extern tree convert_and_check PROTO((tree, tree));
ed3eea74
RS
173extern void overflow_warning PROTO((tree));
174extern void unsigned_conversion_warning PROTO((tree, tree));
7c57c798 175/* Read the rest of the current #-directive line. */
cf1c49cb 176extern char *get_directive_line STDIO_PROTO((FILE *));
40754343
RS
177/* Subroutine of build_binary_op, used for comparison operations.
178 See if the operands have both been converted from subword integer types
179 and, if so, perhaps change them both back to their original type. */
7c57c798 180extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
0a929594
RK
181/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
182 or validate its data type for an `if' or `while' statement or ?..: exp. */
7c57c798
RS
183extern tree truthvalue_conversion PROTO((tree));
184extern tree type_for_mode PROTO((enum machine_mode, int));
185extern tree type_for_size PROTO((unsigned, int));
0a929594 186
7c57c798
RS
187/* in c-convert.c */
188extern tree convert PROTO((tree, tree));
40754343 189
7c57c798
RS
190/* in c-decl.c */
191/* Standard named or nameless data types of the C compiler. */
192extern tree char_array_type_node;
193extern tree char_type_node;
194extern tree const_ptr_type_node;
195extern tree const_string_type_node;
40754343 196extern tree default_function_type;
7c57c798
RS
197extern tree double_ftype_double;
198extern tree double_ftype_double_double;
199extern tree double_type_node;
200extern tree float_type_node;
201extern tree intDI_type_node;
202extern tree intHI_type_node;
203extern tree intQI_type_node;
204extern tree intSI_type_node;
205extern tree int_array_type_node;
206extern tree int_ftype_cptr_cptr_sizet;
207extern tree int_ftype_int;
208extern tree int_ftype_ptr_ptr_int;
209extern tree int_ftype_string_string;
210extern tree integer_type_node;
211extern tree long_double_type_node;
212extern tree long_ftype_long;
213extern tree long_integer_type_node;
214extern tree long_long_integer_type_node;
215extern tree long_long_unsigned_type_node;
216extern tree long_unsigned_type_node;
74428a8e
RS
217extern tree complex_integer_type_node;
218extern tree complex_float_type_node;
219extern tree complex_double_type_node;
220extern tree complex_long_double_type_node;
7c57c798
RS
221extern tree ptr_type_node;
222extern tree ptrdiff_type_node;
223extern tree short_integer_type_node;
224extern tree short_unsigned_type_node;
225extern tree signed_char_type_node;
226extern tree signed_wchar_type_node;
227extern tree string_ftype_ptr_ptr;
228extern tree string_type_node;
229extern tree unsigned_char_type_node;
230extern tree unsigned_intDI_type_node;
231extern tree unsigned_intHI_type_node;
232extern tree unsigned_intQI_type_node;
233extern tree unsigned_intSI_type_node;
234extern tree unsigned_type_node;
235extern tree unsigned_wchar_type_node;
236extern tree void_ftype_ptr_int_int;
237extern tree void_ftype_ptr_ptr_int;
238extern tree void_type_node;
239extern tree wchar_array_type_node;
240extern tree wchar_type_node;
19cad249
JM
241extern tree boolean_type_node;
242extern tree boolean_true_node;
243extern tree boolean_false_node;
7c57c798
RS
244
245extern tree build_enumerator PROTO((tree, tree));
246/* Declare a predefined function. Return the declaration. */
247extern tree builtin_function PROTO((char *, tree, enum built_in_function function_, char *));
248/* Add qualifiers to a type, in the fashion for C. */
249extern tree c_build_type_variant PROTO((tree, int, int));
250extern int c_decode_option PROTO((char *));
251extern void c_mark_varargs PROTO((void));
252extern tree check_identifier PROTO((tree, tree));
253extern void clear_parm_order PROTO((void));
254extern tree combine_parm_decls PROTO((tree, tree, int));
255extern int complete_array_type PROTO((tree, tree, int));
256extern void declare_parm_level PROTO((int));
257extern tree define_label PROTO((char *, int, tree));
258extern void delete_block PROTO((tree));
259extern void finish_decl PROTO((tree, tree, tree));
a0053f2b 260extern tree finish_enum PROTO((tree, tree, tree));
7c57c798 261extern void finish_function PROTO((int));
a0053f2b 262extern tree finish_struct PROTO((tree, tree, tree));
7c57c798
RS
263extern tree get_parm_info PROTO((int));
264extern tree getdecls PROTO((void));
265extern tree gettags PROTO((void));
266extern int global_bindings_p PROTO((void));
267extern tree grokfield PROTO((char *, int, tree, tree, tree));
268extern tree groktypename PROTO((tree));
269extern tree groktypename_in_parm_context PROTO((tree));
270extern tree implicitly_declare PROTO((tree));
271extern int in_parm_level_p PROTO((void));
272extern void init_decl_processing PROTO((void));
273extern void insert_block PROTO((tree));
274extern void keep_next_level PROTO((void));
275extern int kept_level_p PROTO((void));
276extern tree lookup_label PROTO((tree));
277extern tree lookup_name PROTO((tree));
0e53614d 278extern tree lookup_name_current_level PROTO((tree));
53dd9622 279extern tree lookup_name_current_level_global PROTO((tree));
7c57c798
RS
280extern tree maybe_build_cleanup PROTO((tree));
281extern void parmlist_tags_warning PROTO((void));
282extern void pending_xref_error PROTO((void));
283extern void pop_c_function_context PROTO((void));
284extern void pop_label_level PROTO((void));
285extern tree poplevel PROTO((int, int, int));
8dc0b9c6 286extern void print_lang_decl STDIO_PROTO((FILE *, tree,
8245685d 287 int));
cf1c49cb
RK
288extern void print_lang_identifier STDIO_PROTO((FILE *, tree,
289 int));
8dc0b9c6 290extern void print_lang_type STDIO_PROTO((FILE *, tree,
8245685d 291 int));
7c57c798
RS
292extern void push_c_function_context PROTO((void));
293extern void push_label_level PROTO((void));
294extern void push_parm_decl PROTO((tree));
295extern tree pushdecl PROTO((tree));
296extern tree pushdecl_top_level PROTO((tree));
297extern void pushlevel PROTO((int));
298extern void pushtag PROTO((tree, tree));
299extern void set_block PROTO((tree));
300extern tree shadow_label PROTO((tree));
301extern void shadow_record_fields PROTO((tree));
302extern void shadow_tag PROTO((tree));
303extern void shadow_tag_warned PROTO((tree, int));
304extern tree start_enum PROTO((tree));
78675f91 305extern int start_function PROTO((tree, tree, tree, int));
c15b1d45
RK
306extern tree start_decl PROTO((tree, tree, int,
307 tree, tree));
7c57c798
RS
308extern tree start_struct PROTO((enum tree_code, tree));
309extern void store_parm_decls PROTO((void));
310extern tree xref_tag PROTO((enum tree_code, tree));
311
312/* in c-typeck.c */
9c10d25f
RK
313extern tree require_complete_type PROTO((tree));
314extern void incomplete_type_error PROTO((tree, tree));
7c57c798
RS
315/* Given two integer or real types, return the type for their sum.
316 Given two compatible ANSI C types, returns the merged type. */
317extern tree common_type PROTO((tree, tree));
9c10d25f
RK
318extern int comptypes PROTO((tree, tree));
319extern int self_promoting_args_p PROTO((tree));
320extern tree c_sizeof PROTO((tree));
321extern tree c_sizeof_nowarn PROTO((tree));
322extern tree c_size_in_bytes PROTO((tree));
323extern tree c_alignof PROTO((tree));
324extern tree c_alignof_expr PROTO((tree));
7c57c798 325extern tree default_conversion PROTO((tree));
9c10d25f
RK
326extern tree build_component_ref PROTO((tree, tree));
327extern tree build_indirect_ref PROTO((tree, char *));
328extern tree build_array_ref PROTO((tree, tree));
329extern tree build_function_call PROTO((tree, tree));
330extern tree parser_build_binary_op PROTO((enum tree_code,
331 tree, tree));
332extern tree build_binary_op PROTO((enum tree_code,
333 tree, tree, int));
334extern tree build_unary_op PROTO((enum tree_code,
335 tree, int));
336extern int lvalue_p PROTO((tree));
337extern int lvalue_or_else PROTO((tree, char *));
338extern void readonly_warning PROTO((tree, char *));
339extern int mark_addressable PROTO((tree));
340extern tree build_conditional_expr PROTO((tree, tree, tree));
341extern tree build_compound_expr PROTO((tree));
342extern tree build_c_cast PROTO((tree, tree));
343extern tree build_modify_expr PROTO((tree, enum tree_code,
344 tree));
345extern tree initializer_constant_valid_p PROTO((tree, tree));
7c57c798 346extern void store_init_value PROTO((tree, tree));
9c10d25f
RK
347extern void error_init PROTO((char *, char *,
348 char *));
349extern void pedwarn_init PROTO((char *, char *,
350 char *));
3d06b100
RS
351extern void start_init PROTO((tree, tree, int));
352extern void finish_init PROTO((void));
353extern void really_start_incremental_init PROTO((tree));
354extern void push_init_level PROTO((int));
355extern tree pop_init_level PROTO((int));
356extern void set_init_index PROTO((tree, tree));
357extern void set_init_label PROTO((tree));
358extern void process_init_element PROTO((tree));
9c10d25f
RK
359extern void c_expand_asm_operands PROTO((tree, tree, tree, tree,
360 int, char *, int));
361extern void c_expand_return PROTO((tree));
362extern tree c_expand_start_case PROTO((tree));
40754343 363
42981920
RS
364/* in c-iterate.c */
365extern void iterator_expand PROTO((tree));
366extern void iterator_for_loop_start PROTO((tree));
367extern void iterator_for_loop_end PROTO((tree));
368extern void iterator_for_loop_record PROTO((tree));
369extern void push_iterator_stack PROTO((void));
370extern void pop_iterator_stack PROTO((void));
371
40754343
RS
372/* Set to 0 at beginning of a function definition, set to 1 if
373 a return statement that specifies a return value is seen. */
374
375extern int current_function_returns_value;
376
377/* Set to 0 at beginning of a function definition, set to 1 if
378 a return statement with no argument is seen. */
379
380extern int current_function_returns_null;
381
382/* Nonzero means `$' can be in an identifier. */
383
384extern int dollars_in_ident;
385
386/* Nonzero means allow type mismatches in conditional expressions;
387 just make their values `void'. */
388
389extern int flag_cond_mismatch;
390
391/* Nonzero means don't recognize the keyword `asm'. */
392
393extern int flag_no_asm;
394
395/* Nonzero means ignore `#ident' directives. */
396
397extern int flag_no_ident;
398
399/* Nonzero means warn about implicit declarations. */
400
401extern int warn_implicit;
402
403/* Nonzero means give string constants the type `const char *'
404 to get extra warnings from them. These warnings will be too numerous
405 to be useful, except in thoroughly ANSIfied programs. */
406
407extern int warn_write_strings;
408
409/* Nonzero means warn about sizeof (function) or addition/subtraction
410 of function pointers. */
411
412extern int warn_pointer_arith;
413
414/* Nonzero means warn for all old-style non-prototype function decls. */
415
416extern int warn_strict_prototypes;
417
418/* Nonzero means warn about multiple (redundant) decls for the same single
419 variable or function. */
420
421extern int warn_redundant_decls;
422
423/* Nonzero means warn about extern declarations of objects not at
424 file-scope level and about *all* declarations of functions (whether
425 extern or static) not at file-scope level. Note that we exclude
426 implicit function declarations. To get warnings about those, use
427 -Wimplicit. */
428
429extern int warn_nested_externs;
430
431/* Nonzero means warn about pointer casts that can drop a type qualifier
432 from the pointer target type. */
433
434extern int warn_cast_qual;
435
95572adf
RK
436/* Nonzero means warn when casting a function call to a type that does
437 not match the return type (e.g. (float)sqrt() or (anything*)malloc()
438 when there is no previous declaration of sqrt or malloc. */
439
440extern int warn_bad_function_cast;
441
40754343
RS
442/* Warn about traditional constructs whose meanings changed in ANSI C. */
443
444extern int warn_traditional;
445
446/* Warn about *printf or *scanf format/argument anomalies. */
447
448extern int warn_format;
449
450/* Warn about a subscript that has type char. */
451
452extern int warn_char_subscripts;
453
454/* Warn if a type conversion is done that might have confusing results. */
455
456extern int warn_conversion;
457
458/* Nonzero means do some things the same way PCC does. */
459
460extern int flag_traditional;
461
b3fe11b8
RS
462/* Nonzero means to allow single precision math even if we're generally
463 being traditional. */
464extern int flag_allow_single_precision;
465
40754343
RS
466/* Nonzero means warn about suggesting putting in ()'s. */
467
468extern int warn_parentheses;
469
83091176
RS
470/* Warn if initializer is not completely bracketed. */
471
472extern int warn_missing_braces;
473
40754343
RS
474/* Nonzero means this is a function to call to perform comptypes
475 on two record types. */
476
477extern int (*comptypes_record_hook) ();
478
479/* Nonzero means we are reading code that came from a system header file. */
480
481extern int system_header_p;
7c57c798 482
bfb73556
TW
483/* Nonzero enables objc features. */
484
485extern int doing_objc_thang;
486
7c57c798 487#endif /* not _C_TREE_H */
This page took 0.239974 seconds and 5 git commands to generate.