xref: /openbsd-src/gnu/gcc/gcc/c-tree.h (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert /* Definitions for C parsing and type checking.
2*404b540aSrobert    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3*404b540aSrobert    1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4*404b540aSrobert 
5*404b540aSrobert This file is part of GCC.
6*404b540aSrobert 
7*404b540aSrobert GCC is free software; you can redistribute it and/or modify it under
8*404b540aSrobert the terms of the GNU General Public License as published by the Free
9*404b540aSrobert Software Foundation; either version 2, or (at your option) any later
10*404b540aSrobert version.
11*404b540aSrobert 
12*404b540aSrobert GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*404b540aSrobert WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*404b540aSrobert FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15*404b540aSrobert for more details.
16*404b540aSrobert 
17*404b540aSrobert You should have received a copy of the GNU General Public License
18*404b540aSrobert along with GCC; see the file COPYING.  If not, write to the Free
19*404b540aSrobert Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20*404b540aSrobert 02110-1301, USA.  */
21*404b540aSrobert 
22*404b540aSrobert #ifndef GCC_C_TREE_H
23*404b540aSrobert #define GCC_C_TREE_H
24*404b540aSrobert 
25*404b540aSrobert #include "c-common.h"
26*404b540aSrobert #include "toplev.h"
27*404b540aSrobert #include "diagnostic.h"
28*404b540aSrobert 
29*404b540aSrobert /* struct lang_identifier is private to c-decl.c, but langhooks.c needs to
30*404b540aSrobert    know how big it is.  This is sanity-checked in c-decl.c.  */
31*404b540aSrobert #define C_SIZEOF_STRUCT_LANG_IDENTIFIER \
32*404b540aSrobert   (sizeof (struct c_common_identifier) + 3 * sizeof (void *))
33*404b540aSrobert 
34*404b540aSrobert /* Language-specific declaration information.  */
35*404b540aSrobert 
36*404b540aSrobert struct lang_decl GTY(())
37*404b540aSrobert {
38*404b540aSrobert   char dummy;
39*404b540aSrobert };
40*404b540aSrobert 
41*404b540aSrobert /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
42*404b540aSrobert #define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
43*404b540aSrobert 
44*404b540aSrobert /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile.  */
45*404b540aSrobert #define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE)
46*404b540aSrobert 
47*404b540aSrobert /* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
48*404b540aSrobert    nonzero if the definition of the type has already started.  */
49*404b540aSrobert #define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
50*404b540aSrobert 
51*404b540aSrobert /* In an incomplete RECORD_TYPE or UNION_TYPE, a list of variable
52*404b540aSrobert    declarations whose type would be completed by completing that type.  */
53*404b540aSrobert #define C_TYPE_INCOMPLETE_VARS(TYPE) TYPE_VFIELD (TYPE)
54*404b540aSrobert 
55*404b540aSrobert /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
56*404b540aSrobert    keyword.  C_RID_CODE (node) is then the RID_* value of the keyword,
57*404b540aSrobert    and C_RID_YYCODE is the token number wanted by Yacc.  */
58*404b540aSrobert #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
59*404b540aSrobert 
60*404b540aSrobert struct lang_type GTY(())
61*404b540aSrobert {
62*404b540aSrobert   /* In a RECORD_TYPE, a sorted array of the fields of the type.  */
63*404b540aSrobert   struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields"))) s;
64*404b540aSrobert   /* In an ENUMERAL_TYPE, the min and max values.  */
65*404b540aSrobert   tree enum_min;
66*404b540aSrobert   tree enum_max;
67*404b540aSrobert   /* In a RECORD_TYPE, information specific to Objective-C, such
68*404b540aSrobert      as a list of adopted protocols or a pointer to a corresponding
69*404b540aSrobert      @interface.  See objc/objc-act.h for details.  */
70*404b540aSrobert   tree objc_info;
71*404b540aSrobert };
72*404b540aSrobert 
73*404b540aSrobert /* Record whether a type or decl was written with nonconstant size.
74*404b540aSrobert    Note that TYPE_SIZE may have simplified to a constant.  */
75*404b540aSrobert #define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
76*404b540aSrobert #define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
77*404b540aSrobert 
78*404b540aSrobert /* Record whether a typedef for type `int' was actually `signed int'.  */
79*404b540aSrobert #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
80*404b540aSrobert 
81*404b540aSrobert /* For a FUNCTION_DECL, nonzero if it was defined without an explicit
82*404b540aSrobert    return type.  */
83*404b540aSrobert #define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP)
84*404b540aSrobert 
85*404b540aSrobert /* For a FUNCTION_DECL, nonzero if it was an implicit declaration.  */
86*404b540aSrobert #define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
87*404b540aSrobert 
88*404b540aSrobert /* For FUNCTION_DECLs, evaluates true if the decl is built-in but has
89*404b540aSrobert    been declared.  */
90*404b540aSrobert #define C_DECL_DECLARED_BUILTIN(EXP)		\
91*404b540aSrobert   DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (EXP))
92*404b540aSrobert 
93*404b540aSrobert /* For FUNCTION_DECLs, evaluates true if the decl is built-in, has a
94*404b540aSrobert    built-in prototype and does not have a non-built-in prototype.  */
95*404b540aSrobert #define C_DECL_BUILTIN_PROTOTYPE(EXP)		\
96*404b540aSrobert   DECL_LANG_FLAG_6 (FUNCTION_DECL_CHECK (EXP))
97*404b540aSrobert 
98*404b540aSrobert /* Record whether a decl was declared register.  This is strictly a
99*404b540aSrobert    front-end flag, whereas DECL_REGISTER is used for code generation;
100*404b540aSrobert    they may differ for structures with volatile fields.  */
101*404b540aSrobert #define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP)
102*404b540aSrobert 
103*404b540aSrobert /* Record whether a decl was used in an expression anywhere except an
104*404b540aSrobert    unevaluated operand of sizeof / typeof / alignof.  This is only
105*404b540aSrobert    used for functions declared static but not defined, though outside
106*404b540aSrobert    sizeof and typeof it is set for other function decls as well.  */
107*404b540aSrobert #define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (EXP))
108*404b540aSrobert 
109*404b540aSrobert /* Record whether a label was defined in a statement expression which
110*404b540aSrobert    has finished and so can no longer be jumped to.  */
111*404b540aSrobert #define C_DECL_UNJUMPABLE_STMT_EXPR(EXP)	\
112*404b540aSrobert   DECL_LANG_FLAG_6 (LABEL_DECL_CHECK (EXP))
113*404b540aSrobert 
114*404b540aSrobert /* Record whether a label was the subject of a goto from outside the
115*404b540aSrobert    current level of statement expression nesting and so cannot be
116*404b540aSrobert    defined right now.  */
117*404b540aSrobert #define C_DECL_UNDEFINABLE_STMT_EXPR(EXP)	\
118*404b540aSrobert   DECL_LANG_FLAG_7 (LABEL_DECL_CHECK (EXP))
119*404b540aSrobert 
120*404b540aSrobert /* Record whether a label was defined in the scope of an identifier
121*404b540aSrobert    with variably modified type which has finished and so can no longer
122*404b540aSrobert    be jumped to.  */
123*404b540aSrobert #define C_DECL_UNJUMPABLE_VM(EXP)	\
124*404b540aSrobert   DECL_LANG_FLAG_3 (LABEL_DECL_CHECK (EXP))
125*404b540aSrobert 
126*404b540aSrobert /* Record whether a label was the subject of a goto from outside the
127*404b540aSrobert    current level of scopes of identifiers with variably modified type
128*404b540aSrobert    and so cannot be defined right now.  */
129*404b540aSrobert #define C_DECL_UNDEFINABLE_VM(EXP)	\
130*404b540aSrobert   DECL_LANG_FLAG_5 (LABEL_DECL_CHECK (EXP))
131*404b540aSrobert 
132*404b540aSrobert /* Record whether a variable has been declared threadprivate by
133*404b540aSrobert    #pragma omp threadprivate.  */
134*404b540aSrobert #define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL))
135*404b540aSrobert 
136*404b540aSrobert /* Nonzero for a decl which either doesn't exist or isn't a prototype.
137*404b540aSrobert    N.B. Could be simplified if all built-in decls had complete prototypes
138*404b540aSrobert    (but this is presently difficult because some of them need FILE*).  */
139*404b540aSrobert #define C_DECL_ISNT_PROTOTYPE(EXP)			\
140*404b540aSrobert        (EXP == 0					\
141*404b540aSrobert 	|| (TYPE_ARG_TYPES (TREE_TYPE (EXP)) == 0	\
142*404b540aSrobert 	    && !DECL_BUILT_IN (EXP)))
143*404b540aSrobert 
144*404b540aSrobert /* For FUNCTION_TYPE, a hidden list of types of arguments.  The same as
145*404b540aSrobert    TYPE_ARG_TYPES for functions with prototypes, but created for functions
146*404b540aSrobert    without prototypes.  */
147*404b540aSrobert #define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_LANG_SLOT_1 (NODE)
148*404b540aSrobert 
149*404b540aSrobert /* Record parser information about an expression that is irrelevant
150*404b540aSrobert    for code generation alongside a tree representing its value.  */
151*404b540aSrobert struct c_expr
152*404b540aSrobert {
153*404b540aSrobert   /* The value of the expression.  */
154*404b540aSrobert   tree value;
155*404b540aSrobert   /* Record the original binary operator of an expression, which may
156*404b540aSrobert      have been changed by fold, STRING_CST for unparenthesized string
157*404b540aSrobert      constants, or ERROR_MARK for other expressions (including
158*404b540aSrobert      parenthesized expressions).  */
159*404b540aSrobert   enum tree_code original_code;
160*404b540aSrobert };
161*404b540aSrobert 
162*404b540aSrobert /* A kind of type specifier.  Note that this information is currently
163*404b540aSrobert    only used to distinguish tag definitions, tag references and typeof
164*404b540aSrobert    uses.  */
165*404b540aSrobert enum c_typespec_kind {
166*404b540aSrobert   /* A reserved keyword type specifier.  */
167*404b540aSrobert   ctsk_resword,
168*404b540aSrobert   /* A reference to a tag, previously declared, such as "struct foo".
169*404b540aSrobert      This includes where the previous declaration was as a different
170*404b540aSrobert      kind of tag, in which case this is only valid if shadowing that
171*404b540aSrobert      tag in an inner scope.  */
172*404b540aSrobert   ctsk_tagref,
173*404b540aSrobert   /* A reference to a tag, not previously declared in a visible
174*404b540aSrobert      scope.  */
175*404b540aSrobert   ctsk_tagfirstref,
176*404b540aSrobert   /* A definition of a tag such as "struct foo { int a; }".  */
177*404b540aSrobert   ctsk_tagdef,
178*404b540aSrobert   /* A typedef name.  */
179*404b540aSrobert   ctsk_typedef,
180*404b540aSrobert   /* An ObjC-specific kind of type specifier.  */
181*404b540aSrobert   ctsk_objc,
182*404b540aSrobert   /* A typeof specifier.  */
183*404b540aSrobert   ctsk_typeof
184*404b540aSrobert };
185*404b540aSrobert 
186*404b540aSrobert /* A type specifier: this structure is created in the parser and
187*404b540aSrobert    passed to declspecs_add_type only.  */
188*404b540aSrobert struct c_typespec {
189*404b540aSrobert   /* What kind of type specifier this is.  */
190*404b540aSrobert   enum c_typespec_kind kind;
191*404b540aSrobert   /* The specifier itself.  */
192*404b540aSrobert   tree spec;
193*404b540aSrobert };
194*404b540aSrobert 
195*404b540aSrobert /* A storage class specifier.  */
196*404b540aSrobert enum c_storage_class {
197*404b540aSrobert   csc_none,
198*404b540aSrobert   csc_auto,
199*404b540aSrobert   csc_extern,
200*404b540aSrobert   csc_register,
201*404b540aSrobert   csc_static,
202*404b540aSrobert   csc_typedef
203*404b540aSrobert };
204*404b540aSrobert 
205*404b540aSrobert /* A type specifier keyword "void", "_Bool", "char", "int", "float",
206*404b540aSrobert    "double", or none of these.  */
207*404b540aSrobert enum c_typespec_keyword {
208*404b540aSrobert   cts_none,
209*404b540aSrobert   cts_void,
210*404b540aSrobert   cts_bool,
211*404b540aSrobert   cts_char,
212*404b540aSrobert   cts_int,
213*404b540aSrobert   cts_float,
214*404b540aSrobert   cts_double,
215*404b540aSrobert   cts_dfloat32,
216*404b540aSrobert   cts_dfloat64,
217*404b540aSrobert   cts_dfloat128
218*404b540aSrobert };
219*404b540aSrobert 
220*404b540aSrobert /* A sequence of declaration specifiers in C.  */
221*404b540aSrobert struct c_declspecs {
222*404b540aSrobert   /* The type specified, if a single type specifier such as a struct,
223*404b540aSrobert      union or enum specifier, typedef name or typeof specifies the
224*404b540aSrobert      whole type, or NULL_TREE if none or a keyword such as "void" or
225*404b540aSrobert      "char" is used.  Does not include qualifiers.  */
226*404b540aSrobert   tree type;
227*404b540aSrobert   /* The attributes from a typedef decl.  */
228*404b540aSrobert   tree decl_attr;
229*404b540aSrobert   /* When parsing, the attributes.  Outside the parser, this will be
230*404b540aSrobert      NULL; attributes (possibly from multiple lists) will be passed
231*404b540aSrobert      separately.  */
232*404b540aSrobert   tree attrs;
233*404b540aSrobert   /* Any type specifier keyword used such as "int", not reflecting
234*404b540aSrobert      modifiers such as "short", or cts_none if none.  */
235*404b540aSrobert   enum c_typespec_keyword typespec_word;
236*404b540aSrobert   /* The storage class specifier, or csc_none if none.  */
237*404b540aSrobert   enum c_storage_class storage_class;
238*404b540aSrobert   /* Whether any declaration specifiers have been seen at all.  */
239*404b540aSrobert   BOOL_BITFIELD declspecs_seen_p : 1;
240*404b540aSrobert   /* Whether a type specifier has been seen.  */
241*404b540aSrobert   BOOL_BITFIELD type_seen_p : 1;
242*404b540aSrobert   /* Whether something other than a storage class specifier or
243*404b540aSrobert      attribute has been seen.  This is used to warn for the
244*404b540aSrobert      obsolescent usage of storage class specifiers other than at the
245*404b540aSrobert      start of the list.  (Doing this properly would require function
246*404b540aSrobert      specifiers to be handled separately from storage class
247*404b540aSrobert      specifiers.)  */
248*404b540aSrobert   BOOL_BITFIELD non_sc_seen_p : 1;
249*404b540aSrobert   /* Whether the type is specified by a typedef or typeof name.  */
250*404b540aSrobert   BOOL_BITFIELD typedef_p : 1;
251*404b540aSrobert   /* Whether a struct, union or enum type either had its content
252*404b540aSrobert      defined by a type specifier in the list or was the first visible
253*404b540aSrobert      declaration of its tag.  */
254*404b540aSrobert   BOOL_BITFIELD tag_defined_p : 1;
255*404b540aSrobert   /* Whether the type is explicitly "signed" or specified by a typedef
256*404b540aSrobert      whose type is explicitly "signed".  */
257*404b540aSrobert   BOOL_BITFIELD explicit_signed_p : 1;
258*404b540aSrobert   /* Whether the specifiers include a deprecated typedef.  */
259*404b540aSrobert   BOOL_BITFIELD deprecated_p : 1;
260*404b540aSrobert   /* Whether the type defaulted to "int" because there were no type
261*404b540aSrobert      specifiers.  */
262*404b540aSrobert   BOOL_BITFIELD default_int_p;
263*404b540aSrobert   /* Whether "long" was specified.  */
264*404b540aSrobert   BOOL_BITFIELD long_p : 1;
265*404b540aSrobert   /* Whether "long" was specified more than once.  */
266*404b540aSrobert   BOOL_BITFIELD long_long_p : 1;
267*404b540aSrobert   /* Whether "short" was specified.  */
268*404b540aSrobert   BOOL_BITFIELD short_p : 1;
269*404b540aSrobert   /* Whether "signed" was specified.  */
270*404b540aSrobert   BOOL_BITFIELD signed_p : 1;
271*404b540aSrobert   /* Whether "unsigned" was specified.  */
272*404b540aSrobert   BOOL_BITFIELD unsigned_p : 1;
273*404b540aSrobert   /* Whether "complex" was specified.  */
274*404b540aSrobert   BOOL_BITFIELD complex_p : 1;
275*404b540aSrobert   /* Whether "inline" was specified.  */
276*404b540aSrobert   BOOL_BITFIELD inline_p : 1;
277*404b540aSrobert   /* Whether "__thread" was specified.  */
278*404b540aSrobert   BOOL_BITFIELD thread_p : 1;
279*404b540aSrobert   /* Whether "const" was specified.  */
280*404b540aSrobert   BOOL_BITFIELD const_p : 1;
281*404b540aSrobert   /* Whether "volatile" was specified.  */
282*404b540aSrobert   BOOL_BITFIELD volatile_p : 1;
283*404b540aSrobert   /* Whether "restrict" was specified.  */
284*404b540aSrobert   BOOL_BITFIELD restrict_p : 1;
285*404b540aSrobert };
286*404b540aSrobert 
287*404b540aSrobert /* The various kinds of declarators in C.  */
288*404b540aSrobert enum c_declarator_kind {
289*404b540aSrobert   /* An identifier.  */
290*404b540aSrobert   cdk_id,
291*404b540aSrobert   /* A function.  */
292*404b540aSrobert   cdk_function,
293*404b540aSrobert   /* An array.  */
294*404b540aSrobert   cdk_array,
295*404b540aSrobert   /* A pointer.  */
296*404b540aSrobert   cdk_pointer,
297*404b540aSrobert   /* Parenthesized declarator with nested attributes.  */
298*404b540aSrobert   cdk_attrs
299*404b540aSrobert };
300*404b540aSrobert 
301*404b540aSrobert /* Information about the parameters in a function declarator.  */
302*404b540aSrobert struct c_arg_info {
303*404b540aSrobert   /* A list of parameter decls.  */
304*404b540aSrobert   tree parms;
305*404b540aSrobert   /* A list of structure, union and enum tags defined.  */
306*404b540aSrobert   tree tags;
307*404b540aSrobert   /* A list of argument types to go in the FUNCTION_TYPE.  */
308*404b540aSrobert   tree types;
309*404b540aSrobert   /* A list of non-parameter decls (notably enumeration constants)
310*404b540aSrobert      defined with the parameters.  */
311*404b540aSrobert   tree others;
312*404b540aSrobert   /* A list of VLA sizes from the parameters.  In a function
313*404b540aSrobert      definition, these are used to ensure that side-effects in sizes
314*404b540aSrobert      of arrays converted to pointers (such as a parameter int i[n++])
315*404b540aSrobert      take place; otherwise, they are ignored.  */
316*404b540aSrobert   tree pending_sizes;
317*404b540aSrobert   /* True when these arguments had [*].  */
318*404b540aSrobert   BOOL_BITFIELD had_vla_unspec : 1;
319*404b540aSrobert };
320*404b540aSrobert 
321*404b540aSrobert /* A declarator.  */
322*404b540aSrobert struct c_declarator {
323*404b540aSrobert   /* The kind of declarator.  */
324*404b540aSrobert   enum c_declarator_kind kind;
325*404b540aSrobert   /* Except for cdk_id, the contained declarator.  For cdk_id, NULL.  */
326*404b540aSrobert   struct c_declarator *declarator;
327*404b540aSrobert   location_t id_loc; /* Currently only set for cdk_id. */
328*404b540aSrobert   union {
329*404b540aSrobert     /* For identifiers, an IDENTIFIER_NODE or NULL_TREE if an abstract
330*404b540aSrobert        declarator.  */
331*404b540aSrobert     tree id;
332*404b540aSrobert     /* For functions.  */
333*404b540aSrobert     struct c_arg_info *arg_info;
334*404b540aSrobert     /* For arrays.  */
335*404b540aSrobert     struct {
336*404b540aSrobert       /* The array dimension, or NULL for [] and [*].  */
337*404b540aSrobert       tree dimen;
338*404b540aSrobert       /* The qualifiers inside [].  */
339*404b540aSrobert       int quals;
340*404b540aSrobert       /* The attributes (currently ignored) inside [].  */
341*404b540aSrobert       tree attrs;
342*404b540aSrobert       /* Whether [static] was used.  */
343*404b540aSrobert       BOOL_BITFIELD static_p : 1;
344*404b540aSrobert       /* Whether [*] was used.  */
345*404b540aSrobert       BOOL_BITFIELD vla_unspec_p : 1;
346*404b540aSrobert     } array;
347*404b540aSrobert     /* For pointers, the qualifiers on the pointer type.  */
348*404b540aSrobert     int pointer_quals;
349*404b540aSrobert     /* For attributes.  */
350*404b540aSrobert     tree attrs;
351*404b540aSrobert   } u;
352*404b540aSrobert };
353*404b540aSrobert 
354*404b540aSrobert /* A type name.  */
355*404b540aSrobert struct c_type_name {
356*404b540aSrobert   /* The declaration specifiers.  */
357*404b540aSrobert   struct c_declspecs *specs;
358*404b540aSrobert   /* The declarator.  */
359*404b540aSrobert   struct c_declarator *declarator;
360*404b540aSrobert };
361*404b540aSrobert 
362*404b540aSrobert /* A parameter.  */
363*404b540aSrobert struct c_parm {
364*404b540aSrobert   /* The declaration specifiers, minus any prefix attributes.  */
365*404b540aSrobert   struct c_declspecs *specs;
366*404b540aSrobert   /* The attributes.  */
367*404b540aSrobert   tree attrs;
368*404b540aSrobert   /* The declarator.  */
369*404b540aSrobert   struct c_declarator *declarator;
370*404b540aSrobert };
371*404b540aSrobert 
372*404b540aSrobert /* Save and restore the variables in this file and elsewhere
373*404b540aSrobert    that keep track of the progress of compilation of the current function.
374*404b540aSrobert    Used for nested functions.  */
375*404b540aSrobert 
376*404b540aSrobert struct language_function GTY(())
377*404b540aSrobert {
378*404b540aSrobert   struct c_language_function base;
379*404b540aSrobert   tree x_break_label;
380*404b540aSrobert   tree x_cont_label;
381*404b540aSrobert   struct c_switch * GTY((skip)) x_switch_stack;
382*404b540aSrobert   struct c_arg_info * GTY((skip)) arg_info;
383*404b540aSrobert   int returns_value;
384*404b540aSrobert   int returns_null;
385*404b540aSrobert   int returns_abnormally;
386*404b540aSrobert   int warn_about_return_type;
387*404b540aSrobert   int extern_inline;
388*404b540aSrobert };
389*404b540aSrobert 
390*404b540aSrobert /* Save lists of labels used or defined in particular contexts.
391*404b540aSrobert    Allocated on the parser obstack.  */
392*404b540aSrobert 
393*404b540aSrobert struct c_label_list
394*404b540aSrobert {
395*404b540aSrobert   /* The label at the head of the list.  */
396*404b540aSrobert   tree label;
397*404b540aSrobert   /* The rest of the list.  */
398*404b540aSrobert   struct c_label_list *next;
399*404b540aSrobert };
400*404b540aSrobert 
401*404b540aSrobert /* Statement expression context.  */
402*404b540aSrobert 
403*404b540aSrobert struct c_label_context_se
404*404b540aSrobert {
405*404b540aSrobert   /* The labels defined at this level of nesting.  */
406*404b540aSrobert   struct c_label_list *labels_def;
407*404b540aSrobert   /* The labels used at this level of nesting.  */
408*404b540aSrobert   struct c_label_list *labels_used;
409*404b540aSrobert   /* The next outermost context.  */
410*404b540aSrobert   struct c_label_context_se *next;
411*404b540aSrobert };
412*404b540aSrobert 
413*404b540aSrobert /* Context of variably modified declarations.  */
414*404b540aSrobert 
415*404b540aSrobert struct c_label_context_vm
416*404b540aSrobert {
417*404b540aSrobert   /* The labels defined at this level of nesting.  */
418*404b540aSrobert   struct c_label_list *labels_def;
419*404b540aSrobert   /* The labels used at this level of nesting.  */
420*404b540aSrobert   struct c_label_list *labels_used;
421*404b540aSrobert   /* The scope of this context.  Multiple contexts may be at the same
422*404b540aSrobert      numbered scope, since each variably modified declaration starts a
423*404b540aSrobert      new context.  */
424*404b540aSrobert   unsigned scope;
425*404b540aSrobert   /* The next outermost context.  */
426*404b540aSrobert   struct c_label_context_vm *next;
427*404b540aSrobert };
428*404b540aSrobert 
429*404b540aSrobert 
430*404b540aSrobert /* in c-parser.c */
431*404b540aSrobert extern void c_parse_init (void);
432*404b540aSrobert 
433*404b540aSrobert /* in c-aux-info.c */
434*404b540aSrobert extern void gen_aux_info_record (tree, int, int, int);
435*404b540aSrobert 
436*404b540aSrobert /* in c-decl.c */
437*404b540aSrobert extern struct obstack parser_obstack;
438*404b540aSrobert extern tree c_break_label;
439*404b540aSrobert extern tree c_cont_label;
440*404b540aSrobert 
441*404b540aSrobert extern int global_bindings_p (void);
442*404b540aSrobert extern void push_scope (void);
443*404b540aSrobert extern tree pop_scope (void);
444*404b540aSrobert extern void insert_block (tree);
445*404b540aSrobert extern void c_expand_body (tree);
446*404b540aSrobert 
447*404b540aSrobert extern void c_init_decl_processing (void);
448*404b540aSrobert extern void c_dup_lang_specific_decl (tree);
449*404b540aSrobert extern void c_print_identifier (FILE *, tree, int);
450*404b540aSrobert extern int quals_from_declspecs (const struct c_declspecs *);
451*404b540aSrobert extern struct c_declarator *build_array_declarator (tree, struct c_declspecs *,
452*404b540aSrobert 						    bool, bool);
453*404b540aSrobert extern tree build_enumerator (tree, tree);
454*404b540aSrobert extern tree check_for_loop_decls (void);
455*404b540aSrobert extern void mark_forward_parm_decls (void);
456*404b540aSrobert extern void declare_parm_level (void);
457*404b540aSrobert extern void undeclared_variable (tree, location_t);
458*404b540aSrobert extern tree declare_label (tree);
459*404b540aSrobert extern tree define_label (location_t, tree);
460*404b540aSrobert extern void c_maybe_initialize_eh (void);
461*404b540aSrobert extern void finish_decl (tree, tree, tree);
462*404b540aSrobert extern tree finish_enum (tree, tree, tree);
463*404b540aSrobert extern void finish_function (void);
464*404b540aSrobert extern tree finish_struct (tree, tree, tree);
465*404b540aSrobert extern struct c_arg_info *get_parm_info (bool);
466*404b540aSrobert extern tree grokfield (struct c_declarator *, struct c_declspecs *, tree);
467*404b540aSrobert extern tree groktypename (struct c_type_name *);
468*404b540aSrobert extern tree grokparm (const struct c_parm *);
469*404b540aSrobert extern tree implicitly_declare (tree);
470*404b540aSrobert extern void keep_next_level (void);
471*404b540aSrobert extern void pending_xref_error (void);
472*404b540aSrobert extern void c_push_function_context (struct function *);
473*404b540aSrobert extern void c_pop_function_context (struct function *);
474*404b540aSrobert extern void push_parm_decl (const struct c_parm *);
475*404b540aSrobert extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
476*404b540aSrobert 							struct c_declarator *,
477*404b540aSrobert 							bool);
478*404b540aSrobert extern tree builtin_function (const char *, tree, int, enum built_in_class,
479*404b540aSrobert 			      const char *, tree);
480*404b540aSrobert extern void shadow_tag (const struct c_declspecs *);
481*404b540aSrobert extern void shadow_tag_warned (const struct c_declspecs *, int);
482*404b540aSrobert extern tree start_enum (tree);
483*404b540aSrobert extern int  start_function (struct c_declspecs *, struct c_declarator *, tree);
484*404b540aSrobert extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
485*404b540aSrobert 			tree);
486*404b540aSrobert extern tree start_struct (enum tree_code, tree);
487*404b540aSrobert extern void store_parm_decls (void);
488*404b540aSrobert extern void store_parm_decls_from (struct c_arg_info *);
489*404b540aSrobert extern tree xref_tag (enum tree_code, tree);
490*404b540aSrobert extern struct c_typespec parser_xref_tag (enum tree_code, tree);
491*404b540aSrobert extern int c_expand_decl (tree);
492*404b540aSrobert extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
493*404b540aSrobert 				    struct c_declarator *);
494*404b540aSrobert extern struct c_declarator *build_attrs_declarator (tree,
495*404b540aSrobert 						    struct c_declarator *);
496*404b540aSrobert extern struct c_declarator *build_function_declarator (struct c_arg_info *,
497*404b540aSrobert 						       struct c_declarator *);
498*404b540aSrobert extern struct c_declarator *build_id_declarator (tree);
499*404b540aSrobert extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
500*404b540aSrobert 						     struct c_declarator *);
501*404b540aSrobert extern struct c_declspecs *build_null_declspecs (void);
502*404b540aSrobert extern struct c_declspecs *declspecs_add_qual (struct c_declspecs *, tree);
503*404b540aSrobert extern struct c_declspecs *declspecs_add_type (struct c_declspecs *,
504*404b540aSrobert 					       struct c_typespec);
505*404b540aSrobert extern struct c_declspecs *declspecs_add_scspec (struct c_declspecs *, tree);
506*404b540aSrobert extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree);
507*404b540aSrobert extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
508*404b540aSrobert 
509*404b540aSrobert /* in c-objc-common.c */
510*404b540aSrobert extern int c_disregard_inline_limits (tree);
511*404b540aSrobert extern int c_cannot_inline_tree_fn (tree *);
512*404b540aSrobert extern bool c_objc_common_init (void);
513*404b540aSrobert extern bool c_missing_noreturn_ok_p (tree);
514*404b540aSrobert extern tree c_objc_common_truthvalue_conversion (tree expr);
515*404b540aSrobert extern bool c_warn_unused_global_decl (tree);
516*404b540aSrobert extern void c_initialize_diagnostics (diagnostic_context *);
517*404b540aSrobert extern bool c_vla_unspec_p (tree x, tree fn);
518*404b540aSrobert 
519*404b540aSrobert #define c_build_type_variant(TYPE, CONST_P, VOLATILE_P)		  \
520*404b540aSrobert   c_build_qualified_type ((TYPE),				  \
521*404b540aSrobert 			  ((CONST_P) ? TYPE_QUAL_CONST : 0) |	  \
522*404b540aSrobert 			  ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
523*404b540aSrobert 
524*404b540aSrobert /* in c-typeck.c */
525*404b540aSrobert extern int in_alignof;
526*404b540aSrobert extern int in_sizeof;
527*404b540aSrobert extern int in_typeof;
528*404b540aSrobert 
529*404b540aSrobert extern struct c_switch *c_switch_stack;
530*404b540aSrobert extern struct c_label_context_se *label_context_stack_se;
531*404b540aSrobert extern struct c_label_context_vm *label_context_stack_vm;
532*404b540aSrobert 
533*404b540aSrobert extern tree require_complete_type (tree);
534*404b540aSrobert extern int same_translation_unit_p (tree, tree);
535*404b540aSrobert extern int comptypes (tree, tree);
536*404b540aSrobert extern bool c_vla_type_p (tree);
537*404b540aSrobert extern bool c_mark_addressable (tree);
538*404b540aSrobert extern void c_incomplete_type_error (tree, tree);
539*404b540aSrobert extern tree c_type_promotes_to (tree);
540*404b540aSrobert extern struct c_expr default_function_array_conversion (struct c_expr);
541*404b540aSrobert extern tree composite_type (tree, tree);
542*404b540aSrobert extern tree build_component_ref (tree, tree);
543*404b540aSrobert extern tree build_array_ref (tree, tree);
544*404b540aSrobert extern tree build_external_ref (tree, int, location_t);
545*404b540aSrobert extern void pop_maybe_used (bool);
546*404b540aSrobert extern struct c_expr c_expr_sizeof_expr (struct c_expr);
547*404b540aSrobert extern struct c_expr c_expr_sizeof_type (struct c_type_name *);
548*404b540aSrobert extern struct c_expr parser_build_unary_op (enum tree_code, struct c_expr);
549*404b540aSrobert extern struct c_expr parser_build_binary_op (enum tree_code, struct c_expr,
550*404b540aSrobert 					     struct c_expr);
551*404b540aSrobert extern tree build_conditional_expr (tree, tree, tree);
552*404b540aSrobert extern tree build_compound_expr (tree, tree);
553*404b540aSrobert extern tree c_cast_expr (struct c_type_name *, tree);
554*404b540aSrobert extern tree build_c_cast (tree, tree);
555*404b540aSrobert extern void store_init_value (tree, tree);
556*404b540aSrobert extern void error_init (const char *);
557*404b540aSrobert extern void pedwarn_init (const char *);
558*404b540aSrobert extern void maybe_warn_string_init (tree, struct c_expr);
559*404b540aSrobert extern void start_init (tree, tree, int);
560*404b540aSrobert extern void finish_init (void);
561*404b540aSrobert extern void really_start_incremental_init (tree);
562*404b540aSrobert extern void push_init_level (int);
563*404b540aSrobert extern struct c_expr pop_init_level (int);
564*404b540aSrobert extern void set_init_index (tree, tree);
565*404b540aSrobert extern void set_init_label (tree);
566*404b540aSrobert extern void process_init_element (struct c_expr);
567*404b540aSrobert extern tree build_compound_literal (tree, tree);
568*404b540aSrobert extern tree c_start_case (tree);
569*404b540aSrobert extern void c_finish_case (tree);
570*404b540aSrobert extern tree build_asm_expr (tree, tree, tree, tree, bool);
571*404b540aSrobert extern tree build_asm_stmt (tree, tree);
572*404b540aSrobert extern tree c_convert_parm_for_inlining (tree, tree, tree, int);
573*404b540aSrobert extern int c_types_compatible_p (tree, tree);
574*404b540aSrobert extern tree c_begin_compound_stmt (bool);
575*404b540aSrobert extern tree c_end_compound_stmt (tree, bool);
576*404b540aSrobert extern void c_finish_if_stmt (location_t, tree, tree, tree, bool);
577*404b540aSrobert extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool);
578*404b540aSrobert extern tree c_begin_stmt_expr (void);
579*404b540aSrobert extern tree c_finish_stmt_expr (tree);
580*404b540aSrobert extern tree c_process_expr_stmt (tree);
581*404b540aSrobert extern tree c_finish_expr_stmt (tree);
582*404b540aSrobert extern tree c_finish_return (tree);
583*404b540aSrobert extern tree c_finish_bc_stmt (tree *, bool);
584*404b540aSrobert extern tree c_finish_goto_label (tree);
585*404b540aSrobert extern tree c_finish_goto_ptr (tree);
586*404b540aSrobert extern void c_begin_vm_scope (unsigned int);
587*404b540aSrobert extern void c_end_vm_scope (unsigned int);
588*404b540aSrobert extern tree c_expr_to_decl (tree, bool *, bool *, bool *);
589*404b540aSrobert extern tree c_begin_omp_parallel (void);
590*404b540aSrobert extern tree c_finish_omp_parallel (tree, tree);
591*404b540aSrobert extern tree c_finish_omp_clauses (tree);
592*404b540aSrobert 
593*404b540aSrobert /* Set to 0 at beginning of a function definition, set to 1 if
594*404b540aSrobert    a return statement that specifies a return value is seen.  */
595*404b540aSrobert 
596*404b540aSrobert extern int current_function_returns_value;
597*404b540aSrobert 
598*404b540aSrobert /* Set to 0 at beginning of a function definition, set to 1 if
599*404b540aSrobert    a return statement with no argument is seen.  */
600*404b540aSrobert 
601*404b540aSrobert extern int current_function_returns_null;
602*404b540aSrobert 
603*404b540aSrobert /* Set to 0 at beginning of a function definition, set to 1 if
604*404b540aSrobert    a call to a noreturn function is seen.  */
605*404b540aSrobert 
606*404b540aSrobert extern int current_function_returns_abnormally;
607*404b540aSrobert 
608*404b540aSrobert /* Nonzero means we are reading code that came from a system header file.  */
609*404b540aSrobert 
610*404b540aSrobert extern int system_header_p;
611*404b540aSrobert 
612*404b540aSrobert /* True means global_bindings_p should return false even if the scope stack
613*404b540aSrobert    says we are in file scope.  */
614*404b540aSrobert 
615*404b540aSrobert extern bool c_override_global_bindings_to_false;
616*404b540aSrobert 
617*404b540aSrobert /* True means we've initialized exception handling.  */
618*404b540aSrobert extern bool c_eh_initialized_p;
619*404b540aSrobert 
620*404b540aSrobert /* In c-decl.c */
621*404b540aSrobert extern void c_finish_incomplete_decl (tree);
622*404b540aSrobert extern void c_write_global_declarations (void);
623*404b540aSrobert 
624*404b540aSrobert /* In order for the format checking to accept the C frontend
625*404b540aSrobert    diagnostic framework extensions, you must include this file before
626*404b540aSrobert    toplev.h, not after.  */
627*404b540aSrobert #if GCC_VERSION >= 4001
628*404b540aSrobert #define ATTRIBUTE_GCC_CDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
629*404b540aSrobert #else
630*404b540aSrobert #define ATTRIBUTE_GCC_CDIAG(m, n) ATTRIBUTE_NONNULL(m)
631*404b540aSrobert #endif
632*404b540aSrobert 
633*404b540aSrobert extern void pedwarn_c90 (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
634*404b540aSrobert extern void pedwarn_c99 (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
635*404b540aSrobert 
636*404b540aSrobert #endif /* ! GCC_C_TREE_H */
637