c-tree.h revision 90083
1169695Skan/* Definitions for C parsing and type checking.
2169695Skan   Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3169695Skan   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4169695Skan
5169695SkanThis file is part of GCC.
6169695Skan
7169695SkanGCC is free software; you can redistribute it and/or modify it under
8169695Skanthe terms of the GNU General Public License as published by the Free
9169695SkanSoftware Foundation; either version 2, or (at your option) any later
10169695Skanversion.
11169695Skan
12169695SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13169695SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or
14169695SkanFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15169695Skanfor more details.
16169695Skan
17169695SkanYou should have received a copy of the GNU General Public License
18169695Skanalong with GCC; see the file COPYING.  If not, write to the Free
19169695SkanSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
20169695Skan02111-1307, USA.  */
21169695Skan
22169695Skan/* $FreeBSD: head/contrib/gcc/c-tree.h 90083 2002-02-01 18:54:38Z obrien $ */
23169695Skan
24169695Skan#ifndef GCC_C_TREE_H
25169695Skan#define GCC_C_TREE_H
26169695Skan
27169695Skan#include "c-common.h"
28169695Skan
29169695Skan/* Language-dependent contents of an identifier.  */
30169695Skan
31169695Skan/* The limbo_value is used for block level extern declarations, which need
32169695Skan   to be type checked against subsequent extern declarations.  They can't
33169695Skan   be referenced after they fall out of scope, so they can't be global.
34169695Skan
35169695Skan   The rid_code field is used for keywords.  It is in all
36169695Skan   lang_identifier nodes, because some keywords are only special in a
37169695Skan   particular context.  */
38169695Skan
39169695Skanstruct lang_identifier
40169695Skan{
41169695Skan  struct c_common_identifier ignore;
42169695Skan  tree global_value, local_value, label_value, implicit_decl;
43169695Skan  tree error_locus, limbo_value;
44169695Skan};
45169695Skan
46169695Skan/* Language-specific declaration information.  */
47169695Skan
48169695Skanstruct lang_decl
49169695Skan{
50169695Skan  struct c_lang_decl base;
51169695Skan  /* The return types and parameter types may have variable size.
52169695Skan     This is a list of any SAVE_EXPRs that need to be evaluated to
53169695Skan     compute those sizes.  */
54169695Skan  tree pending_sizes;
55169695Skan};
56169695Skan
57169695Skan/* Macros for access to language-specific slots in an identifier.  */
58169695Skan/* Each of these slots contains a DECL node or null.  */
59169695Skan
60169695Skan/* This represents the value which the identifier has in the
61169695Skan   file-scope namespace.  */
62169695Skan#define IDENTIFIER_GLOBAL_VALUE(NODE)	\
63169695Skan  (((struct lang_identifier *) (NODE))->global_value)
64169695Skan/* This represents the value which the identifier has in the current
65169695Skan   scope.  */
66169695Skan#define IDENTIFIER_LOCAL_VALUE(NODE)	\
67169695Skan  (((struct lang_identifier *) (NODE))->local_value)
68169695Skan/* This represents the value which the identifier has as a label in
69169695Skan   the current label scope.  */
70169695Skan#define IDENTIFIER_LABEL_VALUE(NODE)	\
71169695Skan  (((struct lang_identifier *) (NODE))->label_value)
72169695Skan/* This records the extern decl of this identifier, if it has had one
73169695Skan   at any point in this compilation.  */
74169695Skan#define IDENTIFIER_LIMBO_VALUE(NODE)	\
75169695Skan  (((struct lang_identifier *) (NODE))->limbo_value)
76169695Skan/* This records the implicit function decl of this identifier, if it
77169695Skan   has had one at any point in this compilation.  */
78169695Skan#define IDENTIFIER_IMPLICIT_DECL(NODE)	\
79169695Skan  (((struct lang_identifier *) (NODE))->implicit_decl)
80169695Skan/* This is the last function in which we printed an "undefined variable"
81169695Skan   message for this identifier.  Value is a FUNCTION_DECL or null.  */
82169695Skan#define IDENTIFIER_ERROR_LOCUS(NODE)	\
83169695Skan  (((struct lang_identifier *) (NODE))->error_locus)
84169695Skan
85169695Skan/* In identifiers, C uses the following fields in a special way:
86169695Skan   TREE_PUBLIC        to record that there was a previous local extern decl.
87169695Skan   TREE_USED          to record that such a decl was used.
88169695Skan   TREE_ADDRESSABLE   to record that the address of such a decl was used.  */
89169695Skan
90169695Skan/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
91169695Skan#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
92169695Skan
93169695Skan/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile.  */
94169695Skan#define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE)
95169695Skan
96169695Skan/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
97169695Skan   nonzero if the definition of the type has already started.  */
98169695Skan#define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
99169695Skan
100169695Skan/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
101169695Skan   keyword.  C_RID_CODE (node) is then the RID_* value of the keyword,
102169695Skan   and C_RID_YYCODE is the token number wanted by Yacc.  */
103169695Skan#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
104169695Skan
105169695Skan/* This function was declared inline.  This flag controls the linkage
106169695Skan   semantics of 'inline'; whether or not the function is inlined is
107169695Skan   controlled by DECL_INLINE.  */
108169695Skan#define DECL_DECLARED_INLINE_P(NODE) \
109169695Skan  (DECL_LANG_SPECIFIC (NODE)->base.declared_inline)
110169695Skan
111169695Skan/* In a RECORD_TYPE, a sorted array of the fields of the type.  */
112169695Skanstruct lang_type
113169695Skan{
114169695Skan  int len;
115169695Skan  tree elts[1];
116169695Skan};
117169695Skan
118169695Skan/* Record whether a type or decl was written with nonconstant size.
119169695Skan   Note that TYPE_SIZE may have simplified to a constant.  */
120169695Skan#define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
121169695Skan#define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
122169695Skan
123169695Skan#if 0 /* Not used.  */
124169695Skan/* Record whether a decl for a function or function pointer has
125169695Skan   already been mentioned (in a warning) because it was called
126169695Skan   but didn't have a prototype.  */
127169695Skan#define C_MISSING_PROTOTYPE_WARNED(DECL) DECL_LANG_FLAG_2 (DECL)
128169695Skan#endif
129169695Skan
130169695Skan/* Store a value in that field.  */
131169695Skan#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
132169695Skan  (TREE_COMPLEXITY (EXP) = (int) (CODE))
133169695Skan
134169695Skan/* Record whether a typedef for type `int' was actually `signed int'.  */
135169695Skan#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
136169695Skan
137169695Skan/* Nonzero for a declaration of a built in function if there has been no
138169695Skan   occasion that would declare the function in ordinary C.
139169695Skan   Using the function draws a pedantic warning in this case.  */
140169695Skan#define C_DECL_ANTICIPATED(EXP) DECL_LANG_FLAG_3 (EXP)
141169695Skan
142169695Skan/* For FUNCTION_TYPE, a hidden list of types of arguments.  The same as
143169695Skan   TYPE_ARG_TYPES for functions with prototypes, but created for functions
144169695Skan   without prototypes.  */
145169695Skan#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE)
146169695Skan
147169695Skan
148169695Skan/* in c-lang.c and objc-act.c */
149169695Skanextern tree lookup_interface			PARAMS ((tree));
150169695Skanextern tree is_class_name			PARAMS ((tree));
151169695Skanextern void maybe_objc_check_decl		PARAMS ((tree));
152169695Skanextern void finish_file				PARAMS ((void));
153169695Skanextern int maybe_objc_comptypes                 PARAMS ((tree, tree, int));
154169695Skanextern tree maybe_building_objc_message_expr    PARAMS ((void));
155169695Skanextern int recognize_objc_keyword		PARAMS ((void));
156169695Skanextern tree lookup_objc_ivar			PARAMS ((tree));
157169695Skan
158169695Skan
159169695Skan/* in c-parse.in */
160169695Skanextern void c_parse_init			PARAMS ((void));
161169695Skanextern void c_set_yydebug			PARAMS ((int));
162169695Skanextern int yyparse_1				PARAMS ((void));
163169695Skan
164169695Skan/* in c-aux-info.c */
165169695Skanextern void gen_aux_info_record                 PARAMS ((tree, int, int, int));
166169695Skan
167169695Skan/* in c-decl.c */
168169695Skanextern void c_init_decl_processing		PARAMS ((void));
169169695Skanextern void c_print_identifier			PARAMS ((FILE *, tree, int));
170169695Skanextern tree build_array_declarator              PARAMS ((tree, tree, int, int));
171169695Skanextern tree build_enumerator                    PARAMS ((tree, tree));
172169695Skanextern int  c_decode_option                     PARAMS ((int, char **));
173169695Skanextern void c_mark_varargs                      PARAMS ((void));
174169695Skanextern void check_for_loop_decls                PARAMS ((void));
175169695Skanextern void clear_parm_order                    PARAMS ((void));
176169695Skanextern int  complete_array_type                 PARAMS ((tree, tree, int));
177169695Skanextern void declare_parm_level                  PARAMS ((int));
178169695Skanextern tree define_label                        PARAMS ((const char *, int,
179169695Skan							 tree));
180169695Skanextern void finish_decl                         PARAMS ((tree, tree, tree));
181169695Skanextern tree finish_enum                         PARAMS ((tree, tree, tree));
182169695Skanextern void finish_function                     PARAMS ((int));
183169695Skanextern tree finish_struct                       PARAMS ((tree, tree, tree));
184169695Skanextern tree get_parm_info                       PARAMS ((int));
185169695Skanextern tree grokfield                           PARAMS ((const char *, int, tree, tree, tree));
186169695Skanextern tree groktypename                        PARAMS ((tree));
187169695Skanextern tree groktypename_in_parm_context        PARAMS ((tree));
188169695Skanextern tree implicitly_declare                  PARAMS ((tree));
189169695Skanextern void implicit_decl_warning               PARAMS ((tree));
190169695Skanextern int  in_parm_level_p                     PARAMS ((void));
191169695Skanextern void keep_next_level                     PARAMS ((void));
192169695Skanextern int  kept_level_p                        PARAMS ((void));
193169695Skanextern tree lookup_name                         PARAMS ((tree));
194169695Skanextern tree lookup_name_current_level		PARAMS ((tree));
195169695Skanextern void parmlist_tags_warning               PARAMS ((void));
196169695Skanextern void pending_xref_error                  PARAMS ((void));
197169695Skanextern void mark_c_function_context             PARAMS ((struct function *));
198169695Skanextern void push_c_function_context             PARAMS ((struct function *));
199169695Skanextern void pop_c_function_context              PARAMS ((struct function *));
200169695Skanextern void pop_label_level                     PARAMS ((void));
201169695Skanextern void push_label_level                    PARAMS ((void));
202169695Skanextern void push_parm_decl                      PARAMS ((tree));
203169695Skanextern tree pushdecl_top_level                  PARAMS ((tree));
204169695Skanextern void pushtag                             PARAMS ((tree, tree));
205169695Skanextern tree set_array_declarator_type           PARAMS ((tree, tree, int));
206169695Skanextern tree shadow_label                        PARAMS ((tree));
207169695Skanextern void shadow_tag                          PARAMS ((tree));
208169695Skanextern void shadow_tag_warned                   PARAMS ((tree, int));
209169695Skanextern tree start_enum                          PARAMS ((tree));
210169695Skanextern int  start_function                      PARAMS ((tree, tree, tree));
211169695Skanextern tree start_decl                          PARAMS ((tree, tree, int,
212169695Skan							 tree));
213169695Skanextern tree start_struct                        PARAMS ((enum tree_code, tree));
214169695Skanextern void store_parm_decls                    PARAMS ((void));
215169695Skanextern tree xref_tag                            PARAMS ((enum tree_code, tree));
216169695Skanextern tree c_begin_compound_stmt               PARAMS ((void));
217169695Skanextern void c_expand_deferred_function          PARAMS ((tree));
218169695Skanextern void c_expand_decl_stmt                  PARAMS ((tree));
219169695Skan
220169695Skan
221169695Skan/* in c-objc-common.c */
222169695Skanextern int c_disregard_inline_limits		PARAMS ((tree));
223169695Skanextern int c_cannot_inline_tree_fn		PARAMS ((tree *));
224169695Skanextern const char *c_objc_common_init		PARAMS ((const char *));
225169695Skanextern int c_missing_noreturn_ok_p		PARAMS ((tree));
226169695Skanextern void c_objc_common_finish_file		PARAMS ((void));
227169695Skanextern int defer_fn				PARAMS ((tree));
228169695Skan
229169695Skan#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P)		  \
230169695Skan  c_build_qualified_type ((TYPE),				  \
231169695Skan			  ((CONST_P) ? TYPE_QUAL_CONST : 0) |	  \
232169695Skan			  ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
233169695Skan
234169695Skan/* in c-typeck.c */
235169695Skanextern tree require_complete_type		PARAMS ((tree));
236169695Skanextern int comptypes				PARAMS ((tree, tree));
237169695Skanextern tree c_sizeof_nowarn			PARAMS ((tree));
238169695Skanextern tree c_size_in_bytes                     PARAMS ((tree));
239169695Skanextern tree build_component_ref                 PARAMS ((tree, tree));
240169695Skanextern tree build_indirect_ref                  PARAMS ((tree, const char *));
241169695Skanextern tree build_array_ref                     PARAMS ((tree, tree));
242169695Skanextern tree build_external_ref			PARAMS ((tree, int));
243169695Skanextern tree parser_build_binary_op              PARAMS ((enum tree_code,
244169695Skan							 tree, tree));
245169695Skanextern void readonly_warning			PARAMS ((tree, const char *));
246169695Skanextern tree build_conditional_expr              PARAMS ((tree, tree, tree));
247169695Skanextern tree build_compound_expr                 PARAMS ((tree));
248169695Skanextern tree c_cast_expr				PARAMS ((tree, tree));
249169695Skanextern tree build_c_cast	                PARAMS ((tree, tree));
250169695Skanextern tree build_modify_expr                   PARAMS ((tree, enum tree_code,
251169695Skan							 tree));
252169695Skanextern void store_init_value                    PARAMS ((tree, tree));
253169695Skanextern void error_init				PARAMS ((const char *));
254169695Skanextern void pedwarn_init			PARAMS ((const char *));
255169695Skanextern void start_init				PARAMS ((tree, tree, int));
256169695Skanextern void finish_init				PARAMS ((void));
257169695Skanextern void really_start_incremental_init	PARAMS ((tree));
258169695Skanextern void push_init_level			PARAMS ((int));
259169695Skanextern tree pop_init_level			PARAMS ((int));
260169695Skanextern void set_init_index			PARAMS ((tree, tree));
261169695Skanextern void set_init_label			PARAMS ((tree));
262169695Skanextern void process_init_element		PARAMS ((tree));
263169695Skanextern tree build_compound_literal		PARAMS ((tree, tree));
264169695Skanextern void pedwarn_c99				PARAMS ((const char *, ...))
265169695Skan							ATTRIBUTE_PRINTF_1;
266169695Skanextern tree c_start_case                        PARAMS ((tree));
267169695Skanextern void c_finish_case                       PARAMS ((void));
268169695Skanextern tree simple_asm_stmt			PARAMS ((tree));
269169695Skanextern tree build_asm_stmt			PARAMS ((tree, tree, tree,
270169695Skan							 tree, tree));
271169695Skan
272169695Skan/* Set to 0 at beginning of a function definition, set to 1 if
273169695Skan   a return statement that specifies a return value is seen.  */
274169695Skan
275169695Skanextern int current_function_returns_value;
276169695Skan
277169695Skan/* Set to 0 at beginning of a function definition, set to 1 if
278169695Skan   a return statement with no argument is seen.  */
279169695Skan
280169695Skanextern int current_function_returns_null;
281169695Skan
282169695Skan/* Nonzero means the expression being parsed will never be evaluated.
283169695Skan   This is a count, since unevaluated expressions can nest.  */
284169695Skan
285169695Skanextern int skip_evaluation;
286169695Skan
287169695Skan/* Nonzero means `$' can be in an identifier.  */
288169695Skan
289169695Skanextern int dollars_in_ident;
290169695Skan
291169695Skan/* Nonzero means allow type mismatches in conditional expressions;
292169695Skan   just make their values `void'.  */
293169695Skan
294169695Skanextern int flag_cond_mismatch;
295169695Skan
296169695Skan/* Nonzero means don't recognize the keyword `asm'.  */
297169695Skan
298169695Skanextern int flag_no_asm;
299169695Skan
300169695Skan/* Nonzero means warn about implicit declarations.  */
301169695Skan
302169695Skanextern int warn_implicit;
303169695Skan
304169695Skan/* Nonzero means warn for all old-style non-prototype function decls.  */
305169695Skan
306169695Skanextern int warn_strict_prototypes;
307169695Skan
308169695Skan/* Nonzero means warn about multiple (redundant) decls for the same single
309169695Skan   variable or function.  */
310169695Skan
311169695Skanextern int warn_redundant_decls;
312169695Skan
313169695Skan/* Nonzero means warn about extern declarations of objects not at
314169695Skan   file-scope level and about *all* declarations of functions (whether
315169695Skan   extern or static) not at file-scope level.  Note that we exclude
316169695Skan   implicit function declarations.  To get warnings about those, use
317169695Skan   -Wimplicit.  */
318169695Skan
319169695Skanextern int warn_nested_externs;
320169695Skan
321169695Skan/* Nonzero means warn about pointer casts that can drop a type qualifier
322169695Skan   from the pointer target type.  */
323169695Skan
324169695Skanextern int warn_cast_qual;
325169695Skan
326169695Skan/* Nonzero means warn when casting a function call to a type that does
327169695Skan   not match the return type (e.g. (float)sqrt() or (anything*)malloc()
328169695Skan   when there is no previous declaration of sqrt or malloc.  */
329169695Skan
330169695Skanextern int warn_bad_function_cast;
331169695Skan
332169695Skan/* Warn about traditional constructs whose meanings changed in ANSI C.  */
333169695Skan
334169695Skanextern int warn_traditional;
335169695Skan
336169695Skan/* Warn about a subscript that has type char.  */
337169695Skan
338169695Skanextern int warn_char_subscripts;
339169695Skan
340169695Skan/* Warn if main is suspicious.  */
341169695Skan
342169695Skanextern int warn_main;
343169695Skan
344169695Skan/* Nonzero means to allow single precision math even if we're generally
345169695Skan   being traditional.  */
346169695Skanextern int flag_allow_single_precision;
347169695Skan
348169695Skan/* Warn if initializer is not completely bracketed.  */
349169695Skan
350169695Skanextern int warn_missing_braces;
351169695Skan
352169695Skan/* Warn about comparison of signed and unsigned values.  */
353169695Skan
354169695Skanextern int warn_sign_compare;
355169695Skan
356169695Skan/* Warn about testing equality of floating point numbers.  */
357169695Skan
358169695Skanextern int warn_float_equal;
359169695Skan
360169695Skan/* Warn about multicharacter constants.  */
361169695Skan
362169695Skanextern int warn_multichar;
363169695Skan
364169695Skan/* Nonzero means we are reading code that came from a system header file.  */
365169695Skan
366169695Skanextern int system_header_p;
367169695Skan
368169695Skan/* Warn about implicit declarations.  1 = warning, 2 = error.  */
369169695Skanextern int mesg_implicit_function_declaration;
370169695Skan
371169695Skan/* In c-decl.c */
372169695Skanextern void finish_incomplete_decl PARAMS ((tree));
373169695Skan
374169695Skanextern tree static_ctors;
375169695Skanextern tree static_dtors;
376169695Skan
377169695Skan#endif /* ! GCC_C_TREE_H */
378169695Skan