Fix gnat.dg/opt39.adb on hppa.
[official-gcc.git] / gcc / c / c-tree.h
blobe6b6fe9a40e7cd94df73af4bd283c72fcd8e5175
1 /* Definitions for C parsing and type checking.
2 Copyright (C) 1987-2023 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.cc, but langhooks.cc needs to
27 know how big it is. This is sanity-checked in c-decl.cc. */
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, nonzero if any component is
38 volatile, restrict-qualified or atomic; that is, has a type not
39 permitted for a constexpr object. */
40 #define C_TYPE_FIELDS_NON_CONSTEXPR(TYPE) TREE_LANG_FLAG_4 (TYPE)
42 /* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE
43 nonzero if the definition of the type has already started. */
44 #define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE)
46 /* In an incomplete RECORD_TYPE, UNION_TYPE or ENUMERAL_TYPE, a list of
47 variable declarations whose type would be completed by completing
48 that type. */
49 #define C_TYPE_INCOMPLETE_VARS(TYPE) \
50 TYPE_LANG_SLOT_1 (TREE_CHECK4 (TYPE, RECORD_TYPE, UNION_TYPE, \
51 QUAL_UNION_TYPE, ENUMERAL_TYPE))
53 /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
54 keyword. C_RID_CODE (node) is then the RID_* value of the keyword. */
55 #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
57 /* Record whether a type or decl was written with nonconstant size.
58 Note that TYPE_SIZE may have simplified to a constant. */
59 #define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
60 #define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
62 /* Record whether a type is variably modified. */
63 #define C_TYPE_VARIABLY_MODIFIED(TYPE) TYPE_LANG_FLAG_6 (TYPE)
66 /* Record whether a type is defined inside a struct or union type.
67 This is used for -Wc++-compat. */
68 #define C_TYPE_DEFINED_IN_STRUCT(TYPE) TYPE_LANG_FLAG_2 (TYPE)
70 /* Record whether a typedef for type `int' was actually `signed int'. */
71 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
73 /* For a FUNCTION_DECL, nonzero if it was defined without an explicit
74 return type. */
75 #define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP)
77 /* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */
78 #define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
80 /* For a PARM_DECL, nonzero if it was declared as an array. */
81 #define C_ARRAY_PARAMETER(NODE) DECL_LANG_FLAG_0 (NODE)
83 /* For FUNCTION_DECLs, evaluates true if the decl is built-in but has
84 been declared. */
85 #define C_DECL_DECLARED_BUILTIN(EXP) \
86 DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (EXP))
88 /* For FUNCTION_DECLs, evaluates true if the decl is built-in, has a
89 built-in prototype and does not have a non-built-in prototype. */
90 #define C_DECL_BUILTIN_PROTOTYPE(EXP) \
91 DECL_LANG_FLAG_6 (FUNCTION_DECL_CHECK (EXP))
93 /* Record whether a decl was declared register. This is strictly a
94 front-end flag, whereas DECL_REGISTER is used for code generation;
95 they may differ for structures with volatile fields. */
96 #define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP)
98 /* Record whether a decl was used in an expression anywhere except an
99 unevaluated operand of sizeof / typeof / alignof. This is only
100 used for functions declared static but not defined, though outside
101 sizeof and typeof it is set for other function decls as well. */
102 #define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (EXP))
104 /* Record whether a variable has been declared threadprivate by
105 #pragma omp threadprivate. */
106 #define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL))
108 /* Set on VAR_DECLs for compound literals. */
109 #define C_DECL_COMPOUND_LITERAL_P(DECL) \
110 DECL_LANG_FLAG_5 (VAR_DECL_CHECK (DECL))
112 /* Set on decls used as placeholders for a C2x underspecified object
113 definition. */
114 #define C_DECL_UNDERSPECIFIED(DECL) DECL_LANG_FLAG_7 (DECL)
116 /* Set on VAR_DECLs declared as 'constexpr'. */
117 #define C_DECL_DECLARED_CONSTEXPR(DECL) \
118 DECL_LANG_FLAG_8 (VAR_DECL_CHECK (DECL))
120 /* Nonzero for a decl which either doesn't exist or isn't a prototype.
121 N.B. Could be simplified if all built-in decls had complete prototypes
122 (but this is presently difficult because some of them need FILE*). */
123 #define C_DECL_ISNT_PROTOTYPE(EXP) \
124 (EXP == 0 \
125 || (!prototype_p (TREE_TYPE (EXP)) \
126 && !fndecl_built_in_p (EXP)))
128 /* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
129 TYPE_ARG_TYPES for functions with prototypes, but created for functions
130 without prototypes. */
131 #define TYPE_ACTUAL_ARG_TYPES(NODE) \
132 TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE))
134 /* For a CONSTRUCTOR, whether some initializer contains a
135 subexpression meaning it is not a constant expression. */
136 #define CONSTRUCTOR_NON_CONST(EXPR) TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (EXPR))
138 /* For a SAVE_EXPR, nonzero if the operand of the SAVE_EXPR has already
139 been folded. */
140 #define SAVE_EXPR_FOLDED_P(EXP) TREE_LANG_FLAG_1 (SAVE_EXPR_CHECK (EXP))
142 /* Whether a type has boolean semantics: either a boolean type or an
143 enumeration type with a boolean type as its underlying type. */
144 #define C_BOOLEAN_TYPE_P(TYPE) \
145 (TREE_CODE (TYPE) == BOOLEAN_TYPE \
146 || (TREE_CODE (TYPE) == ENUMERAL_TYPE \
147 && ENUM_UNDERLYING_TYPE (TYPE) != NULL_TREE \
148 && TREE_CODE (ENUM_UNDERLYING_TYPE (TYPE)) == BOOLEAN_TYPE))
150 /* Record parser information about an expression that is irrelevant
151 for code generation alongside a tree representing its value. */
152 struct c_expr
154 /* The value of the expression. */
155 tree value;
156 /* Record the original unary/binary operator of an expression, which may
157 have been changed by fold, STRING_CST for unparenthesized string
158 constants, C_MAYBE_CONST_EXPR for __builtin_constant_p calls
159 (even if parenthesized), for subexpressions, and for non-constant
160 initializers, or ERROR_MARK for other expressions (including
161 parenthesized expressions). */
162 enum tree_code original_code;
163 /* If not NULL, the original type of an expression. This will
164 differ from the type of the value field for an enum constant.
165 The type of an enum constant is a plain integer type, but this
166 field will be the enum type. */
167 tree original_type;
169 /* The source range of this expression. This is redundant
170 for node values that have locations, but not all node kinds
171 have locations (e.g. constants, and references to params, locals,
172 etc), so we stash a copy here. */
173 source_range src_range;
175 /* True if this was directly from a decimal constant token. */
176 bool m_decimal : 1;
178 /* Access to the first and last locations within the source spelling
179 of this expression. */
180 location_t get_start () const { return src_range.m_start; }
181 location_t get_finish () const { return src_range.m_finish; }
183 location_t get_location () const
185 if (EXPR_HAS_LOCATION (value))
186 return EXPR_LOCATION (value);
187 else
188 return make_location (get_start (), get_start (), get_finish ());
191 /* Set the value to error_mark_node whilst ensuring that src_range
192 and m_decimal are initialized. */
193 void set_error ()
195 value = error_mark_node;
196 src_range.m_start = UNKNOWN_LOCATION;
197 src_range.m_finish = UNKNOWN_LOCATION;
198 m_decimal = 0;
202 /* Type alias for struct c_expr. This allows to use the structure
203 inside the VEC types. */
204 typedef struct c_expr c_expr_t;
206 /* A kind of type specifier. Note that this information is currently
207 only used to distinguish tag definitions, tag references and typeof
208 uses. */
209 enum c_typespec_kind {
210 /* No typespec. This appears only in struct c_declspec. */
211 ctsk_none,
212 /* A reserved keyword type specifier. */
213 ctsk_resword,
214 /* A reference to a tag, previously declared, such as "struct foo".
215 This includes where the previous declaration was as a different
216 kind of tag, in which case this is only valid if shadowing that
217 tag in an inner scope. */
218 ctsk_tagref,
219 /* Likewise, with standard attributes present in the reference. */
220 ctsk_tagref_attrs,
221 /* A reference to a tag, not previously declared in a visible
222 scope. */
223 ctsk_tagfirstref,
224 /* Likewise, with standard attributes present in the reference. */
225 ctsk_tagfirstref_attrs,
226 /* A definition of a tag such as "struct foo { int a; }". */
227 ctsk_tagdef,
228 /* A typedef name. */
229 ctsk_typedef,
230 /* An ObjC-specific kind of type specifier. */
231 ctsk_objc,
232 /* A typeof specifier, or _Atomic ( type-name ). */
233 ctsk_typeof
236 /* A type specifier: this structure is created in the parser and
237 passed to declspecs_add_type only. */
238 struct c_typespec {
239 /* What kind of type specifier this is. */
240 enum c_typespec_kind kind;
241 /* Whether the expression has operands suitable for use in constant
242 expressions. */
243 bool expr_const_operands;
244 /* Whether the type specifier includes an enum type specifier (that
245 is, ": specifier-qualifier-list" in a declaration using
246 "enum"). */
247 bool has_enum_type_specifier;
248 /* The specifier itself. */
249 tree spec;
250 /* An expression to be evaluated before the type specifier, in the
251 case of typeof specifiers, or NULL otherwise or if no such
252 expression is required for a particular typeof specifier. In
253 particular, when typeof is applied to an expression of variably
254 modified type, that expression must be evaluated in order to
255 determine array sizes that form part of the type, but the
256 expression itself (as opposed to the array sizes) forms no part
257 of the type and so needs to be recorded separately. */
258 tree expr;
261 /* A storage class specifier. */
262 enum c_storage_class {
263 csc_none,
264 csc_auto,
265 csc_extern,
266 csc_register,
267 csc_static,
268 csc_typedef
271 /* A type specifier keyword "void", "_Bool", "char", "int", "float",
272 "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum",
273 or none of these. */
274 enum c_typespec_keyword {
275 cts_none,
276 cts_void,
277 cts_bool,
278 cts_char,
279 cts_int,
280 cts_float,
281 cts_int_n,
282 cts_double,
283 cts_dfloat32,
284 cts_dfloat64,
285 cts_dfloat128,
286 cts_floatn_nx,
287 cts_fract,
288 cts_accum,
289 cts_auto_type
292 /* This enum lists all the possible declarator specifiers, storage
293 class or attribute that a user can write. There is at least one
294 enumerator per possible declarator specifier in the struct
295 c_declspecs below.
297 It is used to index the array of declspec locations in struct
298 c_declspecs. */
299 enum c_declspec_word {
300 cdw_typespec /* A catch-all for a typespec. */,
301 cdw_storage_class /* A catch-all for a storage class */,
302 cdw_attributes,
303 cdw_typedef,
304 cdw_explicit_signed,
305 cdw_deprecated,
306 cdw_default_int,
307 cdw_long,
308 cdw_long_long,
309 cdw_short,
310 cdw_signed,
311 cdw_unsigned,
312 cdw_complex,
313 cdw_inline,
314 cdw_noreturn,
315 cdw_thread,
316 cdw_const,
317 cdw_volatile,
318 cdw_restrict,
319 cdw_atomic,
320 cdw_saturating,
321 cdw_alignas,
322 cdw_address_space,
323 cdw_gimple,
324 cdw_rtl,
325 cdw_number_of_elements /* This one must always be the last
326 enumerator. */
329 enum c_declspec_il {
330 cdil_none,
331 cdil_gimple, /* __GIMPLE */
332 cdil_gimple_cfg, /* __GIMPLE(cfg) */
333 cdil_gimple_ssa, /* __GIMPLE(ssa) */
334 cdil_rtl /* __RTL */
337 /* A sequence of declaration specifiers in C. When a new declaration
338 specifier is added, please update the enum c_declspec_word above
339 accordingly. */
340 struct c_declspecs {
341 location_t locations[cdw_number_of_elements];
342 /* The type specified, if a single type specifier such as a struct,
343 union or enum specifier, typedef name or typeof specifies the
344 whole type, or NULL_TREE if none or a keyword such as "void" or
345 "char" is used. Does not include qualifiers. */
346 tree type;
347 /* Any expression to be evaluated before the type, from a typeof
348 specifier. */
349 tree expr;
350 /* The attributes from a typedef decl. */
351 tree decl_attr;
352 /* When parsing, the GNU attributes and prefix standard attributes.
353 Outside the parser, this will be NULL; attributes (possibly from
354 multiple lists) will be passed separately. */
355 tree attrs;
356 /* When parsing, postfix standard attributes (which appertain to the
357 type specified by the preceding declaration specifiers, unlike
358 prefix standard attributes which appertain to the declaration or
359 declarations as a whole). */
360 tree postfix_attrs;
361 /* The pass to start compiling a __GIMPLE or __RTL function with. */
362 char *gimple_or_rtl_pass;
363 /* ENTRY BB count. */
364 profile_count entry_bb_count;
365 /* The base-2 log of the greatest alignment required by an _Alignas
366 specifier, in bytes, or -1 if no such specifiers with nonzero
367 alignment. */
368 int align_log;
369 /* For the __intN declspec, this stores the index into the int_n_* arrays. */
370 int int_n_idx;
371 /* For the _FloatN and _FloatNx declspec, this stores the index into
372 the floatn_nx_types array. */
373 int floatn_nx_idx;
374 /* The storage class specifier, or csc_none if none. */
375 enum c_storage_class storage_class;
376 /* Any type specifier keyword used such as "int", not reflecting
377 modifiers such as "short", or cts_none if none. */
378 ENUM_BITFIELD (c_typespec_keyword) typespec_word : 8;
379 /* The kind of type specifier if one has been seen, ctsk_none
380 otherwise. */
381 ENUM_BITFIELD (c_typespec_kind) typespec_kind : 4;
382 ENUM_BITFIELD (c_declspec_il) declspec_il : 3;
383 /* Whether any expressions in typeof specifiers may appear in
384 constant expressions. */
385 BOOL_BITFIELD expr_const_operands : 1;
386 /* Whether any declaration specifiers have been seen at all. */
387 BOOL_BITFIELD declspecs_seen_p : 1;
388 /* Whether any declaration specifiers other than standard attributes
389 have been seen at all. If only standard attributes have been
390 seen, this is an attribute-declaration. */
391 BOOL_BITFIELD non_std_attrs_seen_p : 1;
392 /* Whether something other than a storage class specifier or
393 attribute has been seen. This is used to warn for the
394 obsolescent usage of storage class specifiers other than at the
395 start of the list. (Doing this properly would require function
396 specifiers to be handled separately from storage class
397 specifiers.) */
398 BOOL_BITFIELD non_sc_seen_p : 1;
399 /* Whether the type is specified by a typedef or typeof name. */
400 BOOL_BITFIELD typedef_p : 1;
401 /* Whether the type is explicitly "signed" or specified by a typedef
402 whose type is explicitly "signed". */
403 BOOL_BITFIELD explicit_signed_p : 1;
404 /* Whether the specifiers include a deprecated typedef. */
405 BOOL_BITFIELD deprecated_p : 1;
406 /* Whether the specifiers include an unavailable typedef. */
407 BOOL_BITFIELD unavailable_p : 1;
408 /* Whether the type defaulted to "int" because there were no type
409 specifiers. */
410 BOOL_BITFIELD default_int_p : 1;
411 /* Whether "long" was specified. */
412 BOOL_BITFIELD long_p : 1;
413 /* Whether "long" was specified more than once. */
414 BOOL_BITFIELD long_long_p : 1;
415 /* Whether "short" was specified. */
416 BOOL_BITFIELD short_p : 1;
417 /* Whether "signed" was specified. */
418 BOOL_BITFIELD signed_p : 1;
419 /* Whether "unsigned" was specified. */
420 BOOL_BITFIELD unsigned_p : 1;
421 /* Whether "complex" was specified. */
422 BOOL_BITFIELD complex_p : 1;
423 /* Whether "inline" was specified. */
424 BOOL_BITFIELD inline_p : 1;
425 /* Whether "_Noreturn" was speciied. */
426 BOOL_BITFIELD noreturn_p : 1;
427 /* Whether "__thread" or "_Thread_local" was specified. */
428 BOOL_BITFIELD thread_p : 1;
429 /* Whether "__thread" rather than "_Thread_local" was specified. */
430 BOOL_BITFIELD thread_gnu_p : 1;
431 /* Whether "const" was specified. */
432 BOOL_BITFIELD const_p : 1;
433 /* Whether "volatile" was specified. */
434 BOOL_BITFIELD volatile_p : 1;
435 /* Whether "restrict" was specified. */
436 BOOL_BITFIELD restrict_p : 1;
437 /* Whether "_Atomic" was specified. */
438 BOOL_BITFIELD atomic_p : 1;
439 /* Whether "_Sat" was specified. */
440 BOOL_BITFIELD saturating_p : 1;
441 /* Whether any alignment specifier (even with zero alignment) was
442 specified. */
443 BOOL_BITFIELD alignas_p : 1;
444 /* Whether an enum type specifier (": specifier-qualifier-list") was
445 specified other than in a definition of that enum (if so, this is
446 invalid unless it is an empty declaration "enum identifier
447 enum-type-specifier;", but such an empty declaration is valid in
448 C2x when "enum identifier;" would not be). */
449 BOOL_BITFIELD enum_type_specifier_ref_p : 1;
450 /* Whether "auto" was specified in C2X (or later) mode and means the
451 type is to be deduced from an initializer, or would mean that if
452 no type specifier appears later in these declaration
453 specifiers. */
454 BOOL_BITFIELD c2x_auto_p : 1;
455 /* Whether "constexpr" was specified. */
456 BOOL_BITFIELD constexpr_p : 1;
457 /* The address space that the declaration belongs to. */
458 addr_space_t address_space;
461 /* The various kinds of declarators in C. */
462 enum c_declarator_kind {
463 /* An identifier. */
464 cdk_id,
465 /* A function. */
466 cdk_function,
467 /* An array. */
468 cdk_array,
469 /* A pointer. */
470 cdk_pointer,
471 /* Parenthesized declarator with nested attributes. */
472 cdk_attrs
475 struct c_arg_tag {
476 /* The argument name. */
477 tree id;
478 /* The type of the argument. */
479 tree type;
483 /* Information about the parameters in a function declarator. */
484 struct c_arg_info {
485 /* A list of parameter decls. */
486 tree parms;
487 /* A list of structure, union and enum tags defined. */
488 vec<c_arg_tag, va_gc> *tags;
489 /* A list of argument types to go in the FUNCTION_TYPE. */
490 tree types;
491 /* A list of non-parameter decls (notably enumeration constants)
492 defined with the parameters. */
493 tree others;
494 /* A compound expression of VLA sizes from the parameters, or NULL.
495 In a function definition, these are used to ensure that
496 side-effects in sizes of arrays converted to pointers (such as a
497 parameter int i[n++]) take place; otherwise, they are
498 ignored. */
499 tree pending_sizes;
500 /* True when these arguments had [*]. */
501 BOOL_BITFIELD had_vla_unspec : 1;
502 /* True when the arguments are a (...) prototype. */
503 BOOL_BITFIELD no_named_args_stdarg_p : 1;
506 /* A declarator. */
507 struct c_declarator {
508 /* The kind of declarator. */
509 enum c_declarator_kind kind;
510 location_t id_loc; /* Currently only set for cdk_id, cdk_array. */
511 /* Except for cdk_id, the contained declarator. For cdk_id, NULL. */
512 struct c_declarator *declarator;
513 union {
514 /* For identifiers. */
515 struct {
516 /* An IDENTIFIER_NODE, or NULL_TREE if an abstract
517 declarator. */
518 tree id;
519 /* Any attributes (which apply to the declaration rather than to
520 the type described by the outer declarators). */
521 tree attrs;
522 } id;
523 /* For functions. */
524 struct c_arg_info *arg_info;
525 /* For arrays. */
526 struct {
527 /* The array dimension, or NULL for [] and [*]. */
528 tree dimen;
529 /* The qualifiers inside []. */
530 int quals;
531 /* The attributes (currently ignored) inside []. */
532 tree attrs;
533 /* Whether [static] was used. */
534 BOOL_BITFIELD static_p : 1;
535 /* Whether [*] was used. */
536 BOOL_BITFIELD vla_unspec_p : 1;
537 } array;
538 /* For pointers, the qualifiers on the pointer type. */
539 int pointer_quals;
540 /* For attributes. */
541 tree attrs;
542 } u;
545 /* A type name. */
546 struct c_type_name {
547 /* The declaration specifiers. */
548 struct c_declspecs *specs;
549 /* The declarator. */
550 struct c_declarator *declarator;
553 /* A parameter. */
554 struct c_parm {
555 /* The declaration specifiers, minus any prefix attributes. */
556 struct c_declspecs *specs;
557 /* The attributes. */
558 tree attrs;
559 /* The declarator. */
560 struct c_declarator *declarator;
561 /* The location of the parameter. */
562 location_t loc;
565 /* Used when parsing an enum. Initialized by start_enum. */
566 struct c_enum_contents
568 /* While defining an enum type, this is 1 plus the last enumerator
569 constant value. */
570 tree enum_next_value;
572 /* The enumeration type itself. */
573 tree enum_type;
575 /* Nonzero means that there was overflow computing enum_next_value. */
576 int enum_overflow;
579 /* A type of reference to a static identifier in an inline
580 function. */
581 enum c_inline_static_type {
582 /* Identifier with internal linkage used in function that may be an
583 inline definition (i.e., file-scope static). */
584 csi_internal,
585 /* Modifiable object with static storage duration defined in
586 function that may be an inline definition (i.e., local
587 static). */
588 csi_modifiable
592 /* in c-parser.cc */
593 extern void c_parse_init (void);
594 extern bool c_keyword_starts_typename (enum rid keyword);
596 /* in c-aux-info.cc */
597 extern void gen_aux_info_record (tree, int, int, int);
599 /* in c-decl.cc */
600 struct c_spot_bindings;
601 class c_struct_parse_info;
602 extern struct obstack parser_obstack;
603 /* Set to IN_ITERATION_STMT if parsing an iteration-statement,
604 to IN_OMP_BLOCK if parsing OpenMP structured block and
605 IN_OMP_FOR if parsing OpenMP loop. If parsing a switch statement,
606 this is bitwise ORed with IN_SWITCH_STMT, unless parsing an
607 iteration-statement, OpenMP block or loop within that switch. */
608 #define IN_SWITCH_STMT 1
609 #define IN_ITERATION_STMT 2
610 #define IN_OMP_BLOCK 4
611 #define IN_OMP_FOR 8
612 #define IN_OBJC_FOREACH 16
613 extern unsigned char in_statement;
615 extern bool switch_statement_break_seen_p;
617 extern bool global_bindings_p (void);
618 extern tree pushdecl (tree);
619 extern unsigned int start_underspecified_init (location_t, tree);
620 extern void finish_underspecified_init (tree, unsigned int);
621 extern void push_scope (void);
622 extern tree pop_scope (void);
623 extern void c_bindings_start_stmt_expr (struct c_spot_bindings *);
624 extern void c_bindings_end_stmt_expr (struct c_spot_bindings *);
626 extern void record_inline_static (location_t, tree, tree,
627 enum c_inline_static_type);
628 extern void c_init_decl_processing (void);
629 extern void c_print_identifier (FILE *, tree, int);
630 extern int quals_from_declspecs (const struct c_declspecs *);
631 extern struct c_declarator *build_array_declarator (location_t, tree,
632 struct c_declspecs *,
633 bool, bool);
634 extern tree build_enumerator (location_t, location_t, struct c_enum_contents *,
635 tree, tree);
636 extern tree check_for_loop_decls (location_t, bool);
637 extern void mark_forward_parm_decls (void);
638 extern void declare_parm_level (void);
639 extern void undeclared_variable (location_t, tree);
640 extern tree lookup_label_for_goto (location_t, tree);
641 extern tree declare_label (tree);
642 extern tree define_label (location_t, tree);
643 extern struct c_spot_bindings *c_get_switch_bindings (void);
644 extern void c_release_switch_bindings (struct c_spot_bindings *);
645 extern bool c_check_switch_jump_warnings (struct c_spot_bindings *,
646 location_t, location_t);
647 extern void finish_decl (tree, location_t, tree, tree, tree);
648 extern tree finish_enum (tree, tree, tree);
649 extern void finish_function (location_t = input_location);
650 extern tree finish_struct (location_t, tree, tree, tree,
651 class c_struct_parse_info *);
652 extern tree c_simulate_enum_decl (location_t, const char *,
653 vec<string_int_pair> *);
654 extern tree c_simulate_record_decl (location_t, const char *,
655 array_slice<const tree>);
656 extern struct c_arg_info *build_arg_info (void);
657 extern struct c_arg_info *get_parm_info (bool, tree);
658 extern tree grokfield (location_t, struct c_declarator *,
659 struct c_declspecs *, tree, tree *);
660 extern tree groktypename (struct c_type_name *, tree *, bool *);
661 extern tree grokparm (const struct c_parm *, tree *);
662 extern tree implicitly_declare (location_t, tree);
663 extern void keep_next_level (void);
664 extern void pending_xref_error (void);
665 extern void c_push_function_context (void);
666 extern void c_pop_function_context (void);
667 extern void push_parm_decl (const struct c_parm *, tree *);
668 extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
669 struct c_declarator *);
670 extern tree c_builtin_function (tree);
671 extern tree c_builtin_function_ext_scope (tree);
672 extern tree c_simulate_builtin_function_decl (tree);
673 extern void c_warn_unused_attributes (tree);
674 extern tree c_warn_type_attributes (tree);
675 extern void shadow_tag (const struct c_declspecs *);
676 extern void shadow_tag_warned (const struct c_declspecs *, int);
677 extern tree start_enum (location_t, struct c_enum_contents *, tree, tree);
678 extern bool start_function (struct c_declspecs *, struct c_declarator *, tree);
679 extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
680 tree, bool = true, location_t * = NULL);
681 extern tree start_struct (location_t, enum tree_code, tree,
682 class c_struct_parse_info **);
683 extern void store_parm_decls (void);
684 extern void store_parm_decls_from (struct c_arg_info *);
685 extern void temp_store_parm_decls (tree, tree);
686 extern void temp_pop_parm_decls (void);
687 extern tree xref_tag (enum tree_code, tree);
688 extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree,
689 bool, tree, bool);
690 extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
691 struct c_declarator *, location_t);
692 extern struct c_declarator *build_attrs_declarator (tree,
693 struct c_declarator *);
694 extern struct c_declarator *build_function_declarator (struct c_arg_info *,
695 struct c_declarator *);
696 extern struct c_declarator *build_id_declarator (tree);
697 extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
698 struct c_declarator *);
699 extern struct c_declspecs *build_null_declspecs (void);
700 extern struct c_declspecs *declspecs_add_qual (location_t,
701 struct c_declspecs *, tree);
702 extern struct c_declspecs *declspecs_add_type (location_t,
703 struct c_declspecs *,
704 struct c_typespec);
705 extern struct c_declspecs *declspecs_add_scspec (location_t,
706 struct c_declspecs *, tree);
707 extern struct c_declspecs *declspecs_add_attrs (location_t,
708 struct c_declspecs *, tree);
709 extern struct c_declspecs *declspecs_add_addrspace (location_t,
710 struct c_declspecs *,
711 addr_space_t);
712 extern struct c_declspecs *declspecs_add_alignas (location_t,
713 struct c_declspecs *, tree);
714 extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
716 /* in c-objc-common.cc */
717 extern bool c_objc_common_init (void);
718 extern bool c_missing_noreturn_ok_p (tree);
719 extern bool c_warn_unused_global_decl (const_tree);
720 extern void c_initialize_diagnostics (diagnostic_context *);
721 extern bool c_var_mod_p (tree x, tree fn);
722 extern alias_set_type c_get_alias_set (tree);
724 /* in c-typeck.cc */
725 extern int in_alignof;
726 extern int in_sizeof;
727 extern int in_typeof;
728 extern bool c_in_omp_for;
730 extern tree c_last_sizeof_arg;
731 extern location_t c_last_sizeof_loc;
733 extern struct c_switch *c_switch_stack;
735 extern bool null_pointer_constant_p (const_tree);
738 inline
739 bool c_type_variably_modified_p (tree t)
741 return error_mark_node != t && C_TYPE_VARIABLY_MODIFIED (t);
745 extern bool char_type_p (tree);
746 extern tree c_objc_common_truthvalue_conversion (location_t, tree);
747 extern tree require_complete_type (location_t, tree);
748 extern bool same_translation_unit_p (const_tree, const_tree);
749 extern int comptypes (tree, tree);
750 extern int comptypes_check_different_types (tree, tree, bool *);
751 extern int comptypes_check_enum_int (tree, tree, bool *);
752 extern bool c_mark_addressable (tree, bool = false);
753 extern void c_incomplete_type_error (location_t, const_tree, const_tree);
754 extern tree c_type_promotes_to (tree);
755 extern struct c_expr default_function_array_conversion (location_t,
756 struct c_expr);
757 extern struct c_expr default_function_array_read_conversion (location_t,
758 struct c_expr);
759 extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr,
760 bool, bool, bool = false);
761 extern tree decl_constant_value_1 (tree, bool);
762 extern void mark_exp_read (tree);
763 extern tree composite_type (tree, tree);
764 extern tree build_component_ref (location_t, tree, tree, location_t,
765 location_t);
766 extern tree build_array_ref (location_t, tree, tree);
767 extern tree build_external_ref (location_t, tree, bool, tree *);
768 extern void pop_maybe_used (bool);
769 extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr);
770 extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *);
771 extern struct c_expr parser_build_unary_op (location_t, enum tree_code,
772 struct c_expr);
773 extern struct c_expr parser_build_binary_op (location_t,
774 enum tree_code, struct c_expr,
775 struct c_expr);
776 extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
777 location_t, tree, tree, location_t);
778 extern tree build_compound_expr (location_t, tree, tree);
779 extern tree c_cast_expr (location_t, struct c_type_name *, tree);
780 extern tree build_c_cast (location_t, tree, tree);
781 extern void store_init_value (location_t, tree, tree, tree);
782 extern void maybe_warn_string_init (location_t, tree, struct c_expr);
783 extern void start_init (tree, tree, bool, bool, rich_location *);
784 extern void finish_init (void);
785 extern void really_start_incremental_init (tree);
786 extern void finish_implicit_inits (location_t, struct obstack *);
787 extern void push_init_level (location_t, int, struct obstack *);
788 extern struct c_expr pop_init_level (location_t, int, struct obstack *,
789 location_t);
790 extern void set_init_index (location_t, tree, tree, struct obstack *);
791 extern void set_init_label (location_t, tree, location_t, struct obstack *);
792 extern void process_init_element (location_t, struct c_expr, bool,
793 struct obstack *);
794 extern tree build_compound_literal (location_t, tree, tree, bool,
795 unsigned int, struct c_declspecs *);
796 extern void check_compound_literal_type (location_t, struct c_type_name *);
797 extern tree c_start_switch (location_t, location_t, tree, bool);
798 extern void c_finish_switch (tree, tree);
799 extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool,
800 bool);
801 extern tree build_asm_stmt (bool, tree);
802 extern int c_types_compatible_p (tree, tree);
803 extern tree c_begin_compound_stmt (bool);
804 extern tree c_end_compound_stmt (location_t, tree, bool);
805 extern void c_finish_if_stmt (location_t, tree, tree, tree);
806 extern void c_finish_loop (location_t, location_t, tree, location_t, tree,
807 tree, tree, tree, bool);
808 extern tree c_begin_stmt_expr (void);
809 extern tree c_finish_stmt_expr (location_t, tree);
810 extern tree c_process_expr_stmt (location_t, tree);
811 extern tree c_finish_expr_stmt (location_t, tree);
812 extern tree c_finish_return (location_t, tree, tree);
813 extern tree c_finish_bc_stmt (location_t, tree, bool);
814 extern tree c_finish_goto_label (location_t, tree);
815 extern tree c_finish_goto_ptr (location_t, c_expr val);
816 extern tree c_expr_to_decl (tree, bool *, bool *);
817 extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree);
818 extern tree c_finish_oacc_data (location_t, tree, tree);
819 extern tree c_finish_oacc_host_data (location_t, tree, tree);
820 extern tree c_begin_omp_parallel (void);
821 extern tree c_finish_omp_parallel (location_t, tree, tree);
822 extern tree c_begin_omp_task (void);
823 extern tree c_finish_omp_task (location_t, tree, tree);
824 extern void c_finish_omp_cancel (location_t, tree);
825 extern void c_finish_omp_cancellation_point (location_t, tree);
826 extern tree c_finish_omp_clauses (tree, enum c_omp_region_type);
827 extern tree c_build_va_arg (location_t, tree, location_t, tree);
828 extern tree c_finish_transaction (location_t, tree, int);
829 extern bool c_tree_equal (tree, tree);
830 extern tree c_build_function_call_vec (location_t, const vec<location_t>&,
831 tree, vec<tree, va_gc> *,
832 vec<tree, va_gc> *);
833 extern tree c_omp_clause_copy_ctor (tree, tree, tree);
835 /* Set to 0 at beginning of a function definition, set to 1 if
836 a return statement that specifies a return value is seen. */
838 extern int current_function_returns_value;
840 /* Set to 0 at beginning of a function definition, set to 1 if
841 a return statement with no argument is seen. */
843 extern int current_function_returns_null;
845 /* Set to 0 at beginning of a function definition, set to 1 if
846 a call to a noreturn function is seen. */
848 extern int current_function_returns_abnormally;
850 /* In c-decl.cc */
852 /* Tell the binding oracle what kind of binding we are looking for. */
854 enum c_oracle_request
856 C_ORACLE_SYMBOL,
857 C_ORACLE_TAG,
858 C_ORACLE_LABEL
861 /* If this is non-NULL, then it is a "binding oracle" which can lazily
862 create bindings when needed by the C compiler. The oracle is told
863 the name and type of the binding to create. It can call pushdecl
864 or the like to ensure the binding is visible; or do nothing,
865 leaving the binding untouched. c-decl.cc takes note of when the
866 oracle has been called and will not call it again if it fails to
867 create a given binding. */
869 typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier);
871 extern c_binding_oracle_function *c_binding_oracle;
873 extern void c_finish_incomplete_decl (tree);
874 extern tree c_omp_reduction_id (enum tree_code, tree);
875 extern tree c_omp_reduction_decl (tree);
876 extern tree c_omp_reduction_lookup (tree, tree);
877 extern tree c_check_omp_declare_reduction_r (tree *, int *, void *);
878 extern bool c_check_in_current_scope (tree);
879 extern void c_pushtag (location_t, tree, tree);
880 extern void c_bind (location_t, tree, bool);
881 extern bool tag_exists_p (enum tree_code, tree);
883 /* In c-errors.cc */
884 extern bool pedwarn_c90 (location_t, int opt, const char *, ...)
885 ATTRIBUTE_GCC_DIAG(3,4);
886 extern bool pedwarn_c99 (location_t, int opt, const char *, ...)
887 ATTRIBUTE_GCC_DIAG(3,4);
888 extern bool pedwarn_c11 (location_t, int opt, const char *, ...)
889 ATTRIBUTE_GCC_DIAG(3,4);
891 extern void
892 set_c_expr_source_range (c_expr *expr,
893 location_t start, location_t finish);
895 extern void
896 set_c_expr_source_range (c_expr *expr,
897 source_range src_range);
899 /* In c-fold.cc */
900 extern vec<tree> incomplete_record_decls;
902 extern const char *c_get_sarif_source_language (const char *filename);
904 #if CHECKING_P
905 namespace selftest {
906 extern void run_c_tests (void);
907 } // namespace selftest
908 #endif /* #if CHECKING_P */
911 #endif /* ! GCC_C_TREE_H */