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