c-tree.h 27 KB

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