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