1 /* Definitions for C parsing and type checking.
2    Copyright (C) 1987-2018 Free Software Foundation, Inc.
3 
4 This file is part of GCC.
5 
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10 
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19 
20 #ifndef GCC_C_TREE_H
21 #define GCC_C_TREE_H
22 
23 #include "c-family/c-common.h"
24 #include "diagnostic.h"
25 
26 /* struct lang_identifier is private to c-decl.c, but langhooks.c needs to
27    know how big it is.  This is sanity-checked in c-decl.c.  */
28 #define C_SIZEOF_STRUCT_LANG_IDENTIFIER \
29   (sizeof (struct c_common_identifier) + 3 * sizeof (void *))
30 
31 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
32 #define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
33 
34 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile.  */
35 #define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE)
36 
37 /* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
38    nonzero if the definition of the type has already started.  */
39 #define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
40 
41 /* In an incomplete RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE, a list of
42    variable declarations whose type would be completed by completing
43    that type.  */
44 #define C_TYPE_INCOMPLETE_VARS(TYPE) \
45   TYPE_LANG_SLOT_1 (TREE_CHECK4 (TYPE, RECORD_TYPE, UNION_TYPE, \
46 				 QUAL_UNION_TYPE, ENUMERAL_TYPE))
47 
48 /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
49    keyword.  C_RID_CODE (node) is then the RID_* value of the keyword.  */
50 #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
51 
52 /* Record whether a type or decl was written with nonconstant size.
53    Note that TYPE_SIZE may have simplified to a constant.  */
54 #define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
55 #define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
56 
57 /* Record whether a type is defined inside a struct or union type.
58    This is used for -Wc++-compat. */
59 #define C_TYPE_DEFINED_IN_STRUCT(TYPE) TYPE_LANG_FLAG_2 (TYPE)
60 
61 /* Record whether an "incomplete type" error was given for the type.  */
62 #define C_TYPE_ERROR_REPORTED(TYPE) TYPE_LANG_FLAG_3 (TYPE)
63 
64 /* Record whether a typedef for type `int' was actually `signed int'.  */
65 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
66 
67 /* For a FUNCTION_DECL, nonzero if it was defined without an explicit
68    return type.  */
69 #define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP)
70 
71 /* For a FUNCTION_DECL, nonzero if it was an implicit declaration.  */
72 #define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
73 
74 /* For a PARM_DECL, nonzero if it was declared as an array.  */
75 #define C_ARRAY_PARAMETER(NODE) DECL_LANG_FLAG_0 (NODE)
76 
77 /* For FUNCTION_DECLs, evaluates true if the decl is built-in but has
78    been declared.  */
79 #define C_DECL_DECLARED_BUILTIN(EXP)		\
80   DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (EXP))
81 
82 /* For FUNCTION_DECLs, evaluates true if the decl is built-in, has a
83    built-in prototype and does not have a non-built-in prototype.  */
84 #define C_DECL_BUILTIN_PROTOTYPE(EXP)		\
85   DECL_LANG_FLAG_6 (FUNCTION_DECL_CHECK (EXP))
86 
87 /* Record whether a decl was declared register.  This is strictly a
88    front-end flag, whereas DECL_REGISTER is used for code generation;
89    they may differ for structures with volatile fields.  */
90 #define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP)
91 
92 /* Record whether a decl was used in an expression anywhere except an
93    unevaluated operand of sizeof / typeof / alignof.  This is only
94    used for functions declared static but not defined, though outside
95    sizeof and typeof it is set for other function decls as well.  */
96 #define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (EXP))
97 
98 /* Record whether a variable has been declared threadprivate by
99    #pragma omp threadprivate.  */
100 #define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL))
101 
102 /* Nonzero for a decl which either doesn't exist or isn't a prototype.
103    N.B. Could be simplified if all built-in decls had complete prototypes
104    (but this is presently difficult because some of them need FILE*).  */
105 #define C_DECL_ISNT_PROTOTYPE(EXP)			\
106        (EXP == 0					\
107 	|| (!prototype_p (TREE_TYPE (EXP))	\
108 	    && !DECL_BUILT_IN (EXP)))
109 
110 /* For FUNCTION_TYPE, a hidden list of types of arguments.  The same as
111    TYPE_ARG_TYPES for functions with prototypes, but created for functions
112    without prototypes.  */
113 #define TYPE_ACTUAL_ARG_TYPES(NODE) \
114   TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE))
115 
116 /* For a CONSTRUCTOR, whether some initializer contains a
117    subexpression meaning it is not a constant expression.  */
118 #define CONSTRUCTOR_NON_CONST(EXPR) TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (EXPR))
119 
120 /* For a SAVE_EXPR, nonzero if the operand of the SAVE_EXPR has already
121    been folded.  */
122 #define SAVE_EXPR_FOLDED_P(EXP)	TREE_LANG_FLAG_1 (SAVE_EXPR_CHECK (EXP))
123 
124 /* Record parser information about an expression that is irrelevant
125    for code generation alongside a tree representing its value.  */
126 struct c_expr
127 {
128   /* The value of the expression.  */
129   tree value;
130   /* Record the original unary/binary operator of an expression, which may
131      have been changed by fold, STRING_CST for unparenthesized string
132      constants, C_MAYBE_CONST_EXPR for __builtin_constant_p calls
133      (even if parenthesized), for subexpressions, and for non-constant
134      initializers, or ERROR_MARK for other expressions (including
135      parenthesized expressions).  */
136   enum tree_code original_code;
137   /* If not NULL, the original type of an expression.  This will
138      differ from the type of the value field for an enum constant.
139      The type of an enum constant is a plain integer type, but this
140      field will be the enum type.  */
141   tree original_type;
142 
143   /* The source range of this expression.  This is redundant
144      for node values that have locations, but not all node kinds
145      have locations (e.g. constants, and references to params, locals,
146      etc), so we stash a copy here.  */
147   source_range src_range;
148 
149   /* Access to the first and last locations within the source spelling
150      of this expression.  */
get_startc_expr151   location_t get_start () const { return src_range.m_start; }
get_finishc_expr152   location_t get_finish () const { return src_range.m_finish; }
153 
get_locationc_expr154   location_t get_location () const
155   {
156     if (EXPR_HAS_LOCATION (value))
157       return EXPR_LOCATION (value);
158     else
159       return make_location (get_start (), get_start (), get_finish ());
160   }
161 
162   /* Set the value to error_mark_node whilst ensuring that src_range
163      is initialized.  */
set_errorc_expr164   void set_error ()
165   {
166     value = error_mark_node;
167     src_range.m_start = UNKNOWN_LOCATION;
168     src_range.m_finish = UNKNOWN_LOCATION;
169   }
170 };
171 
172 /* Type alias for struct c_expr. This allows to use the structure
173    inside the VEC types.  */
174 typedef struct c_expr c_expr_t;
175 
176 /* A kind of type specifier.  Note that this information is currently
177    only used to distinguish tag definitions, tag references and typeof
178    uses.  */
179 enum c_typespec_kind {
180   /* No typespec.  This appears only in struct c_declspec.  */
181   ctsk_none,
182   /* A reserved keyword type specifier.  */
183   ctsk_resword,
184   /* A reference to a tag, previously declared, such as "struct foo".
185      This includes where the previous declaration was as a different
186      kind of tag, in which case this is only valid if shadowing that
187      tag in an inner scope.  */
188   ctsk_tagref,
189   /* A reference to a tag, not previously declared in a visible
190      scope.  */
191   ctsk_tagfirstref,
192   /* A definition of a tag such as "struct foo { int a; }".  */
193   ctsk_tagdef,
194   /* A typedef name.  */
195   ctsk_typedef,
196   /* An ObjC-specific kind of type specifier.  */
197   ctsk_objc,
198   /* A typeof specifier, or _Atomic ( type-name ).  */
199   ctsk_typeof
200 };
201 
202 /* A type specifier: this structure is created in the parser and
203    passed to declspecs_add_type only.  */
204 struct c_typespec {
205   /* What kind of type specifier this is.  */
206   enum c_typespec_kind kind;
207   /* Whether the expression has operands suitable for use in constant
208      expressions.  */
209   bool expr_const_operands;
210   /* The specifier itself.  */
211   tree spec;
212   /* An expression to be evaluated before the type specifier, in the
213      case of typeof specifiers, or NULL otherwise or if no such
214      expression is required for a particular typeof specifier.  In
215      particular, when typeof is applied to an expression of variably
216      modified type, that expression must be evaluated in order to
217      determine array sizes that form part of the type, but the
218      expression itself (as opposed to the array sizes) forms no part
219      of the type and so needs to be recorded separately.  */
220   tree expr;
221 };
222 
223 /* A storage class specifier.  */
224 enum c_storage_class {
225   csc_none,
226   csc_auto,
227   csc_extern,
228   csc_register,
229   csc_static,
230   csc_typedef
231 };
232 
233 /* A type specifier keyword "void", "_Bool", "char", "int", "float",
234    "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum",
235    or none of these.  */
236 enum c_typespec_keyword {
237   cts_none,
238   cts_void,
239   cts_bool,
240   cts_char,
241   cts_int,
242   cts_float,
243   cts_int_n,
244   cts_double,
245   cts_dfloat32,
246   cts_dfloat64,
247   cts_dfloat128,
248   cts_floatn_nx,
249   cts_fract,
250   cts_accum,
251   cts_auto_type
252 };
253 
254 /* This enum lists all the possible declarator specifiers, storage
255    class or attribute that a user can write.  There is at least one
256    enumerator per possible declarator specifier in the struct
257    c_declspecs below.
258 
259    It is used to index the array of declspec locations in struct
260    c_declspecs.  */
261 enum c_declspec_word {
262   cdw_typespec /* A catch-all for a typespec.  */,
263   cdw_storage_class  /* A catch-all for a storage class */,
264   cdw_attributes,
265   cdw_typedef,
266   cdw_explicit_signed,
267   cdw_deprecated,
268   cdw_default_int,
269   cdw_long,
270   cdw_long_long,
271   cdw_short,
272   cdw_signed,
273   cdw_unsigned,
274   cdw_complex,
275   cdw_inline,
276   cdw_noreturn,
277   cdw_thread,
278   cdw_const,
279   cdw_volatile,
280   cdw_restrict,
281   cdw_atomic,
282   cdw_saturating,
283   cdw_alignas,
284   cdw_address_space,
285   cdw_gimple,
286   cdw_rtl,
287   cdw_number_of_elements /* This one must always be the last
288 			    enumerator.  */
289 };
290 
291 /* A sequence of declaration specifiers in C.  When a new declaration
292    specifier is added, please update the enum c_declspec_word above
293    accordingly.  */
294 struct c_declspecs {
295   source_location locations[cdw_number_of_elements];
296   /* The type specified, if a single type specifier such as a struct,
297      union or enum specifier, typedef name or typeof specifies the
298      whole type, or NULL_TREE if none or a keyword such as "void" or
299      "char" is used.  Does not include qualifiers.  */
300   tree type;
301   /* Any expression to be evaluated before the type, from a typeof
302      specifier.  */
303   tree expr;
304   /* The attributes from a typedef decl.  */
305   tree decl_attr;
306   /* When parsing, the attributes.  Outside the parser, this will be
307      NULL; attributes (possibly from multiple lists) will be passed
308      separately.  */
309   tree attrs;
310   /* The pass to start compiling a __GIMPLE or __RTL function with.  */
311   char *gimple_or_rtl_pass;
312   /* The base-2 log of the greatest alignment required by an _Alignas
313      specifier, in bytes, or -1 if no such specifiers with nonzero
314      alignment.  */
315   int align_log;
316   /* For the __intN declspec, this stores the index into the int_n_* arrays.  */
317   int int_n_idx;
318   /* For the _FloatN and _FloatNx declspec, this stores the index into
319      the floatn_nx_types array.  */
320   int floatn_nx_idx;
321   /* The storage class specifier, or csc_none if none.  */
322   enum c_storage_class storage_class;
323   /* Any type specifier keyword used such as "int", not reflecting
324      modifiers such as "short", or cts_none if none.  */
325   ENUM_BITFIELD (c_typespec_keyword) typespec_word : 8;
326   /* The kind of type specifier if one has been seen, ctsk_none
327      otherwise.  */
328   ENUM_BITFIELD (c_typespec_kind) typespec_kind : 3;
329   /* Whether any expressions in typeof specifiers may appear in
330      constant expressions.  */
331   BOOL_BITFIELD expr_const_operands : 1;
332   /* Whether any declaration specifiers have been seen at all.  */
333   BOOL_BITFIELD declspecs_seen_p : 1;
334   /* Whether something other than a storage class specifier or
335      attribute has been seen.  This is used to warn for the
336      obsolescent usage of storage class specifiers other than at the
337      start of the list.  (Doing this properly would require function
338      specifiers to be handled separately from storage class
339      specifiers.)  */
340   BOOL_BITFIELD non_sc_seen_p : 1;
341   /* Whether the type is specified by a typedef or typeof name.  */
342   BOOL_BITFIELD typedef_p : 1;
343   /* Whether the type is explicitly "signed" or specified by a typedef
344      whose type is explicitly "signed".  */
345   BOOL_BITFIELD explicit_signed_p : 1;
346   /* Whether the specifiers include a deprecated typedef.  */
347   BOOL_BITFIELD deprecated_p : 1;
348   /* Whether the type defaulted to "int" because there were no type
349      specifiers.  */
350   BOOL_BITFIELD default_int_p : 1;
351   /* Whether "long" was specified.  */
352   BOOL_BITFIELD long_p : 1;
353   /* Whether "long" was specified more than once.  */
354   BOOL_BITFIELD long_long_p : 1;
355   /* Whether "short" was specified.  */
356   BOOL_BITFIELD short_p : 1;
357   /* Whether "signed" was specified.  */
358   BOOL_BITFIELD signed_p : 1;
359   /* Whether "unsigned" was specified.  */
360   BOOL_BITFIELD unsigned_p : 1;
361   /* Whether "complex" was specified.  */
362   BOOL_BITFIELD complex_p : 1;
363   /* Whether "inline" was specified.  */
364   BOOL_BITFIELD inline_p : 1;
365   /* Whether "_Noreturn" was speciied.  */
366   BOOL_BITFIELD noreturn_p : 1;
367   /* Whether "__thread" or "_Thread_local" was specified.  */
368   BOOL_BITFIELD thread_p : 1;
369   /* Whether "__thread" rather than "_Thread_local" was specified.  */
370   BOOL_BITFIELD thread_gnu_p : 1;
371   /* Whether "const" was specified.  */
372   BOOL_BITFIELD const_p : 1;
373   /* Whether "volatile" was specified.  */
374   BOOL_BITFIELD volatile_p : 1;
375   /* Whether "restrict" was specified.  */
376   BOOL_BITFIELD restrict_p : 1;
377   /* Whether "_Atomic" was specified.  */
378   BOOL_BITFIELD atomic_p : 1;
379   /* Whether "_Sat" was specified.  */
380   BOOL_BITFIELD saturating_p : 1;
381   /* Whether any alignment specifier (even with zero alignment) was
382      specified.  */
383   BOOL_BITFIELD alignas_p : 1;
384   /* Whether any __GIMPLE specifier was specified.  */
385   BOOL_BITFIELD gimple_p : 1;
386   /* Whether any __RTL specifier was specified.  */
387   BOOL_BITFIELD rtl_p : 1;
388   /* The address space that the declaration belongs to.  */
389   addr_space_t address_space;
390 };
391 
392 /* The various kinds of declarators in C.  */
393 enum c_declarator_kind {
394   /* An identifier.  */
395   cdk_id,
396   /* A function.  */
397   cdk_function,
398   /* An array.  */
399   cdk_array,
400   /* A pointer.  */
401   cdk_pointer,
402   /* Parenthesized declarator with nested attributes.  */
403   cdk_attrs
404 };
405 
406 struct c_arg_tag {
407   /* The argument name.  */
408   tree id;
409   /* The type of the argument.  */
410   tree type;
411 };
412 
413 
414 /* Information about the parameters in a function declarator.  */
415 struct c_arg_info {
416   /* A list of parameter decls.  */
417   tree parms;
418   /* A list of structure, union and enum tags defined.  */
419   vec<c_arg_tag, va_gc> *tags;
420   /* A list of argument types to go in the FUNCTION_TYPE.  */
421   tree types;
422   /* A list of non-parameter decls (notably enumeration constants)
423      defined with the parameters.  */
424   tree others;
425   /* A compound expression of VLA sizes from the parameters, or NULL.
426      In a function definition, these are used to ensure that
427      side-effects in sizes of arrays converted to pointers (such as a
428      parameter int i[n++]) take place; otherwise, they are
429      ignored.  */
430   tree pending_sizes;
431   /* True when these arguments had [*].  */
432   BOOL_BITFIELD had_vla_unspec : 1;
433 };
434 
435 /* A declarator.  */
436 struct c_declarator {
437   /* The kind of declarator.  */
438   enum c_declarator_kind kind;
439   location_t id_loc; /* Currently only set for cdk_id, cdk_array. */
440   /* Except for cdk_id, the contained declarator.  For cdk_id, NULL.  */
441   struct c_declarator *declarator;
442   union {
443     /* For identifiers, an IDENTIFIER_NODE or NULL_TREE if an abstract
444        declarator.  */
445     tree id;
446     /* For functions.  */
447     struct c_arg_info *arg_info;
448     /* For arrays.  */
449     struct {
450       /* The array dimension, or NULL for [] and [*].  */
451       tree dimen;
452       /* The qualifiers inside [].  */
453       int quals;
454       /* The attributes (currently ignored) inside [].  */
455       tree attrs;
456       /* Whether [static] was used.  */
457       BOOL_BITFIELD static_p : 1;
458       /* Whether [*] was used.  */
459       BOOL_BITFIELD vla_unspec_p : 1;
460     } array;
461     /* For pointers, the qualifiers on the pointer type.  */
462     int pointer_quals;
463     /* For attributes.  */
464     tree attrs;
465   } u;
466 };
467 
468 /* A type name.  */
469 struct c_type_name {
470   /* The declaration specifiers.  */
471   struct c_declspecs *specs;
472   /* The declarator.  */
473   struct c_declarator *declarator;
474 };
475 
476 /* A parameter.  */
477 struct c_parm {
478   /* The declaration specifiers, minus any prefix attributes.  */
479   struct c_declspecs *specs;
480   /* The attributes.  */
481   tree attrs;
482   /* The declarator.  */
483   struct c_declarator *declarator;
484   /* The location of the parameter.  */
485   location_t loc;
486 };
487 
488 /* Used when parsing an enum.  Initialized by start_enum.  */
489 struct c_enum_contents
490 {
491   /* While defining an enum type, this is 1 plus the last enumerator
492      constant value.  */
493   tree enum_next_value;
494 
495   /* Nonzero means that there was overflow computing enum_next_value.  */
496   int enum_overflow;
497 };
498 
499 /* A type of reference to a static identifier in an inline
500    function.  */
501 enum c_inline_static_type {
502   /* Identifier with internal linkage used in function that may be an
503      inline definition (i.e., file-scope static).  */
504   csi_internal,
505   /* Modifiable object with static storage duration defined in
506      function that may be an inline definition (i.e., local
507      static).  */
508   csi_modifiable
509 };
510 
511 
512 /* in c-parser.c */
513 extern void c_parse_init (void);
514 extern bool c_keyword_starts_typename (enum rid keyword);
515 
516 /* in c-aux-info.c */
517 extern void gen_aux_info_record (tree, int, int, int);
518 
519 /* in c-decl.c */
520 struct c_spot_bindings;
521 struct c_struct_parse_info;
522 extern struct obstack parser_obstack;
523 extern tree c_break_label;
524 extern tree c_cont_label;
525 
526 extern bool global_bindings_p (void);
527 extern tree pushdecl (tree);
528 extern void push_scope (void);
529 extern tree pop_scope (void);
530 extern void c_bindings_start_stmt_expr (struct c_spot_bindings *);
531 extern void c_bindings_end_stmt_expr (struct c_spot_bindings *);
532 
533 extern void record_inline_static (location_t, tree, tree,
534 				  enum c_inline_static_type);
535 extern void c_init_decl_processing (void);
536 extern void c_print_identifier (FILE *, tree, int);
537 extern int quals_from_declspecs (const struct c_declspecs *);
538 extern struct c_declarator *build_array_declarator (location_t, tree,
539     						    struct c_declspecs *,
540 						    bool, bool);
541 extern tree build_enumerator (location_t, location_t, struct c_enum_contents *,
542 			      tree, tree);
543 extern tree check_for_loop_decls (location_t, bool);
544 extern void mark_forward_parm_decls (void);
545 extern void declare_parm_level (void);
546 extern void undeclared_variable (location_t, tree);
547 extern tree lookup_label_for_goto (location_t, tree);
548 extern tree declare_label (tree);
549 extern tree define_label (location_t, tree);
550 extern struct c_spot_bindings *c_get_switch_bindings (void);
551 extern void c_release_switch_bindings (struct c_spot_bindings *);
552 extern bool c_check_switch_jump_warnings (struct c_spot_bindings *,
553 					  location_t, location_t);
554 extern void finish_decl (tree, location_t, tree, tree, tree);
555 extern tree finish_enum (tree, tree, tree);
556 extern void finish_function (void);
557 extern tree finish_struct (location_t, tree, tree, tree,
558 			   struct c_struct_parse_info *);
559 extern struct c_arg_info *build_arg_info (void);
560 extern struct c_arg_info *get_parm_info (bool, tree);
561 extern tree grokfield (location_t, struct c_declarator *,
562 		       struct c_declspecs *, tree, tree *);
563 extern tree groktypename (struct c_type_name *, tree *, bool *);
564 extern tree grokparm (const struct c_parm *, tree *);
565 extern tree implicitly_declare (location_t, tree);
566 extern void keep_next_level (void);
567 extern void pending_xref_error (void);
568 extern void c_push_function_context (void);
569 extern void c_pop_function_context (void);
570 extern void push_parm_decl (const struct c_parm *, tree *);
571 extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
572 							struct c_declarator *);
573 extern tree c_builtin_function (tree);
574 extern tree c_builtin_function_ext_scope (tree);
575 extern void shadow_tag (const struct c_declspecs *);
576 extern void shadow_tag_warned (const struct c_declspecs *, int);
577 extern tree start_enum (location_t, struct c_enum_contents *, tree);
578 extern bool start_function (struct c_declspecs *, struct c_declarator *, tree);
579 extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
580 			tree);
581 extern tree start_struct (location_t, enum tree_code, tree,
582 			  struct c_struct_parse_info **);
583 extern void store_parm_decls (void);
584 extern void store_parm_decls_from (struct c_arg_info *);
585 extern void temp_store_parm_decls (tree, tree);
586 extern void temp_pop_parm_decls (void);
587 extern tree xref_tag (enum tree_code, tree);
588 extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree);
589 extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
590 				    struct c_declarator *, location_t);
591 extern struct c_declarator *build_attrs_declarator (tree,
592 						    struct c_declarator *);
593 extern struct c_declarator *build_function_declarator (struct c_arg_info *,
594 						       struct c_declarator *);
595 extern struct c_declarator *build_id_declarator (tree);
596 extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
597 						     struct c_declarator *);
598 extern struct c_declspecs *build_null_declspecs (void);
599 extern struct c_declspecs *declspecs_add_qual (source_location,
600 					       struct c_declspecs *, tree);
601 extern struct c_declspecs *declspecs_add_type (location_t,
602 					       struct c_declspecs *,
603 					       struct c_typespec);
604 extern struct c_declspecs *declspecs_add_scspec (source_location,
605 						 struct c_declspecs *, tree);
606 extern struct c_declspecs *declspecs_add_attrs (source_location,
607 						struct c_declspecs *, tree);
608 extern struct c_declspecs *declspecs_add_addrspace (source_location,
609 						    struct c_declspecs *,
610 						    addr_space_t);
611 extern struct c_declspecs *declspecs_add_alignas (source_location,
612 						  struct c_declspecs *, tree);
613 extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
614 
615 /* in c-objc-common.c */
616 extern bool c_objc_common_init (void);
617 extern bool c_missing_noreturn_ok_p (tree);
618 extern bool c_warn_unused_global_decl (const_tree);
619 extern void c_initialize_diagnostics (diagnostic_context *);
620 extern bool c_vla_unspec_p (tree x, tree fn);
621 
622 /* in c-typeck.c */
623 extern int in_alignof;
624 extern int in_sizeof;
625 extern int in_typeof;
626 
627 extern tree c_last_sizeof_arg;
628 extern location_t c_last_sizeof_loc;
629 
630 extern struct c_switch *c_switch_stack;
631 
632 extern tree c_objc_common_truthvalue_conversion (location_t, tree);
633 extern tree require_complete_type (location_t, tree);
634 extern bool same_translation_unit_p (const_tree, const_tree);
635 extern int comptypes (tree, tree);
636 extern int comptypes_check_different_types (tree, tree, bool *);
637 extern bool c_vla_type_p (const_tree);
638 extern bool c_mark_addressable (tree, bool = false);
639 extern void c_incomplete_type_error (location_t, const_tree, const_tree);
640 extern tree c_type_promotes_to (tree);
641 extern struct c_expr default_function_array_conversion (location_t,
642 							struct c_expr);
643 extern struct c_expr default_function_array_read_conversion (location_t,
644 							     struct c_expr);
645 extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr,
646 					       bool, bool);
647 extern tree decl_constant_value_1 (tree, bool);
648 extern void mark_exp_read (tree);
649 extern tree composite_type (tree, tree);
650 extern tree build_component_ref (location_t, tree, tree, location_t);
651 extern tree build_array_ref (location_t, tree, tree);
652 extern tree build_external_ref (location_t, tree, bool, tree *);
653 extern void pop_maybe_used (bool);
654 extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr);
655 extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *);
656 extern struct c_expr parser_build_unary_op (location_t, enum tree_code,
657     					    struct c_expr);
658 extern struct c_expr parser_build_binary_op (location_t,
659     					     enum tree_code, struct c_expr,
660 					     struct c_expr);
661 extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
662 				    location_t, tree, tree, location_t);
663 extern tree build_compound_expr (location_t, tree, tree);
664 extern tree c_cast_expr (location_t, struct c_type_name *, tree);
665 extern tree build_c_cast (location_t, tree, tree);
666 extern void store_init_value (location_t, tree, tree, tree);
667 extern void maybe_warn_string_init (location_t, tree, struct c_expr);
668 extern void start_init (tree, tree, int, rich_location *);
669 extern void finish_init (void);
670 extern void really_start_incremental_init (tree);
671 extern void finish_implicit_inits (location_t, struct obstack *);
672 extern void push_init_level (location_t, int, struct obstack *);
673 extern struct c_expr pop_init_level (location_t, int, struct obstack *,
674 				     location_t);
675 extern void set_init_index (location_t, tree, tree, struct obstack *);
676 extern void set_init_label (location_t, tree, location_t, struct obstack *);
677 extern void process_init_element (location_t, struct c_expr, bool,
678 				  struct obstack *);
679 extern tree build_compound_literal (location_t, tree, tree, bool,
680 				    unsigned int);
681 extern void check_compound_literal_type (location_t, struct c_type_name *);
682 extern tree c_start_case (location_t, location_t, tree, bool);
683 extern void c_finish_case (tree, tree);
684 extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool,
685 			    bool);
686 extern tree build_asm_stmt (bool, tree);
687 extern int c_types_compatible_p (tree, tree);
688 extern tree c_begin_compound_stmt (bool);
689 extern tree c_end_compound_stmt (location_t, tree, bool);
690 extern void c_finish_if_stmt (location_t, tree, tree, tree);
691 extern void c_finish_loop (location_t, location_t, tree, location_t, tree,
692 			   tree, tree, tree, bool);
693 extern tree c_begin_stmt_expr (void);
694 extern tree c_finish_stmt_expr (location_t, tree);
695 extern tree c_process_expr_stmt (location_t, tree);
696 extern tree c_finish_expr_stmt (location_t, tree);
697 extern tree c_finish_return (location_t, tree, tree);
698 extern tree c_finish_bc_stmt (location_t, tree *, bool);
699 extern tree c_finish_goto_label (location_t, tree);
700 extern tree c_finish_goto_ptr (location_t, tree);
701 extern tree c_expr_to_decl (tree, bool *, bool *);
702 extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree);
703 extern tree c_finish_oacc_data (location_t, tree, tree);
704 extern tree c_finish_oacc_host_data (location_t, tree, tree);
705 extern tree c_begin_omp_parallel (void);
706 extern tree c_finish_omp_parallel (location_t, tree, tree);
707 extern tree c_begin_omp_task (void);
708 extern tree c_finish_omp_task (location_t, tree, tree);
709 extern void c_finish_omp_cancel (location_t, tree);
710 extern void c_finish_omp_cancellation_point (location_t, tree);
711 extern tree c_finish_omp_clauses (tree, enum c_omp_region_type);
712 extern tree c_build_va_arg (location_t, tree, location_t, tree);
713 extern tree c_finish_transaction (location_t, tree, int);
714 extern bool c_tree_equal (tree, tree);
715 extern tree c_build_function_call_vec (location_t, vec<location_t>, tree,
716 				       vec<tree, va_gc> *, vec<tree, va_gc> *);
717 extern tree c_omp_clause_copy_ctor (tree, tree, tree);
718 
719 /* Set to 0 at beginning of a function definition, set to 1 if
720    a return statement that specifies a return value is seen.  */
721 
722 extern int current_function_returns_value;
723 
724 /* Set to 0 at beginning of a function definition, set to 1 if
725    a return statement with no argument is seen.  */
726 
727 extern int current_function_returns_null;
728 
729 /* Set to 0 at beginning of a function definition, set to 1 if
730    a call to a noreturn function is seen.  */
731 
732 extern int current_function_returns_abnormally;
733 
734 /* In c-decl.c */
735 
736 /* Tell the binding oracle what kind of binding we are looking for.  */
737 
738 enum c_oracle_request
739 {
740   C_ORACLE_SYMBOL,
741   C_ORACLE_TAG,
742   C_ORACLE_LABEL
743 };
744 
745 /* If this is non-NULL, then it is a "binding oracle" which can lazily
746    create bindings when needed by the C compiler.  The oracle is told
747    the name and type of the binding to create.  It can call pushdecl
748    or the like to ensure the binding is visible; or do nothing,
749    leaving the binding untouched.  c-decl.c takes note of when the
750    oracle has been called and will not call it again if it fails to
751    create a given binding.  */
752 
753 typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier);
754 
755 extern c_binding_oracle_function *c_binding_oracle;
756 
757 extern void c_finish_incomplete_decl (tree);
758 extern tree c_omp_reduction_id (enum tree_code, tree);
759 extern tree c_omp_reduction_decl (tree);
760 extern tree c_omp_reduction_lookup (tree, tree);
761 extern tree c_check_omp_declare_reduction_r (tree *, int *, void *);
762 extern void c_pushtag (location_t, tree, tree);
763 extern void c_bind (location_t, tree, bool);
764 extern bool tag_exists_p (enum tree_code, tree);
765 
766 /* In c-errors.c */
767 extern bool pedwarn_c90 (location_t, int opt, const char *, ...)
768     ATTRIBUTE_GCC_DIAG(3,4);
769 extern bool pedwarn_c99 (location_t, int opt, const char *, ...)
770     ATTRIBUTE_GCC_DIAG(3,4);
771 
772 extern void
773 set_c_expr_source_range (c_expr *expr,
774 			 location_t start, location_t finish);
775 
776 extern void
777 set_c_expr_source_range (c_expr *expr,
778 			 source_range src_range);
779 
780 /* In c-fold.c */
781 extern vec<tree> incomplete_record_decls;
782 
783 #if CHECKING_P
784 namespace selftest {
785   extern void run_c_tests (void);
786 } // namespace selftest
787 #endif /* #if CHECKING_P */
788 
789 
790 #endif /* ! GCC_C_TREE_H */
791