Daily bump.
[official-gcc.git] / gcc / c / c-tree.h
blobae1a1e60d4bf4626accf2235dff8213b3502cc5f
1 /* Definitions for C parsing and type checking.
2 Copyright (C) 1987-2018 Free Software Foundation, Inc.
4 This file is part of GCC.
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.
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.
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/>. */
20 #ifndef GCC_C_TREE_H
21 #define GCC_C_TREE_H
23 #include "c-family/c-common.h"
24 #include "diagnostic.h"
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 *))
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)
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)
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)
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)
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)
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)
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)
58 /* Record whether an "incomplete type" error was given for the type. */
59 #define C_TYPE_ERROR_REPORTED(TYPE) TYPE_LANG_FLAG_3 (TYPE)
61 /* Record whether a typedef for type `int' was actually `signed int'. */
62 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
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)
68 /* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */
69 #define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
71 /* For a PARM_DECL, nonzero if it was declared as an array. */
72 #define C_ARRAY_PARAMETER(NODE) DECL_LANG_FLAG_0 (NODE)
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))
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))
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)
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))
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))
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)))
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)
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))
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))
120 /* Record parser information about an expression that is irrelevant
121 for code generation alongside a tree representing its value. */
122 struct c_expr
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;
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;
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; }
150 location_t get_location () const
152 if (EXPR_HAS_LOCATION (value))
153 return EXPR_LOCATION (value);
154 else
155 return make_location (get_start (), get_start (), get_finish ());
158 /* Set the value to error_mark_node whilst ensuring that src_range
159 is initialized. */
160 void set_error ()
162 value = error_mark_node;
163 src_range.m_start = UNKNOWN_LOCATION;
164 src_range.m_finish = UNKNOWN_LOCATION;
168 /* Type alias for struct c_expr. This allows to use the structure
169 inside the VEC types. */
170 typedef struct c_expr c_expr_t;
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. */
175 enum 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
198 /* A type specifier: this structure is created in the parser and
199 passed to declspecs_add_type only. */
200 struct 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;
219 /* A storage class specifier. */
220 enum c_storage_class {
221 csc_none,
222 csc_auto,
223 csc_extern,
224 csc_register,
225 csc_static,
226 csc_typedef
229 /* A type specifier keyword "void", "_Bool", "char", "int", "float",
230 "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum",
231 or none of these. */
232 enum 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
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.
255 It is used to index the array of declspec locations in struct
256 c_declspecs. */
257 enum 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. */
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. */
290 struct 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;
388 /* The various kinds of declarators in C. */
389 enum 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
402 struct c_arg_tag {
403 /* The argument name. */
404 tree id;
405 /* The type of the argument. */
406 tree type;
410 /* Information about the parameters in a function declarator. */
411 struct 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;
431 /* A declarator. */
432 struct 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;
464 /* A type name. */
465 struct c_type_name {
466 /* The declaration specifiers. */
467 struct c_declspecs *specs;
468 /* The declarator. */
469 struct c_declarator *declarator;
472 /* A parameter. */
473 struct 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;
484 /* Used when parsing an enum. Initialized by start_enum. */
485 struct c_enum_contents
487 /* While defining an enum type, this is 1 plus the last enumerator
488 constant value. */
489 tree enum_next_value;
491 /* Nonzero means that there was overflow computing enum_next_value. */
492 int enum_overflow;
495 /* A type of reference to a static identifier in an inline
496 function. */
497 enum 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
508 /* in c-parser.c */
509 extern void c_parse_init (void);
510 extern bool c_keyword_starts_typename (enum rid keyword);
512 /* in c-aux-info.c */
513 extern void gen_aux_info_record (tree, int, int, int);
515 /* in c-decl.c */
516 struct c_spot_bindings;
517 struct c_struct_parse_info;
518 extern struct obstack parser_obstack;
519 extern tree c_break_label;
520 extern tree c_cont_label;
522 extern bool global_bindings_p (void);
523 extern tree pushdecl (tree);
524 extern void push_scope (void);
525 extern tree pop_scope (void);
526 extern void c_bindings_start_stmt_expr (struct c_spot_bindings *);
527 extern void c_bindings_end_stmt_expr (struct c_spot_bindings *);
529 extern void record_inline_static (location_t, tree, tree,
530 enum c_inline_static_type);
531 extern void c_init_decl_processing (void);
532 extern void c_print_identifier (FILE *, tree, int);
533 extern int quals_from_declspecs (const struct c_declspecs *);
534 extern struct c_declarator *build_array_declarator (location_t, tree,
535 struct c_declspecs *,
536 bool, bool);
537 extern tree build_enumerator (location_t, location_t, struct c_enum_contents *,
538 tree, tree);
539 extern tree check_for_loop_decls (location_t, bool);
540 extern void mark_forward_parm_decls (void);
541 extern void declare_parm_level (void);
542 extern void undeclared_variable (location_t, tree);
543 extern tree lookup_label_for_goto (location_t, tree);
544 extern tree declare_label (tree);
545 extern tree define_label (location_t, tree);
546 extern struct c_spot_bindings *c_get_switch_bindings (void);
547 extern void c_release_switch_bindings (struct c_spot_bindings *);
548 extern bool c_check_switch_jump_warnings (struct c_spot_bindings *,
549 location_t, location_t);
550 extern void finish_decl (tree, location_t, tree, tree, tree);
551 extern tree finish_enum (tree, tree, tree);
552 extern void finish_function (void);
553 extern tree finish_struct (location_t, tree, tree, tree,
554 struct c_struct_parse_info *);
555 extern struct c_arg_info *build_arg_info (void);
556 extern struct c_arg_info *get_parm_info (bool, tree);
557 extern tree grokfield (location_t, struct c_declarator *,
558 struct c_declspecs *, tree, tree *);
559 extern tree groktypename (struct c_type_name *, tree *, bool *);
560 extern tree grokparm (const struct c_parm *, tree *);
561 extern tree implicitly_declare (location_t, tree);
562 extern void keep_next_level (void);
563 extern void pending_xref_error (void);
564 extern void c_push_function_context (void);
565 extern void c_pop_function_context (void);
566 extern void push_parm_decl (const struct c_parm *, tree *);
567 extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
568 struct c_declarator *);
569 extern tree c_builtin_function (tree);
570 extern tree c_builtin_function_ext_scope (tree);
571 extern void shadow_tag (const struct c_declspecs *);
572 extern void shadow_tag_warned (const struct c_declspecs *, int);
573 extern tree start_enum (location_t, struct c_enum_contents *, tree);
574 extern bool start_function (struct c_declspecs *, struct c_declarator *, tree);
575 extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
576 tree);
577 extern tree start_struct (location_t, enum tree_code, tree,
578 struct c_struct_parse_info **);
579 extern void store_parm_decls (void);
580 extern void store_parm_decls_from (struct c_arg_info *);
581 extern void temp_store_parm_decls (tree, tree);
582 extern void temp_pop_parm_decls (void);
583 extern tree xref_tag (enum tree_code, tree);
584 extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree);
585 extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
586 struct c_declarator *, location_t);
587 extern struct c_declarator *build_attrs_declarator (tree,
588 struct c_declarator *);
589 extern struct c_declarator *build_function_declarator (struct c_arg_info *,
590 struct c_declarator *);
591 extern struct c_declarator *build_id_declarator (tree);
592 extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
593 struct c_declarator *);
594 extern struct c_declspecs *build_null_declspecs (void);
595 extern struct c_declspecs *declspecs_add_qual (source_location,
596 struct c_declspecs *, tree);
597 extern struct c_declspecs *declspecs_add_type (location_t,
598 struct c_declspecs *,
599 struct c_typespec);
600 extern struct c_declspecs *declspecs_add_scspec (source_location,
601 struct c_declspecs *, tree);
602 extern struct c_declspecs *declspecs_add_attrs (source_location,
603 struct c_declspecs *, tree);
604 extern struct c_declspecs *declspecs_add_addrspace (source_location,
605 struct c_declspecs *,
606 addr_space_t);
607 extern struct c_declspecs *declspecs_add_alignas (source_location,
608 struct c_declspecs *, tree);
609 extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
611 /* in c-objc-common.c */
612 extern bool c_objc_common_init (void);
613 extern bool c_missing_noreturn_ok_p (tree);
614 extern bool c_warn_unused_global_decl (const_tree);
615 extern void c_initialize_diagnostics (diagnostic_context *);
616 extern bool c_vla_unspec_p (tree x, tree fn);
618 /* in c-typeck.c */
619 extern int in_alignof;
620 extern int in_sizeof;
621 extern int in_typeof;
623 extern tree c_last_sizeof_arg;
624 extern location_t c_last_sizeof_loc;
626 extern struct c_switch *c_switch_stack;
628 extern tree c_objc_common_truthvalue_conversion (location_t, tree);
629 extern tree require_complete_type (location_t, tree);
630 extern bool same_translation_unit_p (const_tree, const_tree);
631 extern int comptypes (tree, tree);
632 extern int comptypes_check_different_types (tree, tree, bool *);
633 extern bool c_vla_type_p (const_tree);
634 extern bool c_mark_addressable (tree, bool = false);
635 extern void c_incomplete_type_error (location_t, const_tree, const_tree);
636 extern tree c_type_promotes_to (tree);
637 extern struct c_expr default_function_array_conversion (location_t,
638 struct c_expr);
639 extern struct c_expr default_function_array_read_conversion (location_t,
640 struct c_expr);
641 extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr,
642 bool, bool);
643 extern tree decl_constant_value_1 (tree, bool);
644 extern void mark_exp_read (tree);
645 extern tree composite_type (tree, tree);
646 extern tree build_component_ref (location_t, tree, tree, location_t);
647 extern tree build_array_ref (location_t, tree, tree);
648 extern tree build_external_ref (location_t, tree, bool, tree *);
649 extern void pop_maybe_used (bool);
650 extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr);
651 extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *);
652 extern struct c_expr parser_build_unary_op (location_t, enum tree_code,
653 struct c_expr);
654 extern struct c_expr parser_build_binary_op (location_t,
655 enum tree_code, struct c_expr,
656 struct c_expr);
657 extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
658 location_t, tree, tree, location_t);
659 extern tree build_compound_expr (location_t, tree, tree);
660 extern tree c_cast_expr (location_t, struct c_type_name *, tree);
661 extern tree build_c_cast (location_t, tree, tree);
662 extern void store_init_value (location_t, tree, tree, tree);
663 extern void maybe_warn_string_init (location_t, tree, struct c_expr);
664 extern void start_init (tree, tree, int, rich_location *);
665 extern void finish_init (void);
666 extern void really_start_incremental_init (tree);
667 extern void finish_implicit_inits (location_t, struct obstack *);
668 extern void push_init_level (location_t, int, struct obstack *);
669 extern struct c_expr pop_init_level (location_t, int, struct obstack *,
670 location_t);
671 extern void set_init_index (location_t, tree, tree, struct obstack *);
672 extern void set_init_label (location_t, tree, location_t, struct obstack *);
673 extern void process_init_element (location_t, struct c_expr, bool,
674 struct obstack *);
675 extern tree build_compound_literal (location_t, tree, tree, bool,
676 unsigned int);
677 extern void check_compound_literal_type (location_t, struct c_type_name *);
678 extern tree c_start_case (location_t, location_t, tree, bool);
679 extern void c_finish_case (tree, tree);
680 extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool);
681 extern tree build_asm_stmt (tree, tree);
682 extern int c_types_compatible_p (tree, tree);
683 extern tree c_begin_compound_stmt (bool);
684 extern tree c_end_compound_stmt (location_t, tree, bool);
685 extern void c_finish_if_stmt (location_t, tree, tree, tree);
686 extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool);
687 extern tree c_begin_stmt_expr (void);
688 extern tree c_finish_stmt_expr (location_t, tree);
689 extern tree c_process_expr_stmt (location_t, tree);
690 extern tree c_finish_expr_stmt (location_t, tree);
691 extern tree c_finish_return (location_t, tree, tree);
692 extern tree c_finish_bc_stmt (location_t, tree *, bool);
693 extern tree c_finish_goto_label (location_t, tree);
694 extern tree c_finish_goto_ptr (location_t, tree);
695 extern tree c_expr_to_decl (tree, bool *, bool *);
696 extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree);
697 extern tree c_finish_oacc_data (location_t, tree, tree);
698 extern tree c_finish_oacc_host_data (location_t, tree, tree);
699 extern tree c_begin_omp_parallel (void);
700 extern tree c_finish_omp_parallel (location_t, tree, tree);
701 extern tree c_begin_omp_task (void);
702 extern tree c_finish_omp_task (location_t, tree, tree);
703 extern void c_finish_omp_cancel (location_t, tree);
704 extern void c_finish_omp_cancellation_point (location_t, tree);
705 extern tree c_finish_omp_clauses (tree, enum c_omp_region_type);
706 extern tree c_build_va_arg (location_t, tree, location_t, tree);
707 extern tree c_finish_transaction (location_t, tree, int);
708 extern bool c_tree_equal (tree, tree);
709 extern tree c_build_function_call_vec (location_t, vec<location_t>, tree,
710 vec<tree, va_gc> *, vec<tree, va_gc> *);
711 extern tree c_omp_clause_copy_ctor (tree, tree, tree);
713 /* Set to 0 at beginning of a function definition, set to 1 if
714 a return statement that specifies a return value is seen. */
716 extern int current_function_returns_value;
718 /* Set to 0 at beginning of a function definition, set to 1 if
719 a return statement with no argument is seen. */
721 extern int current_function_returns_null;
723 /* Set to 0 at beginning of a function definition, set to 1 if
724 a call to a noreturn function is seen. */
726 extern int current_function_returns_abnormally;
728 /* In c-decl.c */
730 /* Tell the binding oracle what kind of binding we are looking for. */
732 enum c_oracle_request
734 C_ORACLE_SYMBOL,
735 C_ORACLE_TAG,
736 C_ORACLE_LABEL
739 /* If this is non-NULL, then it is a "binding oracle" which can lazily
740 create bindings when needed by the C compiler. The oracle is told
741 the name and type of the binding to create. It can call pushdecl
742 or the like to ensure the binding is visible; or do nothing,
743 leaving the binding untouched. c-decl.c takes note of when the
744 oracle has been called and will not call it again if it fails to
745 create a given binding. */
747 typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier);
749 extern c_binding_oracle_function *c_binding_oracle;
751 extern void c_finish_incomplete_decl (tree);
752 extern tree c_omp_reduction_id (enum tree_code, tree);
753 extern tree c_omp_reduction_decl (tree);
754 extern tree c_omp_reduction_lookup (tree, tree);
755 extern tree c_check_omp_declare_reduction_r (tree *, int *, void *);
756 extern void c_pushtag (location_t, tree, tree);
757 extern void c_bind (location_t, tree, bool);
758 extern bool tag_exists_p (enum tree_code, tree);
760 /* In c-errors.c */
761 extern bool pedwarn_c90 (location_t, int opt, const char *, ...)
762 ATTRIBUTE_GCC_DIAG(3,4);
763 extern bool pedwarn_c99 (location_t, int opt, const char *, ...)
764 ATTRIBUTE_GCC_DIAG(3,4);
766 extern void
767 set_c_expr_source_range (c_expr *expr,
768 location_t start, location_t finish);
770 extern void
771 set_c_expr_source_range (c_expr *expr,
772 source_range src_range);
774 /* In c-fold.c */
775 extern vec<tree> incomplete_record_decls;
777 #if CHECKING_P
778 namespace selftest {
779 extern void run_c_tests (void);
780 } // namespace selftest
781 #endif /* #if CHECKING_P */
784 #endif /* ! GCC_C_TREE_H */