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