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