c-tree.h revision 90083
1191783Srmacklem/* Definitions for C parsing and type checking.
2191783Srmacklem   Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3191783Srmacklem   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4191783Srmacklem
5191783SrmacklemThis file is part of GCC.
6191783Srmacklem
7191783SrmacklemGCC is free software; you can redistribute it and/or modify it under
8191783Srmacklemthe terms of the GNU General Public License as published by the Free
9191783SrmacklemSoftware Foundation; either version 2, or (at your option) any later
10191783Srmacklemversion.
11191783Srmacklem
12191783SrmacklemGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13191783SrmacklemWARRANTY; without even the implied warranty of MERCHANTABILITY or
14191783SrmacklemFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15191783Srmacklemfor more details.
16191783Srmacklem
17191783SrmacklemYou should have received a copy of the GNU General Public License
18191783Srmacklemalong with GCC; see the file COPYING.  If not, write to the Free
19191783SrmacklemSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA
20191783Srmacklem02111-1307, USA.  */
21191783Srmacklem
22191783Srmacklem/* $FreeBSD: head/contrib/gcc/c-tree.h 90083 2002-02-01 18:54:38Z obrien $ */
23191783Srmacklem
24191783Srmacklem#ifndef GCC_C_TREE_H
25191783Srmacklem#define GCC_C_TREE_H
26191783Srmacklem
27191783Srmacklem#include "c-common.h"
28191783Srmacklem
29191783Srmacklem/* Language-dependent contents of an identifier.  */
30191783Srmacklem
31191783Srmacklem/* The limbo_value is used for block level extern declarations, which need
32191783Srmacklem   to be type checked against subsequent extern declarations.  They can't
33191783Srmacklem   be referenced after they fall out of scope, so they can't be global.
34191783Srmacklem
35191783Srmacklem   The rid_code field is used for keywords.  It is in all
36191783Srmacklem   lang_identifier nodes, because some keywords are only special in a
37191783Srmacklem   particular context.  */
38191783Srmacklem
39191783Srmacklemstruct lang_identifier
40191783Srmacklem{
41191783Srmacklem  struct c_common_identifier ignore;
42191783Srmacklem  tree global_value, local_value, label_value, implicit_decl;
43191783Srmacklem  tree error_locus, limbo_value;
44191783Srmacklem};
45192503Srmacklem
46192503Srmacklem/* Language-specific declaration information.  */
47191783Srmacklem
48191783Srmacklemstruct lang_decl
49191783Srmacklem{
50191783Srmacklem  struct c_lang_decl base;
51191783Srmacklem  /* The return types and parameter types may have variable size.
52191783Srmacklem     This is a list of any SAVE_EXPRs that need to be evaluated to
53191783Srmacklem     compute those sizes.  */
54191783Srmacklem  tree pending_sizes;
55191783Srmacklem};
56191783Srmacklem
57191783Srmacklem/* Macros for access to language-specific slots in an identifier.  */
58191783Srmacklem/* Each of these slots contains a DECL node or null.  */
59191783Srmacklem
60191783Srmacklem/* This represents the value which the identifier has in the
61192503Srmacklem   file-scope namespace.  */
62191783Srmacklem#define IDENTIFIER_GLOBAL_VALUE(NODE)	\
63192255Srmacklem  (((struct lang_identifier *) (NODE))->global_value)
64192255Srmacklem/* This represents the value which the identifier has in the current
65191783Srmacklem   scope.  */
66191783Srmacklem#define IDENTIFIER_LOCAL_VALUE(NODE)	\
67191783Srmacklem  (((struct lang_identifier *) (NODE))->local_value)
68191783Srmacklem/* This represents the value which the identifier has as a label in
69191783Srmacklem   the current label scope.  */
70192255Srmacklem#define IDENTIFIER_LABEL_VALUE(NODE)	\
71192255Srmacklem  (((struct lang_identifier *) (NODE))->label_value)
72191783Srmacklem/* This records the extern decl of this identifier, if it has had one
73192255Srmacklem   at any point in this compilation.  */
74192255Srmacklem#define IDENTIFIER_LIMBO_VALUE(NODE)	\
75192255Srmacklem  (((struct lang_identifier *) (NODE))->limbo_value)
76192255Srmacklem/* This records the implicit function decl of this identifier, if it
77192255Srmacklem   has had one at any point in this compilation.  */
78192255Srmacklem#define IDENTIFIER_IMPLICIT_DECL(NODE)	\
79192255Srmacklem  (((struct lang_identifier *) (NODE))->implicit_decl)
80192255Srmacklem/* This is the last function in which we printed an "undefined variable"
81192255Srmacklem   message for this identifier.  Value is a FUNCTION_DECL or null.  */
82192255Srmacklem#define IDENTIFIER_ERROR_LOCUS(NODE)	\
83191783Srmacklem  (((struct lang_identifier *) (NODE))->error_locus)
84191783Srmacklem
85191783Srmacklem/* In identifiers, C uses the following fields in a special way:
86191783Srmacklem   TREE_PUBLIC        to record that there was a previous local extern decl.
87191783Srmacklem   TREE_USED          to record that such a decl was used.
88191783Srmacklem   TREE_ADDRESSABLE   to record that the address of such a decl was used.  */
89191783Srmacklem
90191783Srmacklem/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
91191783Srmacklem#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
92191783Srmacklem
93191783Srmacklem/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile.  */
94191783Srmacklem#define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE)
95191783Srmacklem
96191783Srmacklem/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
97191783Srmacklem   nonzero if the definition of the type has already started.  */
98191783Srmacklem#define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
99191783Srmacklem
100191783Srmacklem/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
101191783Srmacklem   keyword.  C_RID_CODE (node) is then the RID_* value of the keyword,
102191783Srmacklem   and C_RID_YYCODE is the token number wanted by Yacc.  */
103191783Srmacklem#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
104191783Srmacklem
105191783Srmacklem/* This function was declared inline.  This flag controls the linkage
106191783Srmacklem   semantics of 'inline'; whether or not the function is inlined is
107191783Srmacklem   controlled by DECL_INLINE.  */
108191783Srmacklem#define DECL_DECLARED_INLINE_P(NODE) \
109191783Srmacklem  (DECL_LANG_SPECIFIC (NODE)->base.declared_inline)
110191783Srmacklem
111191783Srmacklem/* In a RECORD_TYPE, a sorted array of the fields of the type.  */
112191783Srmacklemstruct lang_type
113191783Srmacklem{
114191783Srmacklem  int len;
115191783Srmacklem  tree elts[1];
116191783Srmacklem};
117191783Srmacklem
118191783Srmacklem/* Record whether a type or decl was written with nonconstant size.
119191783Srmacklem   Note that TYPE_SIZE may have simplified to a constant.  */
120191783Srmacklem#define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
121191783Srmacklem#define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
122191783Srmacklem
123191783Srmacklem#if 0 /* Not used.  */
124191783Srmacklem/* Record whether a decl for a function or function pointer has
125191783Srmacklem   already been mentioned (in a warning) because it was called
126191783Srmacklem   but didn't have a prototype.  */
127191783Srmacklem#define C_MISSING_PROTOTYPE_WARNED(DECL) DECL_LANG_FLAG_2 (DECL)
128191783Srmacklem#endif
129191783Srmacklem
130191783Srmacklem/* Store a value in that field.  */
131191783Srmacklem#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
132191783Srmacklem  (TREE_COMPLEXITY (EXP) = (int) (CODE))
133191783Srmacklem
134200999Srmacklem/* Record whether a typedef for type `int' was actually `signed int'.  */
135200999Srmacklem#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
136200999Srmacklem
137191783Srmacklem/* Nonzero for a declaration of a built in function if there has been no
138191783Srmacklem   occasion that would declare the function in ordinary C.
139191783Srmacklem   Using the function draws a pedantic warning in this case.  */
140191783Srmacklem#define C_DECL_ANTICIPATED(EXP) DECL_LANG_FLAG_3 (EXP)
141191783Srmacklem
142200999Srmacklem/* For FUNCTION_TYPE, a hidden list of types of arguments.  The same as
143200999Srmacklem   TYPE_ARG_TYPES for functions with prototypes, but created for functions
144200999Srmacklem   without prototypes.  */
145191783Srmacklem#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE)
146191783Srmacklem
147191783Srmacklem
148191783Srmacklem/* in c-lang.c and objc-act.c */
149191783Srmacklemextern tree lookup_interface			PARAMS ((tree));
150191783Srmacklemextern tree is_class_name			PARAMS ((tree));
151191783Srmacklemextern void maybe_objc_check_decl		PARAMS ((tree));
152191783Srmacklemextern void finish_file				PARAMS ((void));
153191783Srmacklemextern int maybe_objc_comptypes                 PARAMS ((tree, tree, int));
154191783Srmacklemextern tree maybe_building_objc_message_expr    PARAMS ((void));
155191783Srmacklemextern int recognize_objc_keyword		PARAMS ((void));
156191783Srmacklemextern tree lookup_objc_ivar			PARAMS ((tree));
157200999Srmacklem
158191783Srmacklem
159191783Srmacklem/* in c-parse.in */
160191783Srmacklemextern void c_parse_init			PARAMS ((void));
161191783Srmacklemextern void c_set_yydebug			PARAMS ((int));
162191783Srmacklemextern int yyparse_1				PARAMS ((void));
163191783Srmacklem
164191783Srmacklem/* in c-aux-info.c */
165191783Srmacklemextern void gen_aux_info_record                 PARAMS ((tree, int, int, int));
166191783Srmacklem
167191783Srmacklem/* in c-decl.c */
168191783Srmacklemextern void c_init_decl_processing		PARAMS ((void));
169191783Srmacklemextern void c_print_identifier			PARAMS ((FILE *, tree, int));
170191783Srmacklemextern tree build_array_declarator              PARAMS ((tree, tree, int, int));
171191783Srmacklemextern tree build_enumerator                    PARAMS ((tree, tree));
172191783Srmacklemextern int  c_decode_option                     PARAMS ((int, char **));
173191783Srmacklemextern void c_mark_varargs                      PARAMS ((void));
174191783Srmacklemextern void check_for_loop_decls                PARAMS ((void));
175191783Srmacklemextern void clear_parm_order                    PARAMS ((void));
176191783Srmacklemextern int  complete_array_type                 PARAMS ((tree, tree, int));
177191783Srmacklemextern void declare_parm_level                  PARAMS ((int));
178191783Srmacklemextern tree define_label                        PARAMS ((const char *, int,
179191783Srmacklem							 tree));
180191783Srmacklemextern void finish_decl                         PARAMS ((tree, tree, tree));
181200999Srmacklemextern tree finish_enum                         PARAMS ((tree, tree, tree));
182200999Srmacklemextern void finish_function                     PARAMS ((int));
183200999Srmacklemextern tree finish_struct                       PARAMS ((tree, tree, tree));
184200999Srmacklemextern tree get_parm_info                       PARAMS ((int));
185200999Srmacklemextern tree grokfield                           PARAMS ((const char *, int, tree, tree, tree));
186200999Srmacklemextern tree groktypename                        PARAMS ((tree));
187200999Srmacklemextern tree groktypename_in_parm_context        PARAMS ((tree));
188200999Srmacklemextern tree implicitly_declare                  PARAMS ((tree));
189200999Srmacklemextern void implicit_decl_warning               PARAMS ((tree));
190200999Srmacklemextern int  in_parm_level_p                     PARAMS ((void));
191200999Srmacklemextern void keep_next_level                     PARAMS ((void));
192200999Srmacklemextern int  kept_level_p                        PARAMS ((void));
193200999Srmacklemextern tree lookup_name                         PARAMS ((tree));
194200999Srmacklemextern tree lookup_name_current_level		PARAMS ((tree));
195200999Srmacklemextern void parmlist_tags_warning               PARAMS ((void));
196200999Srmacklemextern void pending_xref_error                  PARAMS ((void));
197200999Srmacklemextern void mark_c_function_context             PARAMS ((struct function *));
198191783Srmacklemextern void push_c_function_context             PARAMS ((struct function *));
199191783Srmacklemextern void pop_c_function_context              PARAMS ((struct function *));
200191783Srmacklemextern void pop_label_level                     PARAMS ((void));
201191783Srmacklemextern void push_label_level                    PARAMS ((void));
202191783Srmacklemextern void push_parm_decl                      PARAMS ((tree));
203191783Srmacklemextern tree pushdecl_top_level                  PARAMS ((tree));
204191783Srmacklemextern void pushtag                             PARAMS ((tree, tree));
205191783Srmacklemextern tree set_array_declarator_type           PARAMS ((tree, tree, int));
206191783Srmacklemextern tree shadow_label                        PARAMS ((tree));
207191783Srmacklemextern void shadow_tag                          PARAMS ((tree));
208191783Srmacklemextern void shadow_tag_warned                   PARAMS ((tree, int));
209191783Srmacklemextern tree start_enum                          PARAMS ((tree));
210191783Srmacklemextern int  start_function                      PARAMS ((tree, tree, tree));
211191783Srmacklemextern tree start_decl                          PARAMS ((tree, tree, int,
212191783Srmacklem							 tree));
213191783Srmacklemextern tree start_struct                        PARAMS ((enum tree_code, tree));
214191783Srmacklemextern void store_parm_decls                    PARAMS ((void));
215191783Srmacklemextern tree xref_tag                            PARAMS ((enum tree_code, tree));
216191783Srmacklemextern tree c_begin_compound_stmt               PARAMS ((void));
217191783Srmacklemextern void c_expand_deferred_function          PARAMS ((tree));
218191783Srmacklemextern void c_expand_decl_stmt                  PARAMS ((tree));
219191783Srmacklem
220191783Srmacklem
221191783Srmacklem/* in c-objc-common.c */
222191783Srmacklemextern int c_disregard_inline_limits		PARAMS ((tree));
223191783Srmacklemextern int c_cannot_inline_tree_fn		PARAMS ((tree *));
224191783Srmacklemextern const char *c_objc_common_init		PARAMS ((const char *));
225191783Srmacklemextern int c_missing_noreturn_ok_p		PARAMS ((tree));
226191783Srmacklemextern void c_objc_common_finish_file		PARAMS ((void));
227191783Srmacklemextern int defer_fn				PARAMS ((tree));
228191783Srmacklem
229191783Srmacklem#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P)		  \
230191783Srmacklem  c_build_qualified_type ((TYPE),				  \
231191783Srmacklem			  ((CONST_P) ? TYPE_QUAL_CONST : 0) |	  \
232191783Srmacklem			  ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
233191783Srmacklem
234191783Srmacklem/* in c-typeck.c */
235191783Srmacklemextern tree require_complete_type		PARAMS ((tree));
236191783Srmacklemextern int comptypes				PARAMS ((tree, tree));
237191783Srmacklemextern tree c_sizeof_nowarn			PARAMS ((tree));
238191783Srmacklemextern tree c_size_in_bytes                     PARAMS ((tree));
239191783Srmacklemextern tree build_component_ref                 PARAMS ((tree, tree));
240191783Srmacklemextern tree build_indirect_ref                  PARAMS ((tree, const char *));
241191783Srmacklemextern tree build_array_ref                     PARAMS ((tree, tree));
242191783Srmacklemextern tree build_external_ref			PARAMS ((tree, int));
243191783Srmacklemextern tree parser_build_binary_op              PARAMS ((enum tree_code,
244191783Srmacklem							 tree, tree));
245191783Srmacklemextern void readonly_warning			PARAMS ((tree, const char *));
246191783Srmacklemextern tree build_conditional_expr              PARAMS ((tree, tree, tree));
247191783Srmacklemextern tree build_compound_expr                 PARAMS ((tree));
248191783Srmacklemextern tree c_cast_expr				PARAMS ((tree, tree));
249191783Srmacklemextern tree build_c_cast	                PARAMS ((tree, tree));
250191783Srmacklemextern tree build_modify_expr                   PARAMS ((tree, enum tree_code,
251191783Srmacklem							 tree));
252191783Srmacklemextern void store_init_value                    PARAMS ((tree, tree));
253191783Srmacklemextern void error_init				PARAMS ((const char *));
254191783Srmacklemextern void pedwarn_init			PARAMS ((const char *));
255191783Srmacklemextern void start_init				PARAMS ((tree, tree, int));
256191783Srmacklemextern void finish_init				PARAMS ((void));
257191783Srmacklemextern void really_start_incremental_init	PARAMS ((tree));
258191783Srmacklemextern void push_init_level			PARAMS ((int));
259191783Srmacklemextern tree pop_init_level			PARAMS ((int));
260191783Srmacklemextern void set_init_index			PARAMS ((tree, tree));
261191783Srmacklemextern void set_init_label			PARAMS ((tree));
262191783Srmacklemextern void process_init_element		PARAMS ((tree));
263191783Srmacklemextern tree build_compound_literal		PARAMS ((tree, tree));
264191783Srmacklemextern void pedwarn_c99				PARAMS ((const char *, ...))
265191783Srmacklem							ATTRIBUTE_PRINTF_1;
266191783Srmacklemextern tree c_start_case                        PARAMS ((tree));
267191783Srmacklemextern void c_finish_case                       PARAMS ((void));
268191783Srmacklemextern tree simple_asm_stmt			PARAMS ((tree));
269191783Srmacklemextern tree build_asm_stmt			PARAMS ((tree, tree, tree,
270191783Srmacklem							 tree, tree));
271191783Srmacklem
272191783Srmacklem/* Set to 0 at beginning of a function definition, set to 1 if
273191783Srmacklem   a return statement that specifies a return value is seen.  */
274191783Srmacklem
275191783Srmacklemextern int current_function_returns_value;
276191783Srmacklem
277191783Srmacklem/* Set to 0 at beginning of a function definition, set to 1 if
278191783Srmacklem   a return statement with no argument is seen.  */
279191783Srmacklem
280191783Srmacklemextern int current_function_returns_null;
281191783Srmacklem
282191783Srmacklem/* Nonzero means the expression being parsed will never be evaluated.
283191783Srmacklem   This is a count, since unevaluated expressions can nest.  */
284191783Srmacklem
285191783Srmacklemextern int skip_evaluation;
286191783Srmacklem
287191783Srmacklem/* Nonzero means `$' can be in an identifier.  */
288191783Srmacklem
289191783Srmacklemextern int dollars_in_ident;
290191783Srmacklem
291191783Srmacklem/* Nonzero means allow type mismatches in conditional expressions;
292191783Srmacklem   just make their values `void'.  */
293191783Srmacklem
294191783Srmacklemextern int flag_cond_mismatch;
295191783Srmacklem
296191783Srmacklem/* Nonzero means don't recognize the keyword `asm'.  */
297191783Srmacklem
298191783Srmacklemextern int flag_no_asm;
299191783Srmacklem
300191783Srmacklem/* Nonzero means warn about implicit declarations.  */
301191783Srmacklem
302191783Srmacklemextern int warn_implicit;
303191783Srmacklem
304191783Srmacklem/* Nonzero means warn for all old-style non-prototype function decls.  */
305191783Srmacklem
306191783Srmacklemextern int warn_strict_prototypes;
307191783Srmacklem
308191783Srmacklem/* Nonzero means warn about multiple (redundant) decls for the same single
309191783Srmacklem   variable or function.  */
310191783Srmacklem
311191783Srmacklemextern int warn_redundant_decls;
312191783Srmacklem
313191783Srmacklem/* Nonzero means warn about extern declarations of objects not at
314191783Srmacklem   file-scope level and about *all* declarations of functions (whether
315191783Srmacklem   extern or static) not at file-scope level.  Note that we exclude
316191783Srmacklem   implicit function declarations.  To get warnings about those, use
317191783Srmacklem   -Wimplicit.  */
318191783Srmacklem
319191783Srmacklemextern int warn_nested_externs;
320191783Srmacklem
321191783Srmacklem/* Nonzero means warn about pointer casts that can drop a type qualifier
322191783Srmacklem   from the pointer target type.  */
323191783Srmacklem
324191783Srmacklemextern int warn_cast_qual;
325191783Srmacklem
326191783Srmacklem/* Nonzero means warn when casting a function call to a type that does
327191783Srmacklem   not match the return type (e.g. (float)sqrt() or (anything*)malloc()
328191783Srmacklem   when there is no previous declaration of sqrt or malloc.  */
329191783Srmacklem
330191783Srmacklemextern int warn_bad_function_cast;
331191783Srmacklem
332191783Srmacklem/* Warn about traditional constructs whose meanings changed in ANSI C.  */
333191783Srmacklem
334191783Srmacklemextern int warn_traditional;
335191783Srmacklem
336191783Srmacklem/* Warn about a subscript that has type char.  */
337191783Srmacklem
338191783Srmacklemextern int warn_char_subscripts;
339191783Srmacklem
340191783Srmacklem/* Warn if main is suspicious.  */
341191783Srmacklem
342191783Srmacklemextern int warn_main;
343191783Srmacklem
344191783Srmacklem/* Nonzero means to allow single precision math even if we're generally
345191783Srmacklem   being traditional.  */
346191783Srmacklemextern int flag_allow_single_precision;
347191783Srmacklem
348191783Srmacklem/* Warn if initializer is not completely bracketed.  */
349191783Srmacklem
350191783Srmacklemextern int warn_missing_braces;
351191783Srmacklem
352191783Srmacklem/* Warn about comparison of signed and unsigned values.  */
353191783Srmacklem
354191783Srmacklemextern int warn_sign_compare;
355191783Srmacklem
356191783Srmacklem/* Warn about testing equality of floating point numbers.  */
357191783Srmacklem
358191783Srmacklemextern int warn_float_equal;
359191783Srmacklem
360191783Srmacklem/* Warn about multicharacter constants.  */
361191783Srmacklem
362191783Srmacklemextern int warn_multichar;
363191783Srmacklem
364191783Srmacklem/* Nonzero means we are reading code that came from a system header file.  */
365191783Srmacklem
366191783Srmacklemextern int system_header_p;
367191783Srmacklem
368191783Srmacklem/* Warn about implicit declarations.  1 = warning, 2 = error.  */
369191783Srmacklemextern int mesg_implicit_function_declaration;
370191783Srmacklem
371191783Srmacklem/* In c-decl.c */
372191783Srmacklemextern void finish_incomplete_decl PARAMS ((tree));
373191783Srmacklem
374191783Srmacklemextern tree static_ctors;
375191783Srmacklemextern tree static_dtors;
376191783Srmacklem
377191783Srmacklem#endif /* ! GCC_C_TREE_H */
378191783Srmacklem