190075Sobrien/* Definitions for c-common.c.
290075Sobrien   Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3169699Skan   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
490075Sobrien
590075SobrienThis file is part of GCC.
690075Sobrien
790075SobrienGCC is free software; you can redistribute it and/or modify it under
890075Sobrienthe terms of the GNU General Public License as published by the Free
990075SobrienSoftware Foundation; either version 2, or (at your option) any later
1090075Sobrienversion.
1190075Sobrien
1290075SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY
1390075SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or
1490075SobrienFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1590075Sobrienfor more details.
1690075Sobrien
1790075SobrienYou should have received a copy of the GNU General Public License
1890075Sobrienalong with GCC; see the file COPYING.  If not, write to the Free
19169699SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20169699Skan02110-1301, USA.  */
2190075Sobrien
2290075Sobrien#ifndef GCC_C_COMMON_H
2390075Sobrien#define GCC_C_COMMON_H
2490075Sobrien
2590075Sobrien#include "splay-tree.h"
2690075Sobrien#include "cpplib.h"
27132729Skan#include "ggc.h"
2890075Sobrien
2990075Sobrien/* Usage of TREE_LANG_FLAG_?:
30169699Skan   0: TREE_NEGATED_INT (in INTEGER_CST).
3190075Sobrien      IDENTIFIER_MARKED (used by search routines).
3290075Sobrien      DECL_PRETTY_FUNCTION_P (in VAR_DECL)
3390075Sobrien   1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
34169699Skan      STATEMENT_LIST_STMT_EXPR (in STATEMENT_LIST)
35169699Skan   2: unused
36169699Skan   3: STATEMENT_LIST_HAS_LABEL (in STATEMENT_LIST)
37169699Skan   4: unused
3890075Sobrien*/
3990075Sobrien
4090075Sobrien/* Reserved identifiers.  This is the union of all the keywords for C,
41117406Skan   C++, and Objective-C.  All the type modifiers have to be in one
4290075Sobrien   block at the beginning, because they are used as mask bits.  There
4390075Sobrien   are 27 type modifiers; if we add many more we will have to redesign
4490075Sobrien   the mask mechanism.  */
4590075Sobrien
4690075Sobrienenum rid
4790075Sobrien{
4890075Sobrien  /* Modifiers: */
4990075Sobrien  /* C, in empirical order of frequency.  */
5090075Sobrien  RID_STATIC = 0,
5190075Sobrien  RID_UNSIGNED, RID_LONG,    RID_CONST, RID_EXTERN,
5290075Sobrien  RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
5390075Sobrien  RID_VOLATILE, RID_SIGNED,  RID_AUTO,  RID_RESTRICT,
5490075Sobrien
5590075Sobrien  /* C extensions */
56132729Skan  RID_COMPLEX, RID_THREAD,
5790075Sobrien
5890075Sobrien  /* C++ */
5990075Sobrien  RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
6090075Sobrien
6190075Sobrien  /* ObjC */
6290075Sobrien  RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
6390075Sobrien
6490075Sobrien  /* C */
6590075Sobrien  RID_INT,     RID_CHAR,   RID_FLOAT,    RID_DOUBLE, RID_VOID,
6690075Sobrien  RID_ENUM,    RID_STRUCT, RID_UNION,    RID_IF,     RID_ELSE,
6790075Sobrien  RID_WHILE,   RID_DO,     RID_FOR,      RID_SWITCH, RID_CASE,
6890075Sobrien  RID_DEFAULT, RID_BREAK,  RID_CONTINUE, RID_RETURN, RID_GOTO,
6990075Sobrien  RID_SIZEOF,
7090075Sobrien
7190075Sobrien  /* C extensions */
7290075Sobrien  RID_ASM,       RID_TYPEOF,   RID_ALIGNOF,  RID_ATTRIBUTE,  RID_VA_ARG,
73169699Skan  RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL,      RID_CHOOSE_EXPR,
74169699Skan  RID_TYPES_COMPATIBLE_P,
75169699Skan  RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
7690075Sobrien
7790075Sobrien  /* Too many ways of getting the name of a function as a string */
7890075Sobrien  RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
7990075Sobrien
8090075Sobrien  /* C++ */
8190075Sobrien  RID_BOOL,     RID_WCHAR,    RID_CLASS,
8290075Sobrien  RID_PUBLIC,   RID_PRIVATE,  RID_PROTECTED,
8390075Sobrien  RID_TEMPLATE, RID_NULL,     RID_CATCH,
8490075Sobrien  RID_DELETE,   RID_FALSE,    RID_NAMESPACE,
85169699Skan  RID_NEW,      RID_OFFSETOF, RID_OPERATOR,
86169699Skan  RID_THIS,     RID_THROW,    RID_TRUE,
87169699Skan  RID_TRY,      RID_TYPENAME, RID_TYPEID,
88132729Skan  RID_USING,
8990075Sobrien
9090075Sobrien  /* casts */
9190075Sobrien  RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
9290075Sobrien
93117406Skan  /* Objective-C */
94169699Skan  RID_AT_ENCODE,   RID_AT_END,
9590075Sobrien  RID_AT_CLASS,    RID_AT_ALIAS,     RID_AT_DEFS,
96261188Spfg  /* APPLE LOCAL radar 4564694 */
97261188Spfg  RID_AT_PACKAGE,  RID_AT_PRIVATE,  RID_AT_PROTECTED, RID_AT_PUBLIC,
98169699Skan  RID_AT_PROTOCOL, RID_AT_SELECTOR,
99132729Skan  RID_AT_THROW,	   RID_AT_TRY,       RID_AT_CATCH,
100132729Skan  RID_AT_FINALLY,  RID_AT_SYNCHRONIZED,
101132729Skan  RID_AT_INTERFACE,
102261188Spfg  /* APPLE LOCAL C* language */
103261188Spfg  RID_AT_OPTIONAL, RID_AT_REQUIRED,
104261188Spfg  /* APPLE LOCAL C* property (Radar 4436866) */
105261188Spfg  RID_AT_PROPERTY,
10690075Sobrien  RID_AT_IMPLEMENTATION,
107261188Spfg  /* APPLE LOCAL C* property (Radar 4436866, 4591909, 4621020) */
108261188Spfg  RID_READONLY, RID_GETTER, RID_SETTER,
109261188Spfg  RID_NONATOMIC,
11090075Sobrien
11190075Sobrien  RID_MAX,
11290075Sobrien
11390075Sobrien  RID_FIRST_MODIFIER = RID_STATIC,
11490075Sobrien  RID_LAST_MODIFIER = RID_ONEWAY,
11590075Sobrien
11690075Sobrien  RID_FIRST_AT = RID_AT_ENCODE,
11790075Sobrien  RID_LAST_AT = RID_AT_IMPLEMENTATION,
11890075Sobrien  RID_FIRST_PQ = RID_IN,
11990075Sobrien  RID_LAST_PQ = RID_ONEWAY
12090075Sobrien};
12190075Sobrien
12290075Sobrien#define OBJC_IS_AT_KEYWORD(rid) \
123169699Skan  ((unsigned int) (rid) >= (unsigned int) RID_FIRST_AT && \
124169699Skan   (unsigned int) (rid) <= (unsigned int) RID_LAST_AT)
12590075Sobrien
12690075Sobrien#define OBJC_IS_PQ_KEYWORD(rid) \
127169699Skan  ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
128169699Skan   (unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
12990075Sobrien
13090075Sobrien/* The elements of `ridpointers' are identifier nodes for the reserved
13190075Sobrien   type names and storage classes.  It is indexed by a RID_... value.  */
132169699Skanextern GTY ((length ("(int) RID_MAX"))) tree *ridpointers;
13390075Sobrien
13490075Sobrien/* Standard named or nameless data types of the C compiler.  */
13590075Sobrien
13690075Sobrienenum c_tree_index
13790075Sobrien{
13890075Sobrien    CTI_WCHAR_TYPE,
13990075Sobrien    CTI_SIGNED_WCHAR_TYPE,
14090075Sobrien    CTI_UNSIGNED_WCHAR_TYPE,
14190075Sobrien    CTI_WINT_TYPE,
14290075Sobrien    CTI_SIGNED_SIZE_TYPE, /* For format checking only.  */
14390075Sobrien    CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only.  */
14490075Sobrien    CTI_INTMAX_TYPE,
14590075Sobrien    CTI_UINTMAX_TYPE,
14690075Sobrien    CTI_WIDEST_INT_LIT_TYPE,
14790075Sobrien    CTI_WIDEST_UINT_LIT_TYPE,
14890075Sobrien
14990075Sobrien    CTI_CHAR_ARRAY_TYPE,
15090075Sobrien    CTI_WCHAR_ARRAY_TYPE,
15190075Sobrien    CTI_INT_ARRAY_TYPE,
15290075Sobrien    CTI_STRING_TYPE,
15390075Sobrien    CTI_CONST_STRING_TYPE,
15490075Sobrien
15590075Sobrien    /* Type for boolean expressions (bool in C++, int in C).  */
156132729Skan    CTI_TRUTHVALUE_TYPE,
157132729Skan    CTI_TRUTHVALUE_TRUE,
158132729Skan    CTI_TRUTHVALUE_FALSE,
159132729Skan
16090075Sobrien    CTI_DEFAULT_FUNCTION_TYPE,
16190075Sobrien
16290075Sobrien    /* These are not types, but we have to look them up all the time.  */
16390075Sobrien    CTI_FUNCTION_NAME_DECL,
16490075Sobrien    CTI_PRETTY_FUNCTION_NAME_DECL,
16590075Sobrien    CTI_C99_FUNCTION_NAME_DECL,
16690075Sobrien    CTI_SAVED_FUNCTION_NAME_DECLS,
167169699Skan
16890075Sobrien    CTI_VOID_ZERO,
16990075Sobrien
170169699Skan    CTI_NULL,
171169699Skan
17290075Sobrien    CTI_MAX
17390075Sobrien};
17490075Sobrien
17590075Sobrien#define C_RID_CODE(id)	(((struct c_common_identifier *) (id))->node.rid_code)
17690075Sobrien
17790075Sobrien/* Identifier part common to the C front ends.  Inherits from
17890075Sobrien   tree_identifier, despite appearances.  */
179117406Skanstruct c_common_identifier GTY(())
18090075Sobrien{
18190075Sobrien  struct tree_common common;
182132729Skan  struct cpp_hashnode node;
18390075Sobrien};
18490075Sobrien
18590075Sobrien#define wchar_type_node			c_global_trees[CTI_WCHAR_TYPE]
18690075Sobrien#define signed_wchar_type_node		c_global_trees[CTI_SIGNED_WCHAR_TYPE]
18790075Sobrien#define unsigned_wchar_type_node	c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
18890075Sobrien#define wint_type_node			c_global_trees[CTI_WINT_TYPE]
18990075Sobrien#define signed_size_type_node		c_global_trees[CTI_SIGNED_SIZE_TYPE]
19090075Sobrien#define unsigned_ptrdiff_type_node	c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
19190075Sobrien#define intmax_type_node		c_global_trees[CTI_INTMAX_TYPE]
19290075Sobrien#define uintmax_type_node		c_global_trees[CTI_UINTMAX_TYPE]
19390075Sobrien#define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE]
19490075Sobrien#define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE]
19590075Sobrien
196132729Skan#define truthvalue_type_node		c_global_trees[CTI_TRUTHVALUE_TYPE]
197132729Skan#define truthvalue_true_node		c_global_trees[CTI_TRUTHVALUE_TRUE]
198132729Skan#define truthvalue_false_node		c_global_trees[CTI_TRUTHVALUE_FALSE]
19990075Sobrien
20090075Sobrien#define char_array_type_node		c_global_trees[CTI_CHAR_ARRAY_TYPE]
20190075Sobrien#define wchar_array_type_node		c_global_trees[CTI_WCHAR_ARRAY_TYPE]
20290075Sobrien#define int_array_type_node		c_global_trees[CTI_INT_ARRAY_TYPE]
20390075Sobrien#define string_type_node		c_global_trees[CTI_STRING_TYPE]
20490075Sobrien#define const_string_type_node		c_global_trees[CTI_CONST_STRING_TYPE]
20590075Sobrien
20690075Sobrien#define default_function_type		c_global_trees[CTI_DEFAULT_FUNCTION_TYPE]
20790075Sobrien
20890075Sobrien#define function_name_decl_node		c_global_trees[CTI_FUNCTION_NAME_DECL]
20990075Sobrien#define pretty_function_name_decl_node	c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
21090075Sobrien#define c99_function_name_decl_node		c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
21190075Sobrien#define saved_function_name_decls	c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
21290075Sobrien
21390075Sobrien/* A node for `((void) 0)'.  */
21490075Sobrien#define void_zero_node                  c_global_trees[CTI_VOID_ZERO]
21590075Sobrien
216169699Skan/* The node for C++ `__null'.  */
217169699Skan#define null_node                       c_global_trees[CTI_NULL]
218169699Skan
219117406Skanextern GTY(()) tree c_global_trees[CTI_MAX];
22090075Sobrien
221132729Skan/* In a RECORD_TYPE, a sorted array of the fields of the type, not a
222132729Skan   tree for size reasons.  */
223132729Skanstruct sorted_fields_type GTY(())
224132729Skan{
225132729Skan  int len;
226132729Skan  tree GTY((length ("%h.len"))) elts[1];
227132729Skan};
228132729Skan
22990075Sobrien/* Mark which labels are explicitly declared.
23090075Sobrien   These may be shadowed, and may be referenced from nested functions.  */
23190075Sobrien#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
23290075Sobrien
23390075Sobrientypedef enum c_language_kind
23490075Sobrien{
235132729Skan  clk_c		= 0,		/* C90, C94 or C99 */
236132729Skan  clk_objc	= 1,		/* clk_c with ObjC features.  */
237132729Skan  clk_cxx	= 2,		/* ANSI/ISO C++ */
238132729Skan  clk_objcxx	= 3		/* clk_cxx with ObjC features.  */
23990075Sobrien}
24090075Sobrienc_language_kind;
24190075Sobrien
242132729Skan/* To test for a specific language use c_language, defined by each
243132729Skan   front end.  For "ObjC features" or "not C++" use the macros.  */
244132729Skanextern c_language_kind c_language;
245132729Skan
246132729Skan#define c_dialect_cxx()		(c_language & clk_cxx)
247132729Skan#define c_dialect_objc()	(c_language & clk_objc)
248132729Skan
24990075Sobrien/* Information about a statement tree.  */
25090075Sobrien
251117406Skanstruct stmt_tree_s GTY(()) {
252169699Skan  /* The current statement list being collected.  */
253169699Skan  tree x_cur_stmt_list;
254169699Skan
255117406Skan  /* In C++, Nonzero if we should treat statements as full
25690075Sobrien     expressions.  In particular, this variable is no-zero if at the
25790075Sobrien     end of a statement we should destroy any temporaries created
25890075Sobrien     during that statement.  Similarly, if, at the end of a block, we
25990075Sobrien     should destroy any local variables in this block.  Normally, this
260117406Skan     variable is nonzero, since those are the normal semantics of
26190075Sobrien     C++.
26290075Sobrien
26390075Sobrien     However, in order to represent aggregate initialization code as
26490075Sobrien     tree structure, we use statement-expressions.  The statements
26590075Sobrien     within the statement expression should not result in cleanups
26690075Sobrien     being run until the entire enclosing statement is complete.
26790075Sobrien
26890075Sobrien     This flag has no effect in C.  */
26990075Sobrien  int stmts_are_full_exprs_p;
27090075Sobrien};
27190075Sobrien
27290075Sobrientypedef struct stmt_tree_s *stmt_tree;
27390075Sobrien
27490075Sobrien/* Global state pertinent to the current function.  Some C dialects
27590075Sobrien   extend this structure with additional fields.  */
27690075Sobrien
277117406Skanstruct c_language_function GTY(()) {
27890075Sobrien  /* While we are parsing the function, this contains information
27990075Sobrien     about the statement-tree that we are building.  */
28090075Sobrien  struct stmt_tree_s x_stmt_tree;
28190075Sobrien};
28290075Sobrien
283169699Skan/* When building a statement-tree, this is the current statement list
284169699Skan   being collected.  It's TREE_CHAIN is a back-pointer to the previous
285169699Skan   statement list.  */
28690075Sobrien
287169699Skan#define cur_stmt_list (current_stmt_tree ()->x_cur_stmt_list)
28890075Sobrien
28990075Sobrien/* Language-specific hooks.  */
29090075Sobrien
29190075Sobrien/* Callback that determines if it's ok for a function to have no
29290075Sobrien   noreturn attribute.  */
293132729Skanextern int (*lang_missing_noreturn_ok_p) (tree);
29490075Sobrien
295169699Skan/* If non-NULL, this function is called after a precompile header file
296169699Skan   is loaded.  */
297169699Skanextern void (*lang_post_pch_load) (void);
298169699Skan
299169699Skanextern void push_file_scope (void);
300169699Skanextern void pop_file_scope (void);
301132729Skanextern stmt_tree current_stmt_tree (void);
302169699Skanextern tree push_stmt_list (void);
303169699Skanextern tree pop_stmt_list (tree);
304132729Skanextern tree add_stmt (tree);
305169699Skanextern void push_cleanup (tree, tree, bool);
306169699Skanextern tree pushdecl_top_level (tree);
307169699Skanextern tree pushdecl (tree);
308169699Skanextern tree build_modify_expr (tree, enum tree_code, tree);
309169699Skanextern tree build_indirect_ref (tree, const char *);
31090075Sobrien
311169699Skanextern int c_expand_decl (tree);
31290075Sobrien
313132729Skanextern int field_decl_cmp (const void *, const void *);
314169699Skanextern void resort_sorted_fields (void *, void *, gt_pointer_operator,
315169699Skan				  void *);
316169699Skanextern bool has_c_linkage (tree decl);
317132729Skan
318132729Skan/* Switches common to the C front ends.  */
31990075Sobrien
320132729Skan/* Nonzero if prepreprocessing only.  */
32190075Sobrien
322132729Skanextern int flag_preprocess_only;
32390075Sobrien
324132729Skan/* Zero means that faster, ...NonNil variants of objc_msgSend...
325132729Skan   calls will be used in ObjC; passing nil receivers to such calls
326132729Skan   will most likely result in crashes.  */
327132729Skanextern int flag_nil_receivers;
32890075Sobrien
329132729Skan/* Nonzero means that we will allow new ObjC exception syntax (@throw,
330132729Skan   @try, etc.) in source code.  */
331132729Skanextern int flag_objc_exceptions;
33290075Sobrien
333169699Skan/* Nonzero means that we generate NeXT setjmp based exceptions.  */
334169699Skanextern int flag_objc_sjlj_exceptions;
335169699Skan
336132729Skan/* Nonzero means that code generation will be altered to support
337132729Skan   "zero-link" execution.  This currently affects ObjC only, but may
338132729Skan   affect other languages in the future.  */
339132729Skanextern int flag_zero_link;
34090075Sobrien
341132729Skan/* Nonzero means emit an '__OBJC, __image_info' for the current translation
342132729Skan   unit.  It will inform the ObjC runtime that class definition(s) herein
343132729Skan   contained are to replace one(s) previously loaded.  */
344132729Skanextern int flag_replace_objc_classes;
34590075Sobrien
346132729Skan/* Nonzero means don't output line number information.  */
34790075Sobrien
348132729Skanextern char flag_no_line_commands;
34990075Sobrien
350132729Skan/* Nonzero causes -E output not to be done, but directives such as
351132729Skan   #define that have side effects are still obeyed.  */
352132729Skan
353132729Skanextern char flag_no_output;
354132729Skan
355132729Skan/* Nonzero means dump macros in some fashion; contains the 'D', 'M' or
356132729Skan   'N' of the command line switch.  */
357132729Skan
358132729Skanextern char flag_dump_macros;
359132729Skan
360132729Skan/* Nonzero means pass #include lines through to the output.  */
361132729Skan
362132729Skanextern char flag_dump_includes;
363132729Skan
364169699Skan/* Nonzero means process PCH files while preprocessing.  */
365169699Skan
366169699Skanextern bool flag_pch_preprocess;
367169699Skan
368132729Skan/* The file name to which we should write a precompiled header, or
369132729Skan   NULL if no header will be written in this compile.  */
370132729Skan
371132729Skanextern const char *pch_file;
372132729Skan
373117406Skan/* Nonzero if an ISO standard was selected.  It rejects macros in the
374117406Skan   user's namespace.  */
375132729Skan
376117406Skanextern int flag_iso;
377117406Skan
378117406Skan/* Nonzero if -undef was given.  It suppresses target built-in macros
379117406Skan   and assertions.  */
380132729Skan
381117406Skanextern int flag_undef;
382117406Skan
383117406Skan/* Nonzero means don't recognize the non-ANSI builtin functions.  */
384117406Skan
385117406Skanextern int flag_no_builtin;
386117406Skan
387117406Skan/* Nonzero means don't recognize the non-ANSI builtin functions.
388117406Skan   -ansi sets this.  */
389117406Skan
390117406Skanextern int flag_no_nonansi_builtin;
391117406Skan
39290075Sobrien/* Nonzero means give `double' the same size as `float'.  */
39390075Sobrien
39490075Sobrienextern int flag_short_double;
39590075Sobrien
39690075Sobrien/* Nonzero means give `wchar_t' the same size as `short'.  */
39790075Sobrien
39890075Sobrienextern int flag_short_wchar;
39990075Sobrien
400260074Spfg/* Nonzero means allow implicit conversions between vectors with
401260074Spfg   differing numbers of subparts and/or differing element types.  */
402260074Spfgextern int flag_lax_vector_conversions;
403260074Spfg
404117406Skan/* Nonzero means allow Microsoft extensions without warnings or errors.  */
405117406Skanextern int flag_ms_extensions;
40690075Sobrien
407117406Skan/* Nonzero means don't recognize the keyword `asm'.  */
408117406Skan
409117406Skanextern int flag_no_asm;
410117406Skan
411117406Skan/* Nonzero means give string constants the type `const char *', as mandated
412117406Skan   by the standard.  */
413117406Skan
414117406Skanextern int flag_const_strings;
415117406Skan
416117406Skan/* Nonzero means to treat bitfields as signed unless they say `unsigned'.  */
417117406Skan
418117406Skanextern int flag_signed_bitfields;
419117406Skan
420169699Skan/* Warn about #pragma directives that are not recognized.  */
421117406Skan
422169699Skanextern int warn_unknown_pragmas; /* Tri state variable.  */
423117406Skan
424117406Skan/* Warn about format/argument anomalies in calls to formatted I/O functions
425117406Skan   (*printf, *scanf, strftime, strfmon, etc.).  */
426117406Skan
42790075Sobrienextern int warn_format;
42890075Sobrien
42990075Sobrien
430117406Skan/* C/ObjC language option variables.  */
43190075Sobrien
43290075Sobrien
433117406Skan/* Nonzero means allow type mismatches in conditional expressions;
434117406Skan   just make their values `void'.  */
43596557Sobrien
436117406Skanextern int flag_cond_mismatch;
43790075Sobrien
43890075Sobrien/* Nonzero means enable C89 Amendment 1 features.  */
43990075Sobrien
44090075Sobrienextern int flag_isoc94;
44190075Sobrien
44290075Sobrien/* Nonzero means use the ISO C99 dialect of C.  */
44390075Sobrien
44490075Sobrienextern int flag_isoc99;
44590075Sobrien
446132729Skan/* Nonzero means that we have builtin functions, and main is an int.  */
44790075Sobrien
44890075Sobrienextern int flag_hosted;
44990075Sobrien
450117406Skan/* Warn if main is suspicious.  */
451117406Skan
452117406Skanextern int warn_main;
453117406Skan
454117406Skan
455117406Skan/* ObjC language option variables.  */
456117406Skan
457117406Skan
458117406Skan/* Open and close the file for outputting class declarations, if
459117406Skan   requested (ObjC).  */
460117406Skan
461117406Skanextern int flag_gen_declaration;
462117406Skan
463117406Skan/* Tells the compiler that this is a special run.  Do not perform any
464117406Skan   compiling, instead we are to test some platform dependent features
465117406Skan   and output a C header file with appropriate definitions.  */
466117406Skan
467117406Skanextern int print_struct_values;
468117406Skan
469117406Skan/* ???.  Undocumented.  */
470117406Skan
471117406Skanextern const char *constant_string_class_name;
472117406Skan
473117406Skan
474117406Skan/* C++ language option variables.  */
475117406Skan
476117406Skan
477117406Skan/* Nonzero means don't recognize any extension keywords.  */
478117406Skan
479117406Skanextern int flag_no_gnu_keywords;
480117406Skan
481117406Skan/* Nonzero means do emit exported implementations of functions even if
482117406Skan   they can be inlined.  */
483117406Skan
484117406Skanextern int flag_implement_inlines;
485117406Skan
486117406Skan/* Nonzero means that implicit instantiations will be emitted if needed.  */
487117406Skan
488117406Skanextern int flag_implicit_templates;
489117406Skan
490117406Skan/* Nonzero means that implicit instantiations of inline templates will be
491117406Skan   emitted if needed, even if instantiations of non-inline templates
492117406Skan   aren't.  */
493117406Skan
494117406Skanextern int flag_implicit_inline_templates;
495117406Skan
496117406Skan/* Nonzero means generate separate instantiation control files and
497117406Skan   juggle them at link time.  */
498117406Skan
499117406Skanextern int flag_use_repository;
500117406Skan
501117406Skan/* Nonzero if we want to issue diagnostics that the standard says are not
502117406Skan   required.  */
503117406Skan
504117406Skanextern int flag_optional_diags;
505117406Skan
506117406Skan/* Nonzero means we should attempt to elide constructors when possible.  */
507117406Skan
508117406Skanextern int flag_elide_constructors;
509117406Skan
510117406Skan/* Nonzero means that member functions defined in class scope are
511117406Skan   inline by default.  */
512117406Skan
513117406Skanextern int flag_default_inline;
514117406Skan
515117406Skan/* Controls whether compiler generates 'type descriptor' that give
516117406Skan   run-time type information.  */
517117406Skan
518117406Skanextern int flag_rtti;
519117406Skan
520117406Skan/* Nonzero if we want to conserve space in the .o files.  We do this
521117406Skan   by putting uninitialized data and runtime initialized data into
522117406Skan   .common instead of .data at the expense of not flagging multiple
523117406Skan   definitions.  */
524117406Skan
525117406Skanextern int flag_conserve_space;
526117406Skan
527117406Skan/* Nonzero if we want to obey access control semantics.  */
528117406Skan
529117406Skanextern int flag_access_control;
530117406Skan
531117406Skan/* Nonzero if we want to check the return value of new and avoid calling
532117406Skan   constructors if it is a null pointer.  */
533117406Skan
534117406Skanextern int flag_check_new;
535117406Skan
536117406Skan/* Nonzero if we want the new ISO rules for pushing a new scope for `for'
537117406Skan   initialization variables.
538117406Skan   0: Old rules, set by -fno-for-scope.
539117406Skan   2: New ISO rules, set by -ffor-scope.
540117406Skan   1: Try to implement new ISO rules, but with backup compatibility
541117406Skan   (and warnings).  This is the default, for now.  */
542117406Skan
543117406Skanextern int flag_new_for_scope;
544117406Skan
545117406Skan/* Nonzero if we want to emit defined symbols with common-like linkage as
546117406Skan   weak symbols where possible, in order to conform to C++ semantics.
547117406Skan   Otherwise, emit them as local symbols.  */
548117406Skan
549117406Skanextern int flag_weak;
550117406Skan
551132729Skan/* 0 means we want the preprocessor to not emit line directives for
552132729Skan   the current working directory.  1 means we want it to do it.  -1
553132729Skan   means we should decide depending on whether debugging information
554132729Skan   is being emitted or not.  */
555132729Skan
556132729Skanextern int flag_working_directory;
557132729Skan
558117406Skan/* Nonzero to use __cxa_atexit, rather than atexit, to register
559117406Skan   destructors for local statics and global objects.  */
560117406Skan
561117406Skanextern int flag_use_cxa_atexit;
562117406Skan
563169699Skan/* Nonzero to use __cxa_get_exception_ptr in the C++ exception-handling
564169699Skan   logic.  */
565169699Skan
566169699Skanextern int flag_use_cxa_get_exception_ptr;
567169699Skan
568117406Skan/* Nonzero means make the default pedwarns warnings instead of errors.
569117406Skan   The value of this flag is ignored if -pedantic is specified.  */
570117406Skan
571117406Skanextern int flag_permissive;
572117406Skan
573117406Skan/* Nonzero means to implement standard semantics for exception
574117406Skan   specifications, calling unexpected if an exception is thrown that
575117406Skan   doesn't match the specification.  Zero means to treat them as
576117406Skan   assertions and optimize accordingly, but not check them.  */
577117406Skan
578117406Skanextern int flag_enforce_eh_specs;
579117406Skan
580169699Skan/* Nonzero (the default) means to generate thread-safe code for
581169699Skan   initializing local statics.  */
582117406Skan
583169699Skanextern int flag_threadsafe_statics;
584117406Skan
585117406Skan/* Nonzero means warn about implicit declarations.  */
586117406Skan
587117406Skanextern int warn_implicit;
588117406Skan
589169699Skan/* Warn about using __null (as NULL in C++) as sentinel.  For code compiled
590169699Skan   with GCC this doesn't matter as __null is guaranteed to have the right
591169699Skan   size.  */
592117406Skan
593169699Skanextern int warn_strict_null_sentinel;
594117406Skan
595117406Skan/* Maximum template instantiation depth.  This limit is rather
596117406Skan   arbitrary, but it exists to limit the time it takes to notice
597117406Skan   infinite template instantiations.  */
598117406Skan
599117406Skanextern int max_tinst_depth;
600117406Skan
601103452Skan/* Nonzero means the expression being parsed will never be evaluated.
602103452Skan   This is a count, since unevaluated expressions can nest.  */
603103452Skan
604103452Skanextern int skip_evaluation;
605103452Skan
60690075Sobrien/* C types are partitioned into three subsets: object, function, and
60790075Sobrien   incomplete types.  */
60890075Sobrien#define C_TYPE_OBJECT_P(type) \
60990075Sobrien  (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type))
61090075Sobrien
61190075Sobrien#define C_TYPE_INCOMPLETE_P(type) \
61290075Sobrien  (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0)
61390075Sobrien
61490075Sobrien#define C_TYPE_FUNCTION_P(type) \
61590075Sobrien  (TREE_CODE (type) == FUNCTION_TYPE)
61690075Sobrien
61790075Sobrien/* For convenience we define a single macro to identify the class of
61890075Sobrien   object or incomplete types.  */
61990075Sobrien#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
62090075Sobrien  (!C_TYPE_FUNCTION_P (type))
62190075Sobrien
622117406Skan/* Attribute table common to the C front ends.  */
623117406Skanextern const struct attribute_spec c_common_attribute_table[];
624117406Skanextern const struct attribute_spec c_common_format_attribute_table[];
625117406Skan
62690075Sobrien/* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
62790075Sobrien   ID is the identifier to use, NAME is the string.
62890075Sobrien   TYPE_DEP indicates whether it depends on type of the function or not
62990075Sobrien   (i.e. __PRETTY_FUNCTION__).  */
63090075Sobrien
631132729Skanextern tree (*make_fname_decl) (tree, int);
63290075Sobrien
633132729Skanextern tree identifier_global_value (tree);
634132729Skanextern void record_builtin_type (enum rid, const char *, tree);
635132729Skanextern tree build_void_list_node (void);
636132729Skanextern void start_fname_decls (void);
637132729Skanextern void finish_fname_decls (void);
638132729Skanextern const char *fname_as_string (int);
639132729Skanextern tree fname_decl (unsigned, tree);
64090075Sobrien
641169699Skanextern void check_function_arguments (tree, tree, tree);
642132729Skanextern void check_function_arguments_recurse (void (*)
643132729Skan					      (void *, tree,
644132729Skan					       unsigned HOST_WIDE_INT),
645132729Skan					      void *, tree,
646132729Skan					      unsigned HOST_WIDE_INT);
647169699Skanextern void check_function_format (tree, tree);
648132729Skanextern void set_Wformat (int);
649132729Skanextern tree handle_format_attribute (tree *, tree, tree, int, bool *);
650132729Skanextern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
651132729Skanextern int c_common_handle_option (size_t code, const char *arg, int value);
652132729Skanextern bool c_common_missing_argument (const char *opt, size_t code);
653132729Skanextern tree c_common_type_for_mode (enum machine_mode, int);
654132729Skanextern tree c_common_type_for_size (unsigned int, int);
655132729Skanextern tree c_common_unsigned_type (tree);
656132729Skanextern tree c_common_signed_type (tree);
657132729Skanextern tree c_common_signed_or_unsigned_type (int, tree);
658169699Skanextern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
659132729Skanextern tree c_common_truthvalue_conversion (tree);
660132729Skanextern void c_apply_type_quals_to_decl (int, tree);
661169699Skanextern tree c_sizeof_or_alignof_type (tree, bool, int);
662132729Skanextern tree c_alignof_expr (tree);
66390075Sobrien/* Print an error message for invalid operands to arith operation CODE.
66490075Sobrien   NOP_EXPR is used as a special case (see truthvalue_conversion).  */
665259947Spfgextern void binary_op_error (enum tree_code, tree, tree);
666132729Skanextern tree fix_string_type (tree);
667117406Skanstruct varray_head_tag;
668132729Skanextern void constant_expression_warning (tree);
669259405Spfgextern bool strict_aliasing_warning (tree, tree, tree);
670169699Skanextern void empty_body_warning (tree, tree);
671132729Skanextern tree convert_and_check (tree, tree);
672132729Skanextern void overflow_warning (tree);
673169699Skanextern bool c_determine_visibility (tree);
674169699Skanextern bool same_scalar_type_ignoring_signedness (tree, tree);
67590075Sobrien
676169699Skan#define c_sizeof(T)  c_sizeof_or_alignof_type (T, true, 1)
677169699Skan#define c_alignof(T) c_sizeof_or_alignof_type (T, false, 1)
67890075Sobrien
67990075Sobrien/* Subroutine of build_binary_op, used for comparison operations.
68090075Sobrien   See if the operands have both been converted from subword integer types
68190075Sobrien   and, if so, perhaps change them both back to their original type.  */
682132729Skanextern tree shorten_compare (tree *, tree *, tree *, enum tree_code *);
68390075Sobrien
684132729Skanextern tree pointer_int_sum (enum tree_code, tree, tree);
685132729Skanextern unsigned int min_precision (tree, int);
68690075Sobrien
68790075Sobrien/* Add qualifiers to a type, in the fashion for C.  */
688132729Skanextern tree c_build_qualified_type (tree, int);
68990075Sobrien
69090075Sobrien/* Build tree nodes and builtin functions common to both C and C++ language
69190075Sobrien   frontends.  */
692132729Skanextern void c_common_nodes_and_builtins (void);
69390075Sobrien
694169699Skanextern void set_builtin_user_assembler_name (tree decl, const char *asmspec);
695169699Skan
696132729Skanextern void disable_builtin_function (const char *);
69790075Sobrien
698169699Skanextern void set_compound_literal_name (tree decl);
699169699Skan
700132729Skanextern tree build_va_arg (tree, tree);
70190075Sobrien
702132729Skanextern unsigned int c_common_init_options (unsigned int, const char **);
703132729Skanextern bool c_common_post_options (const char **);
704132729Skanextern bool c_common_init (void);
705132729Skanextern void c_common_finish (void);
706132729Skanextern void c_common_parse_file (int);
707132729Skanextern HOST_WIDE_INT c_common_get_alias_set (tree);
708132729Skanextern void c_register_builtin_type (tree, const char*);
709132729Skanextern bool c_promoting_integer_type_p (tree);
710132729Skanextern int self_promoting_args_p (tree);
711132729Skanextern tree strip_array_types (tree);
712132729Skanextern tree strip_pointer_operator (tree);
713169699Skanextern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
71490075Sobrien
715132729Skan/* This is the basic parsing function.  */
716132729Skanextern void c_parse_file (void);
717132729Skan/* This is misnamed, it actually performs end-of-compilation processing.  */
718132729Skanextern void finish_file	(void);
719132729Skan
720169699Skan
72190075Sobrien/* These macros provide convenient access to the various _STMT nodes.  */
72290075Sobrien
723169699Skan/* Nonzero if a given STATEMENT_LIST represents the outermost binding
724169699Skan   if a statement expression.  */
725169699Skan#define STATEMENT_LIST_STMT_EXPR(NODE) \
726169699Skan  TREE_LANG_FLAG_1 (STATEMENT_LIST_CHECK (NODE))
72790075Sobrien
728169699Skan/* Nonzero if a label has been added to the statement list.  */
729169699Skan#define STATEMENT_LIST_HAS_LABEL(NODE) \
730169699Skan  TREE_LANG_FLAG_3 (STATEMENT_LIST_CHECK (NODE))
73190075Sobrien
73290075Sobrien/* COMPOUND_LITERAL_EXPR accessors.  */
73390075Sobrien#define COMPOUND_LITERAL_EXPR_DECL_STMT(NODE)		\
73490075Sobrien  TREE_OPERAND (COMPOUND_LITERAL_EXPR_CHECK (NODE), 0)
73590075Sobrien#define COMPOUND_LITERAL_EXPR_DECL(NODE)			\
736169699Skan  DECL_EXPR_DECL (COMPOUND_LITERAL_EXPR_DECL_STMT (NODE))
73790075Sobrien
73890075Sobrien#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
73990075Sobrien
74090075Sobrienenum c_tree_code {
74190075Sobrien  C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
74290075Sobrien#include "c-common.def"
74390075Sobrien  LAST_C_TREE_CODE
74490075Sobrien};
74590075Sobrien
74690075Sobrien#undef DEFTREECODE
74790075Sobrien
748132729Skanextern int anon_aggr_type_p (tree);
749132729Skan
75090075Sobrien/* For a VAR_DECL that is an anonymous union, these are the various
75190075Sobrien   sub-variables that make up the anonymous union.  */
75290075Sobrien#define DECL_ANON_UNION_ELEMS(NODE) DECL_ARGUMENTS ((NODE))
75390075Sobrien
75490075Sobrien/* In a FIELD_DECL, nonzero if the decl was originally a bitfield.  */
75590075Sobrien#define DECL_C_BIT_FIELD(NODE) \
75690075Sobrien  (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) == 1)
75790075Sobrien#define SET_DECL_C_BIT_FIELD(NODE) \
75890075Sobrien  (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 1)
75990075Sobrien#define CLEAR_DECL_C_BIT_FIELD(NODE) \
76090075Sobrien  (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0)
76190075Sobrien
762132729Skanextern void emit_local_var (tree);
763132729Skanextern tree do_case (tree, tree);
764132729Skanextern tree build_stmt (enum tree_code, ...);
765132729Skanextern tree build_case_label (tree, tree, tree);
76690075Sobrien
76790075Sobrien/* These functions must be defined by each front-end which implements
76890075Sobrien   a variant of the C language.  They are used in c-common.c.  */
76990075Sobrien
770132729Skanextern tree build_unary_op (enum tree_code, tree, int);
771132729Skanextern tree build_binary_op (enum tree_code, tree, tree, int);
772169699Skanextern tree perform_integral_promotions (tree);
773169699Skan
774169699Skan/* These functions must be defined by each front-end which implements
775169699Skan   a variant of the C language.  They are used by port files.  */
776169699Skan
777132729Skanextern tree default_conversion (tree);
77890075Sobrien
77990075Sobrien/* Given two integer or real types, return the type for their sum.
78090075Sobrien   Given two compatible ANSI C types, returns the merged type.  */
78190075Sobrien
782132729Skanextern tree common_type (tree, tree);
78390075Sobrien
784132729Skanextern tree decl_constant_value (tree);
78590075Sobrien
78690075Sobrien/* Handle increment and decrement of boolean types.  */
787132729Skanextern tree boolean_increment (enum tree_code, tree);
78890075Sobrien
789132729Skanextern int case_compare (splay_tree_key, splay_tree_key);
79090075Sobrien
791169699Skanextern tree c_add_case_label (splay_tree, tree, tree, tree, tree);
79290075Sobrien
793169699Skanextern void c_do_switch_warnings (splay_tree, location_t, tree, tree);
794169699Skan
795132729Skanextern tree build_function_call (tree, tree);
79690075Sobrien
797169699Skanextern tree resolve_overloaded_builtin (tree, tree);
798169699Skan
799132729Skanextern tree finish_label_address_expr (tree);
80090075Sobrien
80190075Sobrien/* Same function prototype, but the C and C++ front ends have
80290075Sobrien   different implementations.  Used in c-common.c.  */
803132729Skanextern tree lookup_label (tree);
804169699Skanextern tree lookup_name (tree);
80590075Sobrien
806260074Spfgextern bool vector_types_convertible_p (tree t1, tree t2, bool emit_lax_note);
807161660Skan
808132729Skanextern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
80990075Sobrien
810169699Skanextern tree c_staticp (tree);
81190075Sobrien
812132729Skanextern void init_c_lex (void);
813117406Skan
814132729Skanextern void c_cpp_builtins (cpp_reader *);
815117406Skan
816132729Skan/* Positive if an implicit `extern "C"' scope has just been entered;
817132729Skan   negative if such a scope has just been exited.  */
818169699Skanextern GTY(()) int pending_lang_change;
819132729Skan
82090075Sobrien/* Information recorded about each file examined during compilation.  */
82190075Sobrien
82290075Sobrienstruct c_fileinfo
82390075Sobrien{
82490075Sobrien  int time;	/* Time spent in the file.  */
825169699Skan
826169699Skan  /* Flags used only by C++.
827169699Skan     INTERFACE_ONLY nonzero means that we are in an "interface" section
828169699Skan     of the compiler.  INTERFACE_UNKNOWN nonzero means we cannot trust
829169699Skan     the value of INTERFACE_ONLY.  If INTERFACE_UNKNOWN is zero and
830169699Skan     INTERFACE_ONLY is zero, it means that we are responsible for
831169699Skan     exporting definitions that others might need.  */
832169699Skan  short interface_only;
83390075Sobrien  short interface_unknown;
83490075Sobrien};
83590075Sobrien
836132729Skanstruct c_fileinfo *get_fileinfo (const char *);
837132729Skanextern void dump_time_statistics (void);
83890075Sobrien
839132729Skanextern bool c_dump_tree (void *, tree);
840117406Skan
841169699Skanextern void c_warn_unused_result (tree *);
842169699Skan
843169699Skanextern void verify_sequence_points (tree);
844169699Skan
845169699Skanextern tree fold_offsetof (tree, tree);
846169699Skan
847169699Skan/* Places where an lvalue, or modifiable lvalue, may be required.
848169699Skan   Used to select diagnostic messages in lvalue_error and
849169699Skan   readonly_error.  */
850169699Skanenum lvalue_use {
851169699Skan  lv_assign,
852169699Skan  lv_increment,
853169699Skan  lv_decrement,
854169699Skan  lv_addressof,
855169699Skan  lv_asm
856169699Skan};
857169699Skan
858169699Skanextern void lvalue_error (enum lvalue_use);
859169699Skan
860169699Skanextern int complete_array_type (tree *, tree, bool);
861169699Skan
862169699Skanextern tree builtin_type_for_size (int, bool);
863169699Skan
864169699Skanextern void warn_array_subscript_with_type_char (tree);
865259268Spfgextern void warn_about_parentheses (enum tree_code, enum tree_code,
866259268Spfg				    enum tree_code);
867169699Skan
868259268Spfg
869169699Skan/* In c-gimplify.c  */
870169699Skanextern void c_genericize (tree);
871169699Skanextern int c_gimplify_expr (tree *, tree *, tree *);
872169699Skanextern tree c_build_bind_expr (tree, tree);
873169699Skan
874169699Skan/* In c-pch.c  */
875132729Skanextern void pch_init (void);
876132729Skanextern int c_common_valid_pch (cpp_reader *pfile, const char *name, int fd);
877132729Skanextern void c_common_read_pch (cpp_reader *pfile, const char *name, int fd,
878132729Skan			       const char *orig);
879132729Skanextern void c_common_write_pch (void);
880132729Skanextern void c_common_no_more_pch (void);
881169699Skanextern void c_common_pch_pragma (cpp_reader *pfile, const char *);
882169699Skanextern void c_common_print_pch_checksum (FILE *f);
883169699Skan
884169699Skan/* In *-checksum.c */
885169699Skanextern const unsigned char executable_checksum[16];
886169699Skan
887132729Skanextern void builtin_define_with_value (const char *, const char *, int);
888132729Skanextern void c_stddef_cpp_builtins (void);
889132729Skanextern void fe_file_change (const struct line_map *);
890132729Skanextern void c_parse_error (const char *, enum cpp_ttype, tree);
891132729Skan
892169699Skan/* Objective-C / Objective-C++ entry points.  */
893169699Skan
894169699Skan/* The following ObjC/ObjC++ functions are called by the C and/or C++
895169699Skan   front-ends; they all must have corresponding stubs in stub-objc.c.  */
896169699Skanextern tree objc_is_class_name (tree);
897132729Skanextern tree objc_is_object_ptr (tree);
898132729Skanextern void objc_check_decl (tree);
899261188Spfg/* APPLE LOCAL radar 4281748 */
900261188Spfgextern void objc_check_global_decl (tree);
901169699Skanextern int objc_is_reserved_word (tree);
902261188Spfg/* APPLE LOCAL 4154928 */
903261188Spfgextern tree objc_common_type (tree, tree);
904261188Spfg/* APPLE LOCAL 4330422 */
905261188Spfgextern tree objc_non_volatilized_type (tree);
906261188Spfg/* APPLE LOCAL radar 4697411 */
907261188Spfgextern void objc_volatilize_component_ref (tree, tree);
908261188Spfg/* APPLE LOCAL radar 6231433 */
909261188Spfgextern bool objc_compare_types (tree, tree, int, tree, const char *);
910261188Spfg/* APPLE LOCAL radar 4229905 - radar 6231433 */
911261188Spfgextern bool objc_have_common_type (tree, tree, int, tree, const char *);
912261188Spfg/* APPLE LOCAL radar 4133425 */
913261188Spfgextern bool objc_diagnose_private_ivar (tree);
914261188Spfg/* APPLE LOCAL radar 4507230 */
915261188Spfgbool objc_type_valid_for_messaging (tree);
916169699Skanextern void objc_volatilize_decl (tree);
917169699Skanextern bool objc_type_quals_match (tree, tree);
918169699Skanextern tree objc_rewrite_function_call (tree, tree);
919132729Skanextern tree objc_message_selector (void);
920169699Skanextern tree objc_lookup_ivar (tree, tree);
921169699Skanextern void objc_clear_super_receiver (void);
922169699Skanextern int objc_is_public (tree, tree);
923169699Skanextern tree objc_is_id (tree);
924169699Skanextern void objc_declare_alias (tree, tree);
925169699Skanextern void objc_declare_class (tree);
926261188Spfg/* APPLE LOCAL radar 4947311 - protocol attributes */
927261188Spfgextern void objc_declare_protocols (tree, tree);
928169699Skanextern tree objc_build_message_expr (tree);
929169699Skanextern tree objc_finish_message_expr (tree, tree, tree);
930169699Skanextern tree objc_build_selector_expr (tree);
931169699Skanextern tree objc_build_protocol_expr (tree);
932169699Skanextern tree objc_build_encode_expr (tree);
933169699Skanextern tree objc_build_string_object (tree);
934169699Skanextern tree objc_get_protocol_qualified_type (tree, tree);
935169699Skanextern tree objc_get_class_reference (tree);
936169699Skanextern tree objc_get_class_ivars (tree);
937261188Spfg/* APPLE LOCAL begin radar 4291785 */
938261188Spfgextern tree objc_get_interface_ivars (tree);
939261188Spfgextern void objc_detect_field_duplicates (tree);
940261188Spfg/* APPLE LOCAL end radar 4291785 */
941261188Spfg/* APPLE LOCAL radar 4548636 */
942261188Spfgextern void objc_start_class_interface (tree, tree, tree, tree);
943169699Skanextern void objc_start_category_interface (tree, tree, tree);
944261188Spfg/* APPLE LOCAL radar 4947311 - protocol attributes */
945261188Spfgextern void objc_start_protocol (tree, tree, tree);
946169699Skanextern void objc_continue_interface (void);
947169699Skanextern void objc_finish_interface (void);
948169699Skanextern void objc_start_class_implementation (tree, tree);
949169699Skanextern void objc_start_category_implementation (tree, tree);
950261188Spfg/* APPLE LOCAL radar 4592503 */
951261188Spfgextern void objc_checkon_weak_attribute (tree);
952261188Spfg/* APPLE LOCAL begin radar 5847976 */
953261188Spfgextern tree build_block_object_assign_call_exp (tree, tree, int);
954261188Spfgextern tree build_block_object_dispose_call_exp (tree, int);
955261188Spfgextern int objc_is_gcable_type (tree);
956261188Spfg/* APPLE LOCAL end radar 5847976 */
957169699Skanextern void objc_continue_implementation (void);
958169699Skanextern void objc_finish_implementation (void);
959169699Skanextern void objc_set_visibility (int);
960169699Skanextern void objc_set_method_type (enum tree_code);
961169699Skanextern tree objc_build_method_signature (tree, tree, tree, bool);
962261188Spfg/* APPLE LOCAL begin radar 3803157 - objc attribute */
963261188Spfgextern bool objc_method_decl (enum tree_code);
964261188Spfgextern void objc_add_method_declaration (tree, tree);
965261188Spfgextern void objc_start_method_definition (tree, tree);
966261188Spfg/* APPLE LOCAL end radar 3803157 - objc attribute */
967169699Skanextern void objc_finish_method_definition (tree);
968169699Skanextern void objc_add_instance_variable (tree);
969261188Spfg/* APPLE LOCAL radar 4157812 */
970261188Spfgextern tree objc_build_keyword_decl (tree, tree, tree, tree);
971169699Skanextern tree objc_build_throw_stmt (tree);
972169699Skanextern void objc_begin_try_stmt (location_t, tree);
973169699Skanextern tree objc_finish_try_stmt (void);
974169699Skanextern void objc_begin_catch_clause (tree);
975169699Skanextern void objc_finish_catch_clause (void);
976169699Skanextern void objc_build_finally_clause (location_t, tree);
977169699Skanextern tree objc_build_synchronized (location_t, tree, tree);
978169699Skanextern int objc_static_init_needed_p (void);
979169699Skanextern tree objc_generate_static_init_call (tree);
980169699Skanextern tree objc_generate_write_barrier (tree, enum tree_code, tree);
981261188Spfg/* APPLE LOCAL radar 5276085 */
982261188Spfgextern void objc_weak_reference_expr (tree*);
983261188Spfg/* APPLE LOCAL begin 5276085 */
984261188Spfgextern tree objc_build_weak_reference_tree (tree);
985261188Spfg/* APPLE LOCAL end 5276085 */
986169699Skan
987261188Spfg/* APPLE LOCAL begin C* language */
988261188Spfgextern void objc_set_method_opt (int);
989261188Spfgvoid objc_finish_foreach_loop (location_t, tree, tree, tree, tree);
990261188Spfgtree objc_build_component_ref (tree, tree);
991261188Spfgtree objc_build_foreach_components (tree, tree*, tree*, tree*,
992261188Spfg				     tree*, tree*, tree*);
993261188Spfg/* APPLE LOCAL end C* language */
994261188Spfg/* APPLE LOCAL begin C* property (Radar 4436866) */
995261188Spfgvoid objc_set_property_attr (int, tree);
996261188Spfgvoid objc_add_property_variable (tree);
997261188Spfg/* APPLE LOCAL begin radar 5285911 */
998261188Spfgtree objc_build_property_reference_expr (tree, tree);
999261188Spfgbool objc_property_reference_expr (tree);
1000261188Spfg/* APPLE LOCAL end radar 5285911 */
1001261188Spfg/* APPLE LOCAL radar 5802025 */
1002261188Spfgtree objc_build_property_getter_func_call (tree);
1003261188Spfgtree objc_build_setter_call (tree, tree);
1004261188Spfg/* APPLE LOCAL end C* property (Radar 4436866) */
1005261188Spfg/* APPLE LOCAL radar 4712269 */
1006261188Spfgtree objc_build_incr_decr_setter_call (enum tree_code, tree, tree);
1007261188Spfg
1008261188Spfg/* APPLE LOCAL begin C* warnings to easy porting to new abi */
1009261188Spfgvoid diagnose_selector_cast (tree cast_type, tree sel_exp);
1010261188Spfg/* APPLE LOCAL end C* warnings to easy porting to new abi */
1011261188Spfg
1012261188Spfg/* APPLE LOCAL begin radar 4441049 */
1013261188Spfgtree objc_v2_component_ref_field_offset (tree);
1014261188Spfgtree objc_v2_bitfield_ivar_bitpos (tree);
1015261188Spfg/* APPLE LOCAL end radar 4441049 */
1016261188Spfg
1017261188Spfg/* APPLE LOCAL begin 4985544 */
1018261188Spfgbool objc_check_format_nsstring (tree, unsigned HOST_WIDE_INT, bool *);
1019261188Spfg/* APPLE LOCAL end 4985544 */
1020261188Spfg
1021261188Spfg/* APPLE LOCAL radar 5202926 */
1022261188Spfgbool objc_anonymous_local_objc_name (const char *);
1023261188Spfg/* APPLE LOCAL begin radar 5195402 */
1024261188Spfgbool objc_check_nsstring_pointer_type (tree);
1025261188Spfgbool objc_check_cfstringref_type (tree);
1026261188Spfg/* APPLE LOCAL end radar 5195402 */
1027261188Spfg
1028169699Skan/* The following are provided by the C and C++ front-ends, and called by
1029169699Skan   ObjC/ObjC++.  */
1030169699Skanextern void *objc_get_current_scope (void);
1031132729Skanextern void objc_mark_locals_volatile (void *);
1032132729Skan
1033132729Skan/* In c-ppoutput.c  */
1034132729Skanextern void init_pp_output (FILE *);
1035132729Skanextern void preprocess_file (cpp_reader *);
1036132729Skanextern void pp_file_change (const struct line_map *);
1037132729Skanextern void pp_dir_change (cpp_reader *, const char *);
1038169699Skanextern bool check_missing_format_attribute (tree, tree);
1039132729Skan
1040261188Spfg
1041261188Spfg/* APPLE LOCAL begin radar 5847976 */
1042261188Spfg/* Runtime support functions used by compiler when generating copy/dispose helpers */
1043261188Spfgenum {
1044261188Spfg    BLOCK_FIELD_IS_OBJECT   =  3,  /* id, NSObject, __attribute__((NSObject)), block, ... */
1045261188Spfg    BLOCK_FIELD_IS_BLOCK    =  7,  /* a block variable */
1046261188Spfg    BLOCK_FIELD_IS_BYREF    =  8,  /* the on stack structure holding the __block variable */
1047261188Spfg    BLOCK_FIELD_IS_WEAK     = 16,  /* declared __weak, only used in byref copy helpers */
1048261188Spfg    BLOCK_BYREF_CALLER      = 128,  /* called from __block (byref) copy/dispose support routines */
1049261188Spfg    BLOCK_BYREF_CURRENT_MAX = 256
1050261188Spfg};
1051261188Spfg/* APPLE LOCAL end radar 5847976 */
1052261188Spfg/* APPLE LOCAL begin radar 5732232 - blocks */
1053261188Spfgenum {
1054261188Spfg     BLOCK_NEEDS_FREE =        (1 << 24),
1055261188Spfg     BLOCK_HAS_COPY_DISPOSE =  (1 << 25),
1056261188Spfg     /* APPLE LOCAL radar 6214617 */
1057261188Spfg     BLOCK_HAS_CXX_OBJ =       (1 << 26),
1058261188Spfg     BLOCK_IS_GC =             (1 << 27),
1059261188Spfg     /* APPLE LOCAL radar 5822844 */
1060261188Spfg     BLOCK_IS_GLOBAL = 	       (1 << 28),
1061261188Spfg     /* APPLE LOCAL radar 7735196 */
1062261188Spfg     BLOCK_USE_STRET =    (1 << 29)
1063261188Spfg};
1064261188Spfg
1065261188Spfgstruct block_sema_info {
1066261188Spfg  tree helper_func_decl;
1067261188Spfg  tree copy_helper_func_decl;
1068261188Spfg  tree destroy_helper_func_decl;
1069261188Spfg  tree block_arg_ptr_type;
1070261188Spfg  /* This is for C.  */
1071261188Spfg  struct c_arg_info * arg_info;
1072261188Spfg  tree block_ref_decl_list;
1073261188Spfg  tree block_byref_decl_list;
1074261188Spfg  /* APPLE LOCAL radar 5803600 */
1075261188Spfg  tree block_byref_global_decl_list;
1076261188Spfg  tree block_original_ref_decl_list;
1077261188Spfg  /* APPLE LOCAL radar 5847213 - tree block_original_byref_decl_list is removed. */
1078261188Spfg  tree block_body;
1079261188Spfg  bool BlockHasCopyDispose;
1080261188Spfg  /* APPLE LOCAL radar 6214617 */
1081261188Spfg  bool BlockImportsCxxObjects;
1082261188Spfg  /* APPLE LOCAL radar 6185344 */
1083261188Spfg  bool block_has_return_type; /* When true, block has a declared return type. */
1084261188Spfg
1085261188Spfg  /* the_scope - This is the scope for the block itself, which
1086261188Spfg     contains arguments etc.  Use only for C.  */
1087261188Spfg  struct c_scope *the_scope;
1088261188Spfg  /* Same as the above, only for C++.  */
1089261188Spfg  struct cp_binding_level *cp_the_scope;
1090261188Spfg
1091261188Spfg  /* return_type - This will get set to block result type, by looking
1092261188Spfg     at return types, if any, in the block body. */
1093261188Spfg  tree return_type;
1094261188Spfg
1095261188Spfg  /* prev_block_info - If this is nested inside another block, this points
1096261188Spfg     to the outer block. */
1097261188Spfg  struct block_sema_info *prev_block_info;
1098261188Spfg};
1099261188Spfg
1100261188Spfgextern struct block_sema_info *cur_block;
1101261188Spfgextern tree build_helper_func_decl (tree, tree);
1102261188Spfgextern tree build_block_byref_decl (tree, tree, tree);
1103261188Spfgextern tree build_block_ref_decl (tree, tree);
1104261188Spfgextern tree begin_block (void);
1105261188Spfgextern struct block_sema_info *finish_block (tree);
1106261188Spfgextern bool in_imm_block (void);
1107261188Spfgextern bool lookup_name_in_block (tree, tree*);
1108261188Spfgextern void push_to_top_level (void);
1109261188Spfgextern void pop_from_top_level (void);
1110261188Spfgextern void start_block_helper_function (tree func_decl);
1111261188Spfgextern void block_build_prologue (struct block_sema_info *block_impl);
1112261188Spfgextern tree c_finish_return (tree);
1113261188Spfgextern bool block_requires_copying (tree);
1114261188Spfg/* APPLE LOCAL begin radar 5803600 */
1115261188Spfgextern void add_block_global_byref_list (tree);
1116261188Spfgextern bool in_block_global_byref_list (tree);
1117261188Spfg/* APPLE LOCAL end radar 5803600 */
1118261188Spfg/* APPLE LOCAL end radar 5732232 - blocks */
1119261188Spfg/* APPLE LOCAL begin radar 5932809 - copyable byref blocks */
1120261188Spfgextern tree build_byref_local_var_access (tree, tree);
1121261188Spfgextern tree do_digest_init (tree, tree);
1122261188Spfg/* APPLE LOCAL end radar 5932809 - copyable byref blocks */
1123261188Spfg/* APPLE LOCAL begin radar 6237713 */
1124261188Spfgextern bool any_recognized_block_attribute (tree);
1125261188Spfg/* APPLE LOCAL end radar 6237713 */
1126261188Spfg
1127261188Spfg/* APPLE LOCAL begin radar 5847213 */
1128261188Spfgextern tree build_block_descriptor_type (bool);
1129261188Spfg/* APPLE LOCAL end radar 5847213 */
1130261188Spfg/* APPLE LOCAL begin radar 6083129 - byref escapes */
1131261188Spfgextern tree build_block_byref_release_exp (tree);
1132261188Spfg/* APPLE LOCAL end radar 6083129 - byref escapes */
1133261188Spfg
1134261188Spfg/* APPLE LOCAL radar 6040305 - blocks */
1135261188Spfgextern tree build_indirect_object_id_exp (tree);
1136261188Spfg/* APPLE LOCAL begin radar 6212722 */
1137261188Spfgextern tree array_to_pointer_conversion (tree);
1138261188Spfgextern tree function_to_pointer_conversion (tree);
1139261188Spfg/* APPLE LOCAL end radar 6212722 */
1140261188Spfg
1141261188Spfg/* APPLE LOCAL radar 6160536 */
1142261188Spfgextern tree build_block_helper_name (int);
1143261188Spfg
1144261188Spfg/* APPLE LOCAL radar 6353006  */
1145261188Spfgextern tree c_build_generic_block_struct_type (void);
1146261188Spfg
1147261188Spfg/* APPLE LOCAL radar 7760213 */
1148261188Spfgextern int HasByrefArray(tree);
1149261188Spfg
1150169699Skan/* In c-omp.c  */
1151169699Skanextern tree c_finish_omp_master (tree);
1152169699Skanextern tree c_finish_omp_critical (tree, tree);
1153169699Skanextern tree c_finish_omp_ordered (tree);
1154169699Skanextern void c_finish_omp_barrier (void);
1155169699Skanextern tree c_finish_omp_atomic (enum tree_code, tree, tree);
1156169699Skanextern void c_finish_omp_flush (void);
1157169699Skanextern tree c_finish_omp_for (location_t, tree, tree, tree, tree, tree, tree);
1158169699Skanextern void c_split_parallel_clauses (tree, tree *, tree *);
1159169699Skanextern enum omp_clause_default_kind c_omp_predetermined_sharing (tree);
1160169699Skan
1161169699Skan/* Not in c-omp.c; provided by the front end.  */
1162169699Skanextern bool c_omp_sharing_predetermined (tree);
1163169699Skanextern tree c_omp_remap_decl (tree, bool);
1164169699Skan
1165169699Skan/* In order for the format checking to accept the C frontend
1166169699Skan   diagnostic framework extensions, you must include this file before
1167169699Skan   toplev.h, not after.  The C front end formats are a subset of those
1168169699Skan   for C++, so they are the appropriate set to use in common code;
1169169699Skan   cp-tree.h overrides this for C++.  */
1170169699Skan#ifndef GCC_DIAG_STYLE
1171169699Skan#define GCC_DIAG_STYLE __gcc_cdiag__
1172169699Skan#endif
1173169699Skan
117490075Sobrien#endif /* ! GCC_C_COMMON_H */
1175