Home | History | Annotate | Line # | Download | only in c
      1 /* Definitions for C parsing and type checking.
      2    Copyright (C) 1987-2024 Free Software Foundation, Inc.
      3 
      4 This file is part of GCC.
      5 
      6 GCC is free software; you can redistribute it and/or modify it under
      7 the terms of the GNU General Public License as published by the Free
      8 Software Foundation; either version 3, or (at your option) any later
      9 version.
     10 
     11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
     12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
     13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     14 for more details.
     15 
     16 You should have received a copy of the GNU General Public License
     17 along with GCC; see the file COPYING3.  If not see
     18 <http://www.gnu.org/licenses/>.  */
     19 
     20 #ifndef GCC_C_TREE_H
     21 #define GCC_C_TREE_H
     22 
     23 #include "c-family/c-common.h"
     24 #include "diagnostic.h"
     25 
     26 /* struct lang_identifier is private to c-decl.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 *))
     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, 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)
     41 
     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)
     45 
     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))
     52 
     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)
     56 
     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)
     61 
     62 /* Record whether a type is variably modified. */
     63 #define C_TYPE_VARIABLY_MODIFIED(TYPE) TYPE_LANG_FLAG_6 (TYPE)
     64 
     65 
     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)
     69 
     70 /* Record whether a typedef for type `int' was actually `signed int'.  */
     71 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
     72 
     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)
     76 
     77 /* For a FUNCTION_DECL, nonzero if it was an implicit declaration.  */
     78 #define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
     79 
     80 /* For a PARM_DECL, nonzero if it was declared as an array.  */
     81 #define C_ARRAY_PARAMETER(NODE) DECL_LANG_FLAG_0 (NODE)
     82 
     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))
     87 
     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))
     92 
     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)
     97 
     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))
    103 
    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))
    107 
    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))
    111 
    112 /* Set on decls used as placeholders for a C23 underspecified object
    113    definition.  */
    114 #define C_DECL_UNDERSPECIFIED(DECL) DECL_LANG_FLAG_7 (DECL)
    115 
    116 /* Set on VAR_DECLs declared as 'constexpr'.  */
    117 #define C_DECL_DECLARED_CONSTEXPR(DECL) \
    118   DECL_LANG_FLAG_8 (VAR_DECL_CHECK (DECL))
    119 
    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)))
    127 
    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))
    133 
    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))
    137 
    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))
    141 
    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))
    149 
    150 /* Record parser information about an expression that is irrelevant
    151    for code generation alongside a tree representing its value.  */
    152 struct c_expr
    153 {
    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;
    168 
    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;
    174 
    175   /* True if this was directly from a decimal constant token.  */
    176   bool m_decimal : 1;
    177 
    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; }
    182 
    183   location_t get_location () const
    184   {
    185     if (EXPR_HAS_LOCATION (value))
    186       return EXPR_LOCATION (value);
    187     else
    188       return make_location (get_start (), get_start (), get_finish ());
    189   }
    190 
    191   /* Set the value to error_mark_node whilst ensuring that src_range
    192      and m_decimal are initialized.  */
    193   void set_error ()
    194   {
    195     value = error_mark_node;
    196     src_range.m_start = UNKNOWN_LOCATION;
    197     src_range.m_finish = UNKNOWN_LOCATION;
    198     m_decimal = 0;
    199   }
    200 };
    201 
    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;
    205 
    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
    234 };
    235 
    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;
    259 };
    260 
    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
    269 };
    270 
    271 /* A type specifier keyword "void", "_Bool", "char", "int", "float",
    272    "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum",
    273    "_BitInt", 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_bitint,
    290   cts_auto_type
    291 };
    292 
    293 /* This enum lists all the possible declarator specifiers, storage
    294    class or attribute that a user can write.  There is at least one
    295    enumerator per possible declarator specifier in the struct
    296    c_declspecs below.
    297 
    298    It is used to index the array of declspec locations in struct
    299    c_declspecs.  */
    300 enum c_declspec_word {
    301   cdw_typespec /* A catch-all for a typespec.  */,
    302   cdw_storage_class  /* A catch-all for a storage class */,
    303   cdw_attributes,
    304   cdw_typedef,
    305   cdw_explicit_signed,
    306   cdw_deprecated,
    307   cdw_default_int,
    308   cdw_long,
    309   cdw_long_long,
    310   cdw_short,
    311   cdw_signed,
    312   cdw_unsigned,
    313   cdw_complex,
    314   cdw_inline,
    315   cdw_noreturn,
    316   cdw_thread,
    317   cdw_const,
    318   cdw_volatile,
    319   cdw_restrict,
    320   cdw_atomic,
    321   cdw_saturating,
    322   cdw_alignas,
    323   cdw_address_space,
    324   cdw_gimple,
    325   cdw_rtl,
    326   cdw_number_of_elements /* This one must always be the last
    327 			    enumerator.  */
    328 };
    329 
    330 enum c_declspec_il {
    331   cdil_none,
    332   cdil_gimple,		/* __GIMPLE  */
    333   cdil_gimple_cfg,	/* __GIMPLE(cfg)  */
    334   cdil_gimple_ssa,	/* __GIMPLE(ssa)  */
    335   cdil_rtl		/* __RTL  */
    336 };
    337 
    338 /* A sequence of declaration specifiers in C.  When a new declaration
    339    specifier is added, please update the enum c_declspec_word above
    340    accordingly.  */
    341 struct c_declspecs {
    342   location_t locations[cdw_number_of_elements];
    343   /* The type specified, if a single type specifier such as a struct,
    344      union or enum specifier, typedef name or typeof specifies the
    345      whole type, or NULL_TREE if none or a keyword such as "void" or
    346      "char" is used.  Does not include qualifiers.  */
    347   tree type;
    348   /* Any expression to be evaluated before the type, from a typeof
    349      specifier.  */
    350   tree expr;
    351   /* The attributes from a typedef decl.  */
    352   tree decl_attr;
    353   /* When parsing, the GNU attributes and prefix standard attributes.
    354      Outside the parser, this will be NULL; attributes (possibly from
    355      multiple lists) will be passed separately.  */
    356   tree attrs;
    357   /* When parsing, postfix standard attributes (which appertain to the
    358      type specified by the preceding declaration specifiers, unlike
    359      prefix standard attributes which appertain to the declaration or
    360      declarations as a whole).  */
    361   tree postfix_attrs;
    362   /* The pass to start compiling a __GIMPLE or __RTL function with.  */
    363   char *gimple_or_rtl_pass;
    364   /* ENTRY BB count.  */
    365   profile_count entry_bb_count;
    366   /* The base-2 log of the greatest alignment required by an _Alignas
    367      specifier, in bytes, or -1 if no such specifiers with nonzero
    368      alignment.  */
    369   int align_log;
    370   union {
    371     /* For the __intN declspec, this stores the index into the int_n_*
    372        arrays.  */
    373     int int_n_idx;
    374     /* For the _FloatN and _FloatNx declspec, this stores the index into
    375        the floatn_nx_types array.  */
    376     int floatn_nx_idx;
    377     /* For _BitInt(N) this stores the N.  */
    378     int bitint_prec;
    379   } u;
    380   /* The storage class specifier, or csc_none if none.  */
    381   enum c_storage_class storage_class;
    382   /* Any type specifier keyword used such as "int", not reflecting
    383      modifiers such as "short", or cts_none if none.  */
    384   ENUM_BITFIELD (c_typespec_keyword) typespec_word : 8;
    385   /* The kind of type specifier if one has been seen, ctsk_none
    386      otherwise.  */
    387   ENUM_BITFIELD (c_typespec_kind) typespec_kind : 4;
    388   ENUM_BITFIELD (c_declspec_il) declspec_il : 3;
    389   /* Whether any expressions in typeof specifiers may appear in
    390      constant expressions.  */
    391   BOOL_BITFIELD expr_const_operands : 1;
    392   /* Whether any declaration specifiers have been seen at all.  */
    393   BOOL_BITFIELD declspecs_seen_p : 1;
    394   /* Whether any declaration specifiers other than standard attributes
    395      have been seen at all.  If only standard attributes have been
    396      seen, this is an attribute-declaration.  */
    397   BOOL_BITFIELD non_std_attrs_seen_p : 1;
    398   /* Whether something other than a storage class specifier or
    399      attribute has been seen.  This is used to warn for the
    400      obsolescent usage of storage class specifiers other than at the
    401      start of the list.  (Doing this properly would require function
    402      specifiers to be handled separately from storage class
    403      specifiers.)  */
    404   BOOL_BITFIELD non_sc_seen_p : 1;
    405   /* Whether the type is specified by a typedef or typeof name.  */
    406   BOOL_BITFIELD typedef_p : 1;
    407   /* Whether the type is explicitly "signed" or specified by a typedef
    408      whose type is explicitly "signed".  */
    409   BOOL_BITFIELD explicit_signed_p : 1;
    410   /* Whether the specifiers include a deprecated typedef.  */
    411   BOOL_BITFIELD deprecated_p : 1;
    412   /* Whether the specifiers include an unavailable typedef.  */
    413   BOOL_BITFIELD unavailable_p : 1;
    414   /* Whether the type defaulted to "int" because there were no type
    415      specifiers.  */
    416   BOOL_BITFIELD default_int_p : 1;
    417   /* Whether "long" was specified.  */
    418   BOOL_BITFIELD long_p : 1;
    419   /* Whether "long" was specified more than once.  */
    420   BOOL_BITFIELD long_long_p : 1;
    421   /* Whether "short" was specified.  */
    422   BOOL_BITFIELD short_p : 1;
    423   /* Whether "signed" was specified.  */
    424   BOOL_BITFIELD signed_p : 1;
    425   /* Whether "unsigned" was specified.  */
    426   BOOL_BITFIELD unsigned_p : 1;
    427   /* Whether "complex" was specified.  */
    428   BOOL_BITFIELD complex_p : 1;
    429   /* Whether "inline" was specified.  */
    430   BOOL_BITFIELD inline_p : 1;
    431   /* Whether "_Noreturn" was speciied.  */
    432   BOOL_BITFIELD noreturn_p : 1;
    433   /* Whether "__thread" or "_Thread_local" was specified.  */
    434   BOOL_BITFIELD thread_p : 1;
    435   /* Whether "__thread" rather than "_Thread_local" was specified.  */
    436   BOOL_BITFIELD thread_gnu_p : 1;
    437   /* Whether "const" was specified.  */
    438   BOOL_BITFIELD const_p : 1;
    439   /* Whether "volatile" was specified.  */
    440   BOOL_BITFIELD volatile_p : 1;
    441   /* Whether "restrict" was specified.  */
    442   BOOL_BITFIELD restrict_p : 1;
    443   /* Whether "_Atomic" was specified.  */
    444   BOOL_BITFIELD atomic_p : 1;
    445   /* Whether "_Sat" was specified.  */
    446   BOOL_BITFIELD saturating_p : 1;
    447   /* Whether any alignment specifier (even with zero alignment) was
    448      specified.  */
    449   BOOL_BITFIELD alignas_p : 1;
    450   /* Whether an enum type specifier (": specifier-qualifier-list") was
    451      specified other than in a definition of that enum (if so, this is
    452      invalid unless it is an empty declaration "enum identifier
    453      enum-type-specifier;", but such an empty declaration is valid in
    454      C23 when "enum identifier;" would not be).  */
    455   BOOL_BITFIELD enum_type_specifier_ref_p : 1;
    456   /* Whether "auto" was specified in C23 (or later) mode and means the
    457      type is to be deduced from an initializer, or would mean that if
    458      no type specifier appears later in these declaration
    459      specifiers.  */
    460   BOOL_BITFIELD c23_auto_p : 1;
    461   /* Whether "constexpr" was specified.  */
    462   BOOL_BITFIELD constexpr_p : 1;
    463   /* The address space that the declaration belongs to.  */
    464   addr_space_t address_space;
    465 };
    466 
    467 /* The various kinds of declarators in C.  */
    468 enum c_declarator_kind {
    469   /* An identifier.  */
    470   cdk_id,
    471   /* A function.  */
    472   cdk_function,
    473   /* An array.  */
    474   cdk_array,
    475   /* A pointer.  */
    476   cdk_pointer,
    477   /* Parenthesized declarator with nested attributes.  */
    478   cdk_attrs
    479 };
    480 
    481 struct c_arg_tag {
    482   /* The argument name.  */
    483   tree id;
    484   /* The type of the argument.  */
    485   tree type;
    486 };
    487 
    488 
    489 /* Information about the parameters in a function declarator.  */
    490 struct c_arg_info {
    491   /* A list of parameter decls.  */
    492   tree parms;
    493   /* A list of structure, union and enum tags defined.  */
    494   vec<c_arg_tag, va_gc> *tags;
    495   /* A list of argument types to go in the FUNCTION_TYPE.  */
    496   tree types;
    497   /* A list of non-parameter decls (notably enumeration constants)
    498      defined with the parameters.  */
    499   tree others;
    500   /* A compound expression of VLA sizes from the parameters, or NULL.
    501      In a function definition, these are used to ensure that
    502      side-effects in sizes of arrays converted to pointers (such as a
    503      parameter int i[n++]) take place; otherwise, they are
    504      ignored.  */
    505   tree pending_sizes;
    506   /* True when these arguments had [*].  */
    507   BOOL_BITFIELD had_vla_unspec : 1;
    508   /* True when the arguments are a (...) prototype.  */
    509   BOOL_BITFIELD no_named_args_stdarg_p : 1;
    510 };
    511 
    512 /* A declarator.  */
    513 struct c_declarator {
    514   /* The kind of declarator.  */
    515   enum c_declarator_kind kind;
    516   location_t id_loc; /* Currently only set for cdk_id, cdk_array. */
    517   /* Except for cdk_id, the contained declarator.  For cdk_id, NULL.  */
    518   struct c_declarator *declarator;
    519   union {
    520     /* For identifiers.  */
    521     struct {
    522       /* An IDENTIFIER_NODE, or NULL_TREE if an abstract
    523 	 declarator.  */
    524       tree id;
    525       /* Any attributes (which apply to the declaration rather than to
    526 	 the type described by the outer declarators).  */
    527       tree attrs;
    528     } id;
    529     /* For functions.  */
    530     struct c_arg_info *arg_info;
    531     /* For arrays.  */
    532     struct {
    533       /* The array dimension, or NULL for [] and [*].  */
    534       tree dimen;
    535       /* The qualifiers inside [].  */
    536       int quals;
    537       /* The attributes (currently ignored) inside [].  */
    538       tree attrs;
    539       /* Whether [static] was used.  */
    540       BOOL_BITFIELD static_p : 1;
    541       /* Whether [*] was used.  */
    542       BOOL_BITFIELD vla_unspec_p : 1;
    543     } array;
    544     /* For pointers, the qualifiers on the pointer type.  */
    545     int pointer_quals;
    546     /* For attributes.  */
    547     tree attrs;
    548   } u;
    549 };
    550 
    551 /* A type name.  */
    552 struct c_type_name {
    553   /* The declaration specifiers.  */
    554   struct c_declspecs *specs;
    555   /* The declarator.  */
    556   struct c_declarator *declarator;
    557 };
    558 
    559 /* A parameter.  */
    560 struct c_parm {
    561   /* The declaration specifiers, minus any prefix attributes.  */
    562   struct c_declspecs *specs;
    563   /* The attributes.  */
    564   tree attrs;
    565   /* The declarator.  */
    566   struct c_declarator *declarator;
    567   /* The location of the parameter.  */
    568   location_t loc;
    569 };
    570 
    571 /* Used when parsing an enum.  Initialized by start_enum.  */
    572 struct c_enum_contents
    573 {
    574   /* While defining an enum type, this is 1 plus the last enumerator
    575      constant value.  */
    576   tree enum_next_value;
    577 
    578   /* The enumeration type itself.  */
    579   tree enum_type;
    580 
    581   /* Nonzero means that there was overflow computing enum_next_value.  */
    582   int enum_overflow;
    583 };
    584 
    585 /* A type of reference to a static identifier in an inline
    586    function.  */
    587 enum c_inline_static_type {
    588   /* Identifier with internal linkage used in function that may be an
    589      inline definition (i.e., file-scope static).  */
    590   csi_internal,
    591   /* Modifiable object with static storage duration defined in
    592      function that may be an inline definition (i.e., local
    593      static).  */
    594   csi_modifiable
    595 };
    596 
    597 
    598 /* in c-parser.cc */
    600 struct c_tree_token_vec;
    601 extern void c_parse_init (void);
    602 extern bool c_keyword_starts_typename (enum rid keyword);
    603 
    604 /* in c-aux-info.cc */
    605 extern void gen_aux_info_record (tree, int, int, int);
    606 
    607 /* in c-decl.cc */
    608 struct c_spot_bindings;
    609 class c_struct_parse_info;
    610 extern struct obstack parser_obstack;
    611 /* Set to IN_ITERATION_STMT if parsing an iteration-statement,
    612    to IN_OMP_BLOCK if parsing OpenMP structured block and
    613    IN_OMP_FOR if parsing OpenMP loop.  If parsing a switch statement,
    614    this is bitwise ORed with IN_SWITCH_STMT, unless parsing an
    615    iteration-statement, OpenMP block or loop within that switch.  */
    616 #define IN_SWITCH_STMT		1
    617 #define IN_ITERATION_STMT	2
    618 #define IN_OMP_BLOCK		4
    619 #define IN_OMP_FOR		8
    620 #define IN_OBJC_FOREACH		16
    621 extern unsigned char in_statement;
    622 
    623 extern bool switch_statement_break_seen_p;
    624 
    625 extern bool global_bindings_p (void);
    626 extern tree pushdecl (tree);
    627 extern unsigned int start_underspecified_init (location_t, tree);
    628 extern void finish_underspecified_init (tree, unsigned int);
    629 extern void push_scope (void);
    630 extern tree pop_scope (void);
    631 extern void c_mark_decl_jump_unsafe_in_current_scope ();
    632 extern void c_bindings_start_stmt_expr (struct c_spot_bindings *);
    633 extern void c_bindings_end_stmt_expr (struct c_spot_bindings *);
    634 
    635 extern void record_inline_static (location_t, tree, tree,
    636 				  enum c_inline_static_type);
    637 extern void c_init_decl_processing (void);
    638 extern void c_print_identifier (FILE *, tree, int);
    639 extern int quals_from_declspecs (const struct c_declspecs *);
    640 extern struct c_declarator *build_array_declarator (location_t, tree,
    641     						    struct c_declspecs *,
    642 						    bool, bool);
    643 extern tree build_enumerator (location_t, location_t, struct c_enum_contents *,
    644 			      tree, tree);
    645 extern tree check_for_loop_decls (location_t, bool);
    646 extern void mark_forward_parm_decls (void);
    647 extern void declare_parm_level (void);
    648 extern void undeclared_variable (location_t, tree);
    649 extern tree lookup_label_for_goto (location_t, tree);
    650 extern tree declare_label (tree);
    651 extern tree define_label (location_t, tree);
    652 extern struct c_spot_bindings *c_get_switch_bindings (void);
    653 extern void c_release_switch_bindings (struct c_spot_bindings *);
    654 extern bool c_check_switch_jump_warnings (struct c_spot_bindings *,
    655 					  location_t, location_t);
    656 extern void finish_decl (tree, location_t, tree, tree, tree);
    657 extern tree finish_enum (tree, tree, tree);
    658 extern void finish_function (location_t = input_location);
    659 extern tree finish_struct (location_t, tree, tree, tree,
    660 			   class c_struct_parse_info *,
    661 			   tree *expr = NULL);
    662 extern tree c_simulate_enum_decl (location_t, const char *,
    663 				  vec<string_int_pair> *);
    664 extern tree c_simulate_record_decl (location_t, const char *,
    665 				    array_slice<const tree>);
    666 extern struct c_arg_info *build_arg_info (void);
    667 extern struct c_arg_info *get_parm_info (bool, tree);
    668 extern tree grokfield (location_t, struct c_declarator *,
    669 		       struct c_declspecs *, tree, tree *, tree *);
    670 extern tree groktypename (struct c_type_name *, tree *, bool *);
    671 extern tree grokparm (const struct c_parm *, tree *);
    672 extern tree implicitly_declare (location_t, tree);
    673 extern void keep_next_level (void);
    674 extern void pending_xref_error (void);
    675 extern void c_push_function_context (void);
    676 extern void c_pop_function_context (void);
    677 extern void push_parm_decl (const struct c_parm *, tree *);
    678 extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
    679 							struct c_declarator *);
    680 extern tree c_builtin_function (tree);
    681 extern tree c_builtin_function_ext_scope (tree);
    682 extern tree c_simulate_builtin_function_decl (tree);
    683 extern void c_warn_unused_attributes (tree);
    684 extern tree c_warn_type_attributes (tree);
    685 extern void shadow_tag (const struct c_declspecs *);
    686 extern void shadow_tag_warned (const struct c_declspecs *, int);
    687 extern tree start_enum (location_t, struct c_enum_contents *, tree, tree,
    688 			bool potential_nesting_p);
    689 extern bool start_function (struct c_declspecs *, struct c_declarator *, tree);
    690 extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
    691 			tree, bool = true, location_t * = NULL);
    692 extern tree start_struct (location_t, enum tree_code, tree,
    693 			  class c_struct_parse_info **);
    694 extern void store_parm_decls (void);
    695 extern void store_parm_decls_from (struct c_arg_info *);
    696 extern void temp_store_parm_decls (tree, tree);
    697 extern void temp_pop_parm_decls (void);
    698 extern tree xref_tag (enum tree_code, tree);
    699 extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree,
    700 					  bool, tree, bool);
    701 extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
    702 				    struct c_declarator *, location_t);
    703 extern struct c_declarator *build_attrs_declarator (tree,
    704 						    struct c_declarator *);
    705 extern struct c_declarator *build_function_declarator (struct c_arg_info *,
    706 						       struct c_declarator *);
    707 extern struct c_declarator *build_id_declarator (tree);
    708 extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
    709 						     struct c_declarator *);
    710 extern struct c_declspecs *build_null_declspecs (void);
    711 extern struct c_declspecs *declspecs_add_qual (location_t,
    712 					       struct c_declspecs *, tree);
    713 extern struct c_declspecs *declspecs_add_type (location_t,
    714 					       struct c_declspecs *,
    715 					       struct c_typespec);
    716 extern struct c_declspecs *declspecs_add_scspec (location_t,
    717 						 struct c_declspecs *, tree);
    718 extern struct c_declspecs *declspecs_add_attrs (location_t,
    719 						struct c_declspecs *, tree);
    720 extern struct c_declspecs *declspecs_add_addrspace (location_t,
    721 						    struct c_declspecs *,
    722 						    addr_space_t);
    723 extern struct c_declspecs *declspecs_add_alignas (location_t,
    724 						  struct c_declspecs *, tree);
    725 extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
    726 extern size_t c_tree_size (enum tree_code);
    727 
    728 /* in c-objc-common.cc */
    729 extern bool c_objc_common_init (void);
    730 extern bool c_missing_noreturn_ok_p (tree);
    731 extern bool c_warn_unused_global_decl (const_tree);
    732 extern void c_initialize_diagnostics (diagnostic_context *);
    733 extern bool c_var_mod_p (tree x, tree fn);
    734 extern alias_set_type c_get_alias_set (tree);
    735 extern int c_type_dwarf_attribute (const_tree, int);
    736 
    737 /* in c-typeck.cc */
    738 extern int in_alignof;
    739 extern int in_sizeof;
    740 extern int in_typeof;
    741 extern bool c_in_omp_for;
    742 extern bool c_omp_array_section_p;
    743 
    744 extern tree c_last_sizeof_arg;
    745 extern location_t c_last_sizeof_loc;
    746 
    747 extern struct c_switch *c_switch_stack;
    748 
    749 extern bool null_pointer_constant_p (const_tree);
    750 
    751 
    752 inline bool
    753 c_type_variably_modified_p (tree t)
    754 {
    755   return error_mark_node != t && C_TYPE_VARIABLY_MODIFIED (t);
    756 }
    757 
    758 inline bool
    759 c_type_unspecified_p (tree t)
    760 {
    761   return error_mark_node != t
    762 	 && C_TYPE_VARIABLE_SIZE (t) && TREE_CODE (t) == ARRAY_TYPE
    763 	 && TYPE_DOMAIN (t) && TYPE_MAX_VALUE (TYPE_DOMAIN (t))
    764 	 && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == COMPOUND_EXPR
    765 	 && integer_zerop (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0))
    766 	 && integer_zerop (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 1));
    767 }
    768 
    769 extern bool char_type_p (tree);
    770 extern tree c_objc_common_truthvalue_conversion (location_t, tree,
    771 						 tree = integer_type_node);
    772 extern tree require_complete_type (location_t, tree);
    773 extern bool same_translation_unit_p (const_tree, const_tree);
    774 extern int comptypes (tree, tree);
    775 extern bool comptypes_same_p (tree, tree);
    776 extern bool comptypes_equiv_p (tree, tree);
    777 extern int comptypes_check_different_types (tree, tree, bool *);
    778 extern int comptypes_check_enum_int (tree, tree, bool *);
    779 extern bool c_mark_addressable (tree, bool = false);
    780 extern void c_incomplete_type_error (location_t, const_tree, const_tree);
    781 extern tree c_type_promotes_to (tree);
    782 extern struct c_expr default_function_array_conversion (location_t,
    783 							struct c_expr);
    784 extern struct c_expr default_function_array_read_conversion (location_t,
    785 							     struct c_expr);
    786 extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr,
    787 					       bool, bool, bool = false);
    788 extern tree decl_constant_value_1 (tree, bool);
    789 extern void mark_exp_read (tree);
    790 extern tree composite_type (tree, tree);
    791 extern tree build_component_ref (location_t, tree, tree, location_t,
    792 				 location_t);
    793 extern tree build_array_ref (location_t, tree, tree);
    794 extern tree build_omp_array_section (location_t, tree, tree, tree);
    795 extern tree build_external_ref (location_t, tree, bool, tree *);
    796 extern void pop_maybe_used (bool);
    797 extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr);
    798 extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *);
    799 extern struct c_expr parser_build_unary_op (location_t, enum tree_code,
    800     					    struct c_expr);
    801 extern struct c_expr parser_build_binary_op (location_t,
    802     					     enum tree_code, struct c_expr,
    803 					     struct c_expr);
    804 extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
    805 				    location_t, tree, tree, location_t);
    806 extern tree build_compound_expr (location_t, tree, tree);
    807 extern tree c_cast_expr (location_t, struct c_type_name *, tree);
    808 extern tree build_c_cast (location_t, tree, tree);
    809 extern void store_init_value (location_t, tree, tree, tree);
    810 extern void maybe_warn_string_init (location_t, tree, struct c_expr);
    811 extern void start_init (tree, tree, bool, bool, rich_location *);
    812 extern void finish_init (void);
    813 extern void really_start_incremental_init (tree);
    814 extern void finish_implicit_inits (location_t, struct obstack *);
    815 extern void push_init_level (location_t, int, struct obstack *);
    816 extern struct c_expr pop_init_level (location_t, int, struct obstack *,
    817 				     location_t);
    818 extern void set_init_index (location_t, tree, tree, struct obstack *);
    819 extern void set_init_label (location_t, tree, location_t, struct obstack *);
    820 extern void process_init_element (location_t, struct c_expr, bool,
    821 				  struct obstack *);
    822 extern tree build_compound_literal (location_t, tree, tree, bool,
    823 				    unsigned int, struct c_declspecs *);
    824 extern void check_compound_literal_type (location_t, struct c_type_name *);
    825 extern tree c_start_switch (location_t, location_t, tree, bool);
    826 extern void c_finish_switch (tree, tree);
    827 extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool,
    828 			    bool);
    829 extern tree build_asm_stmt (bool, tree);
    830 extern int c_types_compatible_p (tree, tree);
    831 extern tree c_begin_compound_stmt (bool);
    832 extern tree c_end_compound_stmt (location_t, tree, bool);
    833 extern void c_finish_if_stmt (location_t, tree, tree, tree);
    834 extern void c_finish_loop (location_t, location_t, tree, location_t, tree,
    835 			   tree, tree, tree, bool);
    836 extern tree c_begin_stmt_expr (void);
    837 extern tree c_finish_stmt_expr (location_t, tree);
    838 extern tree c_process_expr_stmt (location_t, tree);
    839 extern tree c_finish_expr_stmt (location_t, tree);
    840 extern tree c_finish_return (location_t, tree, tree);
    841 extern tree c_finish_bc_stmt (location_t, tree, bool);
    842 extern tree c_finish_goto_label (location_t, tree);
    843 extern tree c_finish_goto_ptr (location_t, c_expr val);
    844 extern tree c_expr_to_decl (tree, bool *, bool *);
    845 extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree);
    846 extern tree c_finish_oacc_data (location_t, tree, tree);
    847 extern tree c_finish_oacc_host_data (location_t, tree, tree);
    848 extern tree c_begin_omp_parallel (void);
    849 extern tree c_finish_omp_parallel (location_t, tree, tree);
    850 extern tree c_begin_omp_task (void);
    851 extern tree c_finish_omp_task (location_t, tree, tree);
    852 extern void c_finish_omp_cancel (location_t, tree);
    853 extern void c_finish_omp_cancellation_point (location_t, tree);
    854 extern tree c_finish_omp_clauses (tree, enum c_omp_region_type);
    855 extern tree c_build_va_arg (location_t, tree, location_t, tree);
    856 extern tree c_finish_transaction (location_t, tree, int);
    857 extern bool c_tree_equal (tree, tree);
    858 extern tree c_build_function_call_vec (location_t, const vec<location_t>&,
    859 				       tree, vec<tree, va_gc> *,
    860 				       vec<tree, va_gc> *);
    861 extern tree c_omp_clause_copy_ctor (tree, tree, tree);
    862 extern tree c_reconstruct_complex_type (tree, tree);
    863 extern tree c_build_type_attribute_variant (tree ntype, tree attrs);
    864 extern tree c_build_pointer_type (tree type);
    865 extern tree c_build_array_type (tree type, tree domain);
    866 extern tree c_build_array_type_unspecified (tree type);
    867 extern tree c_build_function_type (tree type, tree args, bool no = false);
    868 extern tree c_build_pointer_type_for_mode (tree type, machine_mode mode, bool m);
    869 
    870 /* Set to 0 at beginning of a function definition, set to 1 if
    871    a return statement that specifies a return value is seen.  */
    872 
    873 extern int current_function_returns_value;
    874 
    875 /* Set to 0 at beginning of a function definition, set to 1 if
    876    a return statement with no argument is seen.  */
    877 
    878 extern int current_function_returns_null;
    879 
    880 /* Set to 0 at beginning of a function definition, set to 1 if
    881    a call to a noreturn function is seen.  */
    882 
    883 extern int current_function_returns_abnormally;
    884 
    885 /* In c-decl.cc */
    886 
    887 /* Tell the binding oracle what kind of binding we are looking for.  */
    888 
    889 enum c_oracle_request
    890 {
    891   C_ORACLE_SYMBOL,
    892   C_ORACLE_TAG,
    893   C_ORACLE_LABEL
    894 };
    895 
    896 /* If this is non-NULL, then it is a "binding oracle" which can lazily
    897    create bindings when needed by the C compiler.  The oracle is told
    898    the name and type of the binding to create.  It can call pushdecl
    899    or the like to ensure the binding is visible; or do nothing,
    900    leaving the binding untouched.  c-decl.cc takes note of when the
    901    oracle has been called and will not call it again if it fails to
    902    create a given binding.  */
    903 
    904 typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier);
    905 
    906 extern c_binding_oracle_function *c_binding_oracle;
    907 
    908 extern void c_finish_incomplete_decl (tree);
    909 extern tree c_omp_reduction_id (enum tree_code, tree);
    910 extern tree c_omp_reduction_decl (tree);
    911 extern tree c_omp_reduction_lookup (tree, tree);
    912 extern tree c_check_omp_declare_reduction_r (tree *, int *, void *);
    913 extern bool c_check_in_current_scope (tree);
    914 extern void c_pushtag (location_t, tree, tree);
    915 extern void c_bind (location_t, tree, bool);
    916 extern bool tag_exists_p (enum tree_code, tree);
    917 
    918 /* In c-errors.cc */
    919 extern bool pedwarn_c90 (location_t, int opt, const char *, ...)
    920     ATTRIBUTE_GCC_DIAG(3,4);
    921 extern bool pedwarn_c99 (location_t, int opt, const char *, ...)
    922     ATTRIBUTE_GCC_DIAG(3,4);
    923 extern bool pedwarn_c11 (location_t, int opt, const char *, ...)
    924     ATTRIBUTE_GCC_DIAG(3,4);
    925 
    926 extern void
    927 set_c_expr_source_range (c_expr *expr,
    928 			 location_t start, location_t finish);
    929 
    930 extern void
    931 set_c_expr_source_range (c_expr *expr,
    932 			 source_range src_range);
    933 
    934 /* In c-fold.cc */
    935 extern vec<tree> incomplete_record_decls;
    936 
    937 extern const char *c_get_sarif_source_language (const char *filename);
    938 
    939 extern const struct scoped_attribute_specs std_attribute_table;
    940 
    941 #if CHECKING_P
    942 namespace selftest {
    943   extern void run_c_tests (void);
    944 } // namespace selftest
    945 #endif /* #if CHECKING_P */
    946 
    947 
    948 #endif /* ! GCC_C_TREE_H */
    949