xref: /dflybsd-src/contrib/gcc-4.7/gcc/c-family/c-common.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Definitions for c-common.c.
2*e4b17023SJohn Marino    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
3*e4b17023SJohn Marino    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
4*e4b17023SJohn Marino    Free Software Foundation, Inc.
5*e4b17023SJohn Marino 
6*e4b17023SJohn Marino This file is part of GCC.
7*e4b17023SJohn Marino 
8*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
9*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
10*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
11*e4b17023SJohn Marino version.
12*e4b17023SJohn Marino 
13*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
15*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16*e4b17023SJohn Marino for more details.
17*e4b17023SJohn Marino 
18*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
19*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
20*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
21*e4b17023SJohn Marino 
22*e4b17023SJohn Marino #ifndef GCC_C_COMMON_H
23*e4b17023SJohn Marino #define GCC_C_COMMON_H
24*e4b17023SJohn Marino 
25*e4b17023SJohn Marino #include "splay-tree.h"
26*e4b17023SJohn Marino #include "cpplib.h"
27*e4b17023SJohn Marino #include "ggc.h"
28*e4b17023SJohn Marino 
29*e4b17023SJohn Marino /* In order for the format checking to accept the C frontend
30*e4b17023SJohn Marino    diagnostic framework extensions, you must include this file before
31*e4b17023SJohn Marino    diagnostic-core.h, not after.  The C front end formats are a subset of those
32*e4b17023SJohn Marino    for C++, so they are the appropriate set to use in common code;
33*e4b17023SJohn Marino    cp-tree.h overrides this for C++.  */
34*e4b17023SJohn Marino #if defined(GCC_DIAGNOSTIC_CORE_H)
35*e4b17023SJohn Marino #error \
36*e4b17023SJohn Marino In order for the format checking to accept the C front end diagnostic \
37*e4b17023SJohn Marino framework extensions, you must include this file before diagnostic-core.h \
38*e4b17023SJohn Marino never after.
39*e4b17023SJohn Marino #endif
40*e4b17023SJohn Marino #ifndef GCC_DIAG_STYLE
41*e4b17023SJohn Marino #define GCC_DIAG_STYLE __gcc_cdiag__
42*e4b17023SJohn Marino #endif
43*e4b17023SJohn Marino #include "diagnostic-core.h"
44*e4b17023SJohn Marino 
45*e4b17023SJohn Marino /* Usage of TREE_LANG_FLAG_?:
46*e4b17023SJohn Marino    0: IDENTIFIER_MARKED (used by search routines).
47*e4b17023SJohn Marino       DECL_PRETTY_FUNCTION_P (in VAR_DECL)
48*e4b17023SJohn Marino       C_MAYBE_CONST_EXPR_INT_OPERANDS (in C_MAYBE_CONST_EXPR, for C)
49*e4b17023SJohn Marino    1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
50*e4b17023SJohn Marino       STATEMENT_LIST_STMT_EXPR (in STATEMENT_LIST)
51*e4b17023SJohn Marino       C_MAYBE_CONST_EXPR_NON_CONST (in C_MAYBE_CONST_EXPR, for C)
52*e4b17023SJohn Marino    2: unused
53*e4b17023SJohn Marino    3: STATEMENT_LIST_HAS_LABEL (in STATEMENT_LIST)
54*e4b17023SJohn Marino    4: unused
55*e4b17023SJohn Marino */
56*e4b17023SJohn Marino 
57*e4b17023SJohn Marino /* Reserved identifiers.  This is the union of all the keywords for C,
58*e4b17023SJohn Marino    C++, and Objective-C.  All the type modifiers have to be in one
59*e4b17023SJohn Marino    block at the beginning, because they are used as mask bits.  There
60*e4b17023SJohn Marino    are 28 type modifiers; if we add many more we will have to redesign
61*e4b17023SJohn Marino    the mask mechanism.  */
62*e4b17023SJohn Marino 
63*e4b17023SJohn Marino enum rid
64*e4b17023SJohn Marino {
65*e4b17023SJohn Marino   /* Modifiers: */
66*e4b17023SJohn Marino   /* C, in empirical order of frequency.  */
67*e4b17023SJohn Marino   RID_STATIC = 0,
68*e4b17023SJohn Marino   RID_UNSIGNED, RID_LONG,    RID_CONST, RID_EXTERN,
69*e4b17023SJohn Marino   RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE,
70*e4b17023SJohn Marino   RID_VOLATILE, RID_SIGNED,  RID_AUTO,  RID_RESTRICT,
71*e4b17023SJohn Marino   RID_NORETURN,
72*e4b17023SJohn Marino 
73*e4b17023SJohn Marino   /* C extensions */
74*e4b17023SJohn Marino   RID_COMPLEX, RID_THREAD, RID_SAT,
75*e4b17023SJohn Marino 
76*e4b17023SJohn Marino   /* C++ */
77*e4b17023SJohn Marino   RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
78*e4b17023SJohn Marino 
79*e4b17023SJohn Marino   /* ObjC ("PQ" reserved words - they do not appear after a '@' and
80*e4b17023SJohn Marino      are keywords only in specific contexts)  */
81*e4b17023SJohn Marino   RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
82*e4b17023SJohn Marino 
83*e4b17023SJohn Marino   /* ObjC ("PATTR" reserved words - they do not appear after a '@'
84*e4b17023SJohn Marino      and are keywords only as property attributes)  */
85*e4b17023SJohn Marino   RID_GETTER, RID_SETTER,
86*e4b17023SJohn Marino   RID_READONLY, RID_READWRITE,
87*e4b17023SJohn Marino   RID_ASSIGN, RID_RETAIN, RID_COPY,
88*e4b17023SJohn Marino   RID_NONATOMIC,
89*e4b17023SJohn Marino 
90*e4b17023SJohn Marino   /* C (reserved and imaginary types not implemented, so any use is a
91*e4b17023SJohn Marino      syntax error) */
92*e4b17023SJohn Marino   RID_IMAGINARY,
93*e4b17023SJohn Marino 
94*e4b17023SJohn Marino   /* C */
95*e4b17023SJohn Marino   RID_INT,     RID_CHAR,   RID_FLOAT,    RID_DOUBLE, RID_VOID,
96*e4b17023SJohn Marino   RID_INT128,
97*e4b17023SJohn Marino   RID_ENUM,    RID_STRUCT, RID_UNION,    RID_IF,     RID_ELSE,
98*e4b17023SJohn Marino   RID_WHILE,   RID_DO,     RID_FOR,      RID_SWITCH, RID_CASE,
99*e4b17023SJohn Marino   RID_DEFAULT, RID_BREAK,  RID_CONTINUE, RID_RETURN, RID_GOTO,
100*e4b17023SJohn Marino   RID_SIZEOF,
101*e4b17023SJohn Marino 
102*e4b17023SJohn Marino   /* C extensions */
103*e4b17023SJohn Marino   RID_ASM,       RID_TYPEOF,   RID_ALIGNOF,  RID_ATTRIBUTE,  RID_VA_ARG,
104*e4b17023SJohn Marino   RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL,      RID_CHOOSE_EXPR,
105*e4b17023SJohn Marino   RID_TYPES_COMPATIBLE_P,      RID_BUILTIN_COMPLEX,	     RID_BUILTIN_SHUFFLE,
106*e4b17023SJohn Marino   RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
107*e4b17023SJohn Marino   RID_FRACT, RID_ACCUM,
108*e4b17023SJohn Marino 
109*e4b17023SJohn Marino   /* C11 */
110*e4b17023SJohn Marino   RID_ALIGNAS,
111*e4b17023SJohn Marino 
112*e4b17023SJohn Marino   /* This means to warn that this is a C++ keyword, and then treat it
113*e4b17023SJohn Marino      as a normal identifier.  */
114*e4b17023SJohn Marino   RID_CXX_COMPAT_WARN,
115*e4b17023SJohn Marino 
116*e4b17023SJohn Marino   /* GNU transactional memory extension */
117*e4b17023SJohn Marino   RID_TRANSACTION_ATOMIC, RID_TRANSACTION_RELAXED, RID_TRANSACTION_CANCEL,
118*e4b17023SJohn Marino 
119*e4b17023SJohn Marino   /* Too many ways of getting the name of a function as a string */
120*e4b17023SJohn Marino   RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
121*e4b17023SJohn Marino 
122*e4b17023SJohn Marino   /* C++ (some of these are keywords in Objective-C as well, but only
123*e4b17023SJohn Marino      if they appear after a '@') */
124*e4b17023SJohn Marino   RID_BOOL,     RID_WCHAR,    RID_CLASS,
125*e4b17023SJohn Marino   RID_PUBLIC,   RID_PRIVATE,  RID_PROTECTED,
126*e4b17023SJohn Marino   RID_TEMPLATE, RID_NULL,     RID_CATCH,
127*e4b17023SJohn Marino   RID_DELETE,   RID_FALSE,    RID_NAMESPACE,
128*e4b17023SJohn Marino   RID_NEW,      RID_OFFSETOF, RID_OPERATOR,
129*e4b17023SJohn Marino   RID_THIS,     RID_THROW,    RID_TRUE,
130*e4b17023SJohn Marino   RID_TRY,      RID_TYPENAME, RID_TYPEID,
131*e4b17023SJohn Marino   RID_USING,    RID_CHAR16,   RID_CHAR32,
132*e4b17023SJohn Marino 
133*e4b17023SJohn Marino   /* casts */
134*e4b17023SJohn Marino   RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST,
135*e4b17023SJohn Marino 
136*e4b17023SJohn Marino   /* C++ extensions */
137*e4b17023SJohn Marino   RID_BASES,                   RID_DIRECT_BASES,
138*e4b17023SJohn Marino   RID_HAS_NOTHROW_ASSIGN,      RID_HAS_NOTHROW_CONSTRUCTOR,
139*e4b17023SJohn Marino   RID_HAS_NOTHROW_COPY,        RID_HAS_TRIVIAL_ASSIGN,
140*e4b17023SJohn Marino   RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY,
141*e4b17023SJohn Marino   RID_HAS_TRIVIAL_DESTRUCTOR,  RID_HAS_VIRTUAL_DESTRUCTOR,
142*e4b17023SJohn Marino   RID_IS_ABSTRACT,             RID_IS_BASE_OF,
143*e4b17023SJohn Marino   RID_IS_CLASS,                RID_IS_CONVERTIBLE_TO,
144*e4b17023SJohn Marino   RID_IS_EMPTY,                RID_IS_ENUM,
145*e4b17023SJohn Marino   RID_IS_FINAL,                RID_IS_LITERAL_TYPE,
146*e4b17023SJohn Marino   RID_IS_POD,                  RID_IS_POLYMORPHIC,
147*e4b17023SJohn Marino   RID_IS_STD_LAYOUT,           RID_IS_TRIVIAL,
148*e4b17023SJohn Marino   RID_IS_UNION,                RID_UNDERLYING_TYPE,
149*e4b17023SJohn Marino 
150*e4b17023SJohn Marino   /* C++11 */
151*e4b17023SJohn Marino   RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT,
152*e4b17023SJohn Marino 
153*e4b17023SJohn Marino   /* Objective-C ("AT" reserved words - they are only keywords when
154*e4b17023SJohn Marino      they follow '@')  */
155*e4b17023SJohn Marino   RID_AT_ENCODE,   RID_AT_END,
156*e4b17023SJohn Marino   RID_AT_CLASS,    RID_AT_ALIAS,     RID_AT_DEFS,
157*e4b17023SJohn Marino   RID_AT_PRIVATE,  RID_AT_PROTECTED, RID_AT_PUBLIC,  RID_AT_PACKAGE,
158*e4b17023SJohn Marino   RID_AT_PROTOCOL, RID_AT_SELECTOR,
159*e4b17023SJohn Marino   RID_AT_THROW,	   RID_AT_TRY,       RID_AT_CATCH,
160*e4b17023SJohn Marino   RID_AT_FINALLY,  RID_AT_SYNCHRONIZED,
161*e4b17023SJohn Marino   RID_AT_OPTIONAL, RID_AT_REQUIRED, RID_AT_PROPERTY,
162*e4b17023SJohn Marino   RID_AT_SYNTHESIZE, RID_AT_DYNAMIC,
163*e4b17023SJohn Marino   RID_AT_INTERFACE,
164*e4b17023SJohn Marino   RID_AT_IMPLEMENTATION,
165*e4b17023SJohn Marino 
166*e4b17023SJohn Marino   /* Named address support, mapping the keyword to a particular named address
167*e4b17023SJohn Marino      number.  Named address space 0 is reserved for the generic address.  If
168*e4b17023SJohn Marino      there are more than 254 named addresses, the addr_space_t type will need
169*e4b17023SJohn Marino      to be grown from an unsigned char to unsigned short.  */
170*e4b17023SJohn Marino   RID_ADDR_SPACE_0,		/* generic address */
171*e4b17023SJohn Marino   RID_ADDR_SPACE_1,
172*e4b17023SJohn Marino   RID_ADDR_SPACE_2,
173*e4b17023SJohn Marino   RID_ADDR_SPACE_3,
174*e4b17023SJohn Marino   RID_ADDR_SPACE_4,
175*e4b17023SJohn Marino   RID_ADDR_SPACE_5,
176*e4b17023SJohn Marino   RID_ADDR_SPACE_6,
177*e4b17023SJohn Marino   RID_ADDR_SPACE_7,
178*e4b17023SJohn Marino   RID_ADDR_SPACE_8,
179*e4b17023SJohn Marino   RID_ADDR_SPACE_9,
180*e4b17023SJohn Marino   RID_ADDR_SPACE_10,
181*e4b17023SJohn Marino   RID_ADDR_SPACE_11,
182*e4b17023SJohn Marino   RID_ADDR_SPACE_12,
183*e4b17023SJohn Marino   RID_ADDR_SPACE_13,
184*e4b17023SJohn Marino   RID_ADDR_SPACE_14,
185*e4b17023SJohn Marino   RID_ADDR_SPACE_15,
186*e4b17023SJohn Marino 
187*e4b17023SJohn Marino   RID_FIRST_ADDR_SPACE = RID_ADDR_SPACE_0,
188*e4b17023SJohn Marino   RID_LAST_ADDR_SPACE = RID_ADDR_SPACE_15,
189*e4b17023SJohn Marino 
190*e4b17023SJohn Marino   RID_MAX,
191*e4b17023SJohn Marino 
192*e4b17023SJohn Marino   RID_FIRST_MODIFIER = RID_STATIC,
193*e4b17023SJohn Marino   RID_LAST_MODIFIER = RID_ONEWAY,
194*e4b17023SJohn Marino 
195*e4b17023SJohn Marino   RID_FIRST_CXX0X = RID_CONSTEXPR,
196*e4b17023SJohn Marino   RID_LAST_CXX0X = RID_STATIC_ASSERT,
197*e4b17023SJohn Marino   RID_FIRST_AT = RID_AT_ENCODE,
198*e4b17023SJohn Marino   RID_LAST_AT = RID_AT_IMPLEMENTATION,
199*e4b17023SJohn Marino   RID_FIRST_PQ = RID_IN,
200*e4b17023SJohn Marino   RID_LAST_PQ = RID_ONEWAY,
201*e4b17023SJohn Marino   RID_FIRST_PATTR = RID_GETTER,
202*e4b17023SJohn Marino   RID_LAST_PATTR = RID_NONATOMIC
203*e4b17023SJohn Marino };
204*e4b17023SJohn Marino 
205*e4b17023SJohn Marino #define OBJC_IS_AT_KEYWORD(rid) \
206*e4b17023SJohn Marino   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_AT && \
207*e4b17023SJohn Marino    (unsigned int) (rid) <= (unsigned int) RID_LAST_AT)
208*e4b17023SJohn Marino 
209*e4b17023SJohn Marino #define OBJC_IS_PQ_KEYWORD(rid) \
210*e4b17023SJohn Marino   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
211*e4b17023SJohn Marino    (unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
212*e4b17023SJohn Marino 
213*e4b17023SJohn Marino #define OBJC_IS_PATTR_KEYWORD(rid) \
214*e4b17023SJohn Marino   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \
215*e4b17023SJohn Marino    (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR)
216*e4b17023SJohn Marino 
217*e4b17023SJohn Marino /* OBJC_IS_CXX_KEYWORD recognizes the 'CXX_OBJC' keywords (such as
218*e4b17023SJohn Marino    'class') which are shared in a subtle way between Objective-C and
219*e4b17023SJohn Marino    C++.  When the lexer is lexing in Objective-C/Objective-C++, if it
220*e4b17023SJohn Marino    finds '@' followed by one of these identifiers (eg, '@class'), it
221*e4b17023SJohn Marino    recognizes the whole as an Objective-C keyword.  If the identifier
222*e4b17023SJohn Marino    is found elsewhere, it follows the rules of the C/C++ language.
223*e4b17023SJohn Marino  */
224*e4b17023SJohn Marino #define OBJC_IS_CXX_KEYWORD(rid) \
225*e4b17023SJohn Marino   (rid == RID_CLASS							\
226*e4b17023SJohn Marino    || rid == RID_PUBLIC || rid == RID_PROTECTED || rid == RID_PRIVATE	\
227*e4b17023SJohn Marino    || rid == RID_TRY || rid == RID_THROW || rid == RID_CATCH)
228*e4b17023SJohn Marino 
229*e4b17023SJohn Marino /* The elements of `ridpointers' are identifier nodes for the reserved
230*e4b17023SJohn Marino    type names and storage classes.  It is indexed by a RID_... value.  */
231*e4b17023SJohn Marino extern GTY ((length ("(int) RID_MAX"))) tree *ridpointers;
232*e4b17023SJohn Marino 
233*e4b17023SJohn Marino /* Standard named or nameless data types of the C compiler.  */
234*e4b17023SJohn Marino 
235*e4b17023SJohn Marino enum c_tree_index
236*e4b17023SJohn Marino {
237*e4b17023SJohn Marino     CTI_CHAR16_TYPE,
238*e4b17023SJohn Marino     CTI_CHAR32_TYPE,
239*e4b17023SJohn Marino     CTI_WCHAR_TYPE,
240*e4b17023SJohn Marino     CTI_UNDERLYING_WCHAR_TYPE,
241*e4b17023SJohn Marino     CTI_WINT_TYPE,
242*e4b17023SJohn Marino     CTI_SIGNED_SIZE_TYPE, /* For format checking only.  */
243*e4b17023SJohn Marino     CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only.  */
244*e4b17023SJohn Marino     CTI_INTMAX_TYPE,
245*e4b17023SJohn Marino     CTI_UINTMAX_TYPE,
246*e4b17023SJohn Marino     CTI_WIDEST_INT_LIT_TYPE,
247*e4b17023SJohn Marino     CTI_WIDEST_UINT_LIT_TYPE,
248*e4b17023SJohn Marino 
249*e4b17023SJohn Marino     /* Types for <stdint.h>, that may not be defined on all
250*e4b17023SJohn Marino        targets.  */
251*e4b17023SJohn Marino     CTI_SIG_ATOMIC_TYPE,
252*e4b17023SJohn Marino     CTI_INT8_TYPE,
253*e4b17023SJohn Marino     CTI_INT16_TYPE,
254*e4b17023SJohn Marino     CTI_INT32_TYPE,
255*e4b17023SJohn Marino     CTI_INT64_TYPE,
256*e4b17023SJohn Marino     CTI_UINT8_TYPE,
257*e4b17023SJohn Marino     CTI_UINT16_TYPE,
258*e4b17023SJohn Marino     CTI_UINT32_TYPE,
259*e4b17023SJohn Marino     CTI_UINT64_TYPE,
260*e4b17023SJohn Marino     CTI_INT_LEAST8_TYPE,
261*e4b17023SJohn Marino     CTI_INT_LEAST16_TYPE,
262*e4b17023SJohn Marino     CTI_INT_LEAST32_TYPE,
263*e4b17023SJohn Marino     CTI_INT_LEAST64_TYPE,
264*e4b17023SJohn Marino     CTI_UINT_LEAST8_TYPE,
265*e4b17023SJohn Marino     CTI_UINT_LEAST16_TYPE,
266*e4b17023SJohn Marino     CTI_UINT_LEAST32_TYPE,
267*e4b17023SJohn Marino     CTI_UINT_LEAST64_TYPE,
268*e4b17023SJohn Marino     CTI_INT_FAST8_TYPE,
269*e4b17023SJohn Marino     CTI_INT_FAST16_TYPE,
270*e4b17023SJohn Marino     CTI_INT_FAST32_TYPE,
271*e4b17023SJohn Marino     CTI_INT_FAST64_TYPE,
272*e4b17023SJohn Marino     CTI_UINT_FAST8_TYPE,
273*e4b17023SJohn Marino     CTI_UINT_FAST16_TYPE,
274*e4b17023SJohn Marino     CTI_UINT_FAST32_TYPE,
275*e4b17023SJohn Marino     CTI_UINT_FAST64_TYPE,
276*e4b17023SJohn Marino     CTI_INTPTR_TYPE,
277*e4b17023SJohn Marino     CTI_UINTPTR_TYPE,
278*e4b17023SJohn Marino 
279*e4b17023SJohn Marino     CTI_CHAR_ARRAY_TYPE,
280*e4b17023SJohn Marino     CTI_CHAR16_ARRAY_TYPE,
281*e4b17023SJohn Marino     CTI_CHAR32_ARRAY_TYPE,
282*e4b17023SJohn Marino     CTI_WCHAR_ARRAY_TYPE,
283*e4b17023SJohn Marino     CTI_INT_ARRAY_TYPE,
284*e4b17023SJohn Marino     CTI_STRING_TYPE,
285*e4b17023SJohn Marino     CTI_CONST_STRING_TYPE,
286*e4b17023SJohn Marino 
287*e4b17023SJohn Marino     /* Type for boolean expressions (bool in C++, int in C).  */
288*e4b17023SJohn Marino     CTI_TRUTHVALUE_TYPE,
289*e4b17023SJohn Marino     CTI_TRUTHVALUE_TRUE,
290*e4b17023SJohn Marino     CTI_TRUTHVALUE_FALSE,
291*e4b17023SJohn Marino 
292*e4b17023SJohn Marino     CTI_DEFAULT_FUNCTION_TYPE,
293*e4b17023SJohn Marino 
294*e4b17023SJohn Marino     /* These are not types, but we have to look them up all the time.  */
295*e4b17023SJohn Marino     CTI_FUNCTION_NAME_DECL,
296*e4b17023SJohn Marino     CTI_PRETTY_FUNCTION_NAME_DECL,
297*e4b17023SJohn Marino     CTI_C99_FUNCTION_NAME_DECL,
298*e4b17023SJohn Marino     CTI_SAVED_FUNCTION_NAME_DECLS,
299*e4b17023SJohn Marino 
300*e4b17023SJohn Marino     CTI_VOID_ZERO,
301*e4b17023SJohn Marino 
302*e4b17023SJohn Marino     CTI_NULL,
303*e4b17023SJohn Marino 
304*e4b17023SJohn Marino     CTI_MAX
305*e4b17023SJohn Marino };
306*e4b17023SJohn Marino 
307*e4b17023SJohn Marino #define C_CPP_HASHNODE(id) \
308*e4b17023SJohn Marino   (&(((struct c_common_identifier *) (id))->node))
309*e4b17023SJohn Marino #define C_RID_CODE(id) \
310*e4b17023SJohn Marino   ((enum rid) (((struct c_common_identifier *) (id))->node.rid_code))
311*e4b17023SJohn Marino #define C_SET_RID_CODE(id, code) \
312*e4b17023SJohn Marino   (((struct c_common_identifier *) (id))->node.rid_code = (unsigned char) code)
313*e4b17023SJohn Marino 
314*e4b17023SJohn Marino /* Identifier part common to the C front ends.  Inherits from
315*e4b17023SJohn Marino    tree_identifier, despite appearances.  */
316*e4b17023SJohn Marino struct GTY(()) c_common_identifier {
317*e4b17023SJohn Marino   struct tree_common common;
318*e4b17023SJohn Marino   struct cpp_hashnode node;
319*e4b17023SJohn Marino };
320*e4b17023SJohn Marino 
321*e4b17023SJohn Marino /* An entry in the reserved keyword table.  */
322*e4b17023SJohn Marino 
323*e4b17023SJohn Marino struct c_common_resword
324*e4b17023SJohn Marino {
325*e4b17023SJohn Marino   const char *const word;
326*e4b17023SJohn Marino   ENUM_BITFIELD(rid) const rid : 16;
327*e4b17023SJohn Marino   const unsigned int disable   : 16;
328*e4b17023SJohn Marino };
329*e4b17023SJohn Marino 
330*e4b17023SJohn Marino /* Extra cpp_ttype values for C++.  */
331*e4b17023SJohn Marino 
332*e4b17023SJohn Marino /* A token type for keywords, as opposed to ordinary identifiers.  */
333*e4b17023SJohn Marino #define CPP_KEYWORD ((enum cpp_ttype) (N_TTYPES + 1))
334*e4b17023SJohn Marino 
335*e4b17023SJohn Marino /* A token type for template-ids.  If a template-id is processed while
336*e4b17023SJohn Marino    parsing tentatively, it is replaced with a CPP_TEMPLATE_ID token;
337*e4b17023SJohn Marino    the value of the CPP_TEMPLATE_ID is whatever was returned by
338*e4b17023SJohn Marino    cp_parser_template_id.  */
339*e4b17023SJohn Marino #define CPP_TEMPLATE_ID ((enum cpp_ttype) (CPP_KEYWORD + 1))
340*e4b17023SJohn Marino 
341*e4b17023SJohn Marino /* A token type for nested-name-specifiers.  If a
342*e4b17023SJohn Marino    nested-name-specifier is processed while parsing tentatively, it is
343*e4b17023SJohn Marino    replaced with a CPP_NESTED_NAME_SPECIFIER token; the value of the
344*e4b17023SJohn Marino    CPP_NESTED_NAME_SPECIFIER is whatever was returned by
345*e4b17023SJohn Marino    cp_parser_nested_name_specifier_opt.  */
346*e4b17023SJohn Marino #define CPP_NESTED_NAME_SPECIFIER ((enum cpp_ttype) (CPP_TEMPLATE_ID + 1))
347*e4b17023SJohn Marino 
348*e4b17023SJohn Marino /* A token type for pre-parsed C++0x decltype.  */
349*e4b17023SJohn Marino #define CPP_DECLTYPE ((enum cpp_ttype) (CPP_NESTED_NAME_SPECIFIER + 1))
350*e4b17023SJohn Marino 
351*e4b17023SJohn Marino /* The number of token types, including C++-specific ones.  */
352*e4b17023SJohn Marino #define N_CP_TTYPES ((int) (CPP_DECLTYPE + 1))
353*e4b17023SJohn Marino 
354*e4b17023SJohn Marino /* Disable mask.  Keywords are disabled if (reswords[i].disable &
355*e4b17023SJohn Marino    mask) is _true_.  Thus for keywords which are present in all
356*e4b17023SJohn Marino    languages the disable field is zero.  */
357*e4b17023SJohn Marino 
358*e4b17023SJohn Marino #define D_CONLY		0x001	/* C only (not in C++).  */
359*e4b17023SJohn Marino #define D_CXXONLY	0x002	/* C++ only (not in C).  */
360*e4b17023SJohn Marino #define D_C99		0x004	/* In C, C99 only.  */
361*e4b17023SJohn Marino #define D_CXX0X         0x008	/* In C++, C++0X only.  */
362*e4b17023SJohn Marino #define D_EXT		0x010	/* GCC extension.  */
363*e4b17023SJohn Marino #define D_EXT89		0x020	/* GCC extension incorporated in C99.  */
364*e4b17023SJohn Marino #define D_ASM		0x040	/* Disabled by -fno-asm.  */
365*e4b17023SJohn Marino #define D_OBJC		0x080	/* In Objective C and neither C nor C++.  */
366*e4b17023SJohn Marino #define D_CXX_OBJC	0x100	/* In Objective C, and C++, but not C.  */
367*e4b17023SJohn Marino #define D_CXXWARN	0x200	/* In C warn with -Wcxx-compat.  */
368*e4b17023SJohn Marino 
369*e4b17023SJohn Marino /* The reserved keyword table.  */
370*e4b17023SJohn Marino extern const struct c_common_resword c_common_reswords[];
371*e4b17023SJohn Marino 
372*e4b17023SJohn Marino /* The number of items in the reserved keyword table.  */
373*e4b17023SJohn Marino extern const unsigned int num_c_common_reswords;
374*e4b17023SJohn Marino 
375*e4b17023SJohn Marino #define char16_type_node		c_global_trees[CTI_CHAR16_TYPE]
376*e4b17023SJohn Marino #define char32_type_node		c_global_trees[CTI_CHAR32_TYPE]
377*e4b17023SJohn Marino #define wchar_type_node			c_global_trees[CTI_WCHAR_TYPE]
378*e4b17023SJohn Marino #define underlying_wchar_type_node	c_global_trees[CTI_UNDERLYING_WCHAR_TYPE]
379*e4b17023SJohn Marino #define wint_type_node			c_global_trees[CTI_WINT_TYPE]
380*e4b17023SJohn Marino #define signed_size_type_node		c_global_trees[CTI_SIGNED_SIZE_TYPE]
381*e4b17023SJohn Marino #define unsigned_ptrdiff_type_node	c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE]
382*e4b17023SJohn Marino #define intmax_type_node		c_global_trees[CTI_INTMAX_TYPE]
383*e4b17023SJohn Marino #define uintmax_type_node		c_global_trees[CTI_UINTMAX_TYPE]
384*e4b17023SJohn Marino #define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE]
385*e4b17023SJohn Marino #define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE]
386*e4b17023SJohn Marino 
387*e4b17023SJohn Marino #define sig_atomic_type_node		c_global_trees[CTI_SIG_ATOMIC_TYPE]
388*e4b17023SJohn Marino #define int8_type_node			c_global_trees[CTI_INT8_TYPE]
389*e4b17023SJohn Marino #define int16_type_node			c_global_trees[CTI_INT16_TYPE]
390*e4b17023SJohn Marino #define int32_type_node			c_global_trees[CTI_INT32_TYPE]
391*e4b17023SJohn Marino #define int64_type_node			c_global_trees[CTI_INT64_TYPE]
392*e4b17023SJohn Marino #define uint8_type_node			c_global_trees[CTI_UINT8_TYPE]
393*e4b17023SJohn Marino #define uint16_type_node		c_global_trees[CTI_UINT16_TYPE]
394*e4b17023SJohn Marino #define c_uint32_type_node		c_global_trees[CTI_UINT32_TYPE]
395*e4b17023SJohn Marino #define c_uint64_type_node		c_global_trees[CTI_UINT64_TYPE]
396*e4b17023SJohn Marino #define int_least8_type_node		c_global_trees[CTI_INT_LEAST8_TYPE]
397*e4b17023SJohn Marino #define int_least16_type_node		c_global_trees[CTI_INT_LEAST16_TYPE]
398*e4b17023SJohn Marino #define int_least32_type_node		c_global_trees[CTI_INT_LEAST32_TYPE]
399*e4b17023SJohn Marino #define int_least64_type_node		c_global_trees[CTI_INT_LEAST64_TYPE]
400*e4b17023SJohn Marino #define uint_least8_type_node		c_global_trees[CTI_UINT_LEAST8_TYPE]
401*e4b17023SJohn Marino #define uint_least16_type_node		c_global_trees[CTI_UINT_LEAST16_TYPE]
402*e4b17023SJohn Marino #define uint_least32_type_node		c_global_trees[CTI_UINT_LEAST32_TYPE]
403*e4b17023SJohn Marino #define uint_least64_type_node		c_global_trees[CTI_UINT_LEAST64_TYPE]
404*e4b17023SJohn Marino #define int_fast8_type_node		c_global_trees[CTI_INT_FAST8_TYPE]
405*e4b17023SJohn Marino #define int_fast16_type_node		c_global_trees[CTI_INT_FAST16_TYPE]
406*e4b17023SJohn Marino #define int_fast32_type_node		c_global_trees[CTI_INT_FAST32_TYPE]
407*e4b17023SJohn Marino #define int_fast64_type_node		c_global_trees[CTI_INT_FAST64_TYPE]
408*e4b17023SJohn Marino #define uint_fast8_type_node		c_global_trees[CTI_UINT_FAST8_TYPE]
409*e4b17023SJohn Marino #define uint_fast16_type_node		c_global_trees[CTI_UINT_FAST16_TYPE]
410*e4b17023SJohn Marino #define uint_fast32_type_node		c_global_trees[CTI_UINT_FAST32_TYPE]
411*e4b17023SJohn Marino #define uint_fast64_type_node		c_global_trees[CTI_UINT_FAST64_TYPE]
412*e4b17023SJohn Marino #define intptr_type_node		c_global_trees[CTI_INTPTR_TYPE]
413*e4b17023SJohn Marino #define uintptr_type_node		c_global_trees[CTI_UINTPTR_TYPE]
414*e4b17023SJohn Marino 
415*e4b17023SJohn Marino #define truthvalue_type_node		c_global_trees[CTI_TRUTHVALUE_TYPE]
416*e4b17023SJohn Marino #define truthvalue_true_node		c_global_trees[CTI_TRUTHVALUE_TRUE]
417*e4b17023SJohn Marino #define truthvalue_false_node		c_global_trees[CTI_TRUTHVALUE_FALSE]
418*e4b17023SJohn Marino 
419*e4b17023SJohn Marino #define char_array_type_node		c_global_trees[CTI_CHAR_ARRAY_TYPE]
420*e4b17023SJohn Marino #define char16_array_type_node		c_global_trees[CTI_CHAR16_ARRAY_TYPE]
421*e4b17023SJohn Marino #define char32_array_type_node		c_global_trees[CTI_CHAR32_ARRAY_TYPE]
422*e4b17023SJohn Marino #define wchar_array_type_node		c_global_trees[CTI_WCHAR_ARRAY_TYPE]
423*e4b17023SJohn Marino #define int_array_type_node		c_global_trees[CTI_INT_ARRAY_TYPE]
424*e4b17023SJohn Marino #define string_type_node		c_global_trees[CTI_STRING_TYPE]
425*e4b17023SJohn Marino #define const_string_type_node		c_global_trees[CTI_CONST_STRING_TYPE]
426*e4b17023SJohn Marino 
427*e4b17023SJohn Marino #define default_function_type		c_global_trees[CTI_DEFAULT_FUNCTION_TYPE]
428*e4b17023SJohn Marino 
429*e4b17023SJohn Marino #define function_name_decl_node		c_global_trees[CTI_FUNCTION_NAME_DECL]
430*e4b17023SJohn Marino #define pretty_function_name_decl_node	c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL]
431*e4b17023SJohn Marino #define c99_function_name_decl_node		c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
432*e4b17023SJohn Marino #define saved_function_name_decls	c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
433*e4b17023SJohn Marino 
434*e4b17023SJohn Marino /* A node for `((void) 0)'.  */
435*e4b17023SJohn Marino #define void_zero_node                  c_global_trees[CTI_VOID_ZERO]
436*e4b17023SJohn Marino 
437*e4b17023SJohn Marino /* The node for C++ `__null'.  */
438*e4b17023SJohn Marino #define null_node                       c_global_trees[CTI_NULL]
439*e4b17023SJohn Marino 
440*e4b17023SJohn Marino extern GTY(()) tree c_global_trees[CTI_MAX];
441*e4b17023SJohn Marino 
442*e4b17023SJohn Marino /* In a RECORD_TYPE, a sorted array of the fields of the type, not a
443*e4b17023SJohn Marino    tree for size reasons.  */
444*e4b17023SJohn Marino struct GTY((variable_size)) sorted_fields_type {
445*e4b17023SJohn Marino   int len;
446*e4b17023SJohn Marino   tree GTY((length ("%h.len"))) elts[1];
447*e4b17023SJohn Marino };
448*e4b17023SJohn Marino 
449*e4b17023SJohn Marino /* Mark which labels are explicitly declared.
450*e4b17023SJohn Marino    These may be shadowed, and may be referenced from nested functions.  */
451*e4b17023SJohn Marino #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
452*e4b17023SJohn Marino 
453*e4b17023SJohn Marino typedef enum c_language_kind
454*e4b17023SJohn Marino {
455*e4b17023SJohn Marino   clk_c		= 0,		/* C90, C94 or C99 */
456*e4b17023SJohn Marino   clk_objc	= 1,		/* clk_c with ObjC features.  */
457*e4b17023SJohn Marino   clk_cxx	= 2,		/* ANSI/ISO C++ */
458*e4b17023SJohn Marino   clk_objcxx	= 3		/* clk_cxx with ObjC features.  */
459*e4b17023SJohn Marino }
460*e4b17023SJohn Marino c_language_kind;
461*e4b17023SJohn Marino 
462*e4b17023SJohn Marino /* To test for a specific language use c_language, defined by each
463*e4b17023SJohn Marino    front end.  For "ObjC features" or "not C++" use the macros.  */
464*e4b17023SJohn Marino extern c_language_kind c_language;
465*e4b17023SJohn Marino 
466*e4b17023SJohn Marino #define c_dialect_cxx()		((c_language & clk_cxx) != 0)
467*e4b17023SJohn Marino #define c_dialect_objc()	((c_language & clk_objc) != 0)
468*e4b17023SJohn Marino 
469*e4b17023SJohn Marino /* The various name of operator that appears in error messages. */
470*e4b17023SJohn Marino typedef enum ref_operator {
471*e4b17023SJohn Marino   /* NULL */
472*e4b17023SJohn Marino   RO_NULL,
473*e4b17023SJohn Marino   /* array indexing */
474*e4b17023SJohn Marino   RO_ARRAY_INDEXING,
475*e4b17023SJohn Marino   /* unary * */
476*e4b17023SJohn Marino   RO_UNARY_STAR,
477*e4b17023SJohn Marino   /* -> */
478*e4b17023SJohn Marino   RO_ARROW,
479*e4b17023SJohn Marino   /* implicit conversion */
480*e4b17023SJohn Marino   RO_IMPLICIT_CONVERSION
481*e4b17023SJohn Marino } ref_operator;
482*e4b17023SJohn Marino 
483*e4b17023SJohn Marino /* Information about a statement tree.  */
484*e4b17023SJohn Marino 
485*e4b17023SJohn Marino struct GTY(()) stmt_tree_s {
486*e4b17023SJohn Marino   /* A stack of statement lists being collected.  */
487*e4b17023SJohn Marino   VEC(tree,gc) *x_cur_stmt_list;
488*e4b17023SJohn Marino 
489*e4b17023SJohn Marino   /* In C++, Nonzero if we should treat statements as full
490*e4b17023SJohn Marino      expressions.  In particular, this variable is non-zero if at the
491*e4b17023SJohn Marino      end of a statement we should destroy any temporaries created
492*e4b17023SJohn Marino      during that statement.  Similarly, if, at the end of a block, we
493*e4b17023SJohn Marino      should destroy any local variables in this block.  Normally, this
494*e4b17023SJohn Marino      variable is nonzero, since those are the normal semantics of
495*e4b17023SJohn Marino      C++.
496*e4b17023SJohn Marino 
497*e4b17023SJohn Marino      This flag has no effect in C.  */
498*e4b17023SJohn Marino   int stmts_are_full_exprs_p;
499*e4b17023SJohn Marino };
500*e4b17023SJohn Marino 
501*e4b17023SJohn Marino typedef struct stmt_tree_s *stmt_tree;
502*e4b17023SJohn Marino 
503*e4b17023SJohn Marino /* Global state pertinent to the current function.  Some C dialects
504*e4b17023SJohn Marino    extend this structure with additional fields.  */
505*e4b17023SJohn Marino 
506*e4b17023SJohn Marino struct GTY(()) c_language_function {
507*e4b17023SJohn Marino   /* While we are parsing the function, this contains information
508*e4b17023SJohn Marino      about the statement-tree that we are building.  */
509*e4b17023SJohn Marino   struct stmt_tree_s x_stmt_tree;
510*e4b17023SJohn Marino 
511*e4b17023SJohn Marino   /* Vector of locally defined typedefs, for
512*e4b17023SJohn Marino      -Wunused-local-typedefs.  */
513*e4b17023SJohn Marino   VEC(tree,gc) *local_typedefs;
514*e4b17023SJohn Marino };
515*e4b17023SJohn Marino 
516*e4b17023SJohn Marino #define stmt_list_stack (current_stmt_tree ()->x_cur_stmt_list)
517*e4b17023SJohn Marino 
518*e4b17023SJohn Marino /* When building a statement-tree, this is the current statement list
519*e4b17023SJohn Marino    being collected.  We define it in this convoluted way, rather than
520*e4b17023SJohn Marino    using VEC_last, because it must be an lvalue.  */
521*e4b17023SJohn Marino 
522*e4b17023SJohn Marino #define cur_stmt_list							\
523*e4b17023SJohn Marino   (*(VEC_address (tree, stmt_list_stack)				\
524*e4b17023SJohn Marino      + VEC_length (tree, stmt_list_stack) - 1))
525*e4b17023SJohn Marino 
526*e4b17023SJohn Marino #define building_stmt_list_p() (!VEC_empty (tree, stmt_list_stack))
527*e4b17023SJohn Marino 
528*e4b17023SJohn Marino /* Language-specific hooks.  */
529*e4b17023SJohn Marino 
530*e4b17023SJohn Marino /* If non-NULL, this function is called after a precompile header file
531*e4b17023SJohn Marino    is loaded.  */
532*e4b17023SJohn Marino extern void (*lang_post_pch_load) (void);
533*e4b17023SJohn Marino 
534*e4b17023SJohn Marino extern void push_file_scope (void);
535*e4b17023SJohn Marino extern void pop_file_scope (void);
536*e4b17023SJohn Marino extern stmt_tree current_stmt_tree (void);
537*e4b17023SJohn Marino extern tree push_stmt_list (void);
538*e4b17023SJohn Marino extern tree pop_stmt_list (tree);
539*e4b17023SJohn Marino extern tree add_stmt (tree);
540*e4b17023SJohn Marino extern void push_cleanup (tree, tree, bool);
541*e4b17023SJohn Marino extern tree pushdecl_top_level (tree);
542*e4b17023SJohn Marino extern tree pushdecl (tree);
543*e4b17023SJohn Marino extern tree build_modify_expr (location_t, tree, tree, enum tree_code,
544*e4b17023SJohn Marino 			       location_t, tree, tree);
545*e4b17023SJohn Marino extern tree build_indirect_ref (location_t, tree, ref_operator);
546*e4b17023SJohn Marino 
547*e4b17023SJohn Marino extern int c_expand_decl (tree);
548*e4b17023SJohn Marino 
549*e4b17023SJohn Marino extern int field_decl_cmp (const void *, const void *);
550*e4b17023SJohn Marino extern void resort_sorted_fields (void *, void *, gt_pointer_operator,
551*e4b17023SJohn Marino 				  void *);
552*e4b17023SJohn Marino extern bool has_c_linkage (const_tree decl);
553*e4b17023SJohn Marino 
554*e4b17023SJohn Marino /* Switches common to the C front ends.  */
555*e4b17023SJohn Marino 
556*e4b17023SJohn Marino /* Nonzero means don't output line number information.  */
557*e4b17023SJohn Marino 
558*e4b17023SJohn Marino extern char flag_no_line_commands;
559*e4b17023SJohn Marino 
560*e4b17023SJohn Marino /* Nonzero causes -E output not to be done, but directives such as
561*e4b17023SJohn Marino    #define that have side effects are still obeyed.  */
562*e4b17023SJohn Marino 
563*e4b17023SJohn Marino extern char flag_no_output;
564*e4b17023SJohn Marino 
565*e4b17023SJohn Marino /* Nonzero means dump macros in some fashion; contains the 'D', 'M',
566*e4b17023SJohn Marino    'N' or 'U' of the command line switch.  */
567*e4b17023SJohn Marino 
568*e4b17023SJohn Marino extern char flag_dump_macros;
569*e4b17023SJohn Marino 
570*e4b17023SJohn Marino /* Nonzero means pass #include lines through to the output.  */
571*e4b17023SJohn Marino 
572*e4b17023SJohn Marino extern char flag_dump_includes;
573*e4b17023SJohn Marino 
574*e4b17023SJohn Marino /* Nonzero means process PCH files while preprocessing.  */
575*e4b17023SJohn Marino 
576*e4b17023SJohn Marino extern bool flag_pch_preprocess;
577*e4b17023SJohn Marino 
578*e4b17023SJohn Marino /* The file name to which we should write a precompiled header, or
579*e4b17023SJohn Marino    NULL if no header will be written in this compile.  */
580*e4b17023SJohn Marino 
581*e4b17023SJohn Marino extern const char *pch_file;
582*e4b17023SJohn Marino 
583*e4b17023SJohn Marino /* Nonzero if an ISO standard was selected.  It rejects macros in the
584*e4b17023SJohn Marino    user's namespace.  */
585*e4b17023SJohn Marino 
586*e4b17023SJohn Marino extern int flag_iso;
587*e4b17023SJohn Marino 
588*e4b17023SJohn Marino /* Warn about #pragma directives that are not recognized.  */
589*e4b17023SJohn Marino 
590*e4b17023SJohn Marino extern int warn_unknown_pragmas; /* Tri state variable.  */
591*e4b17023SJohn Marino 
592*e4b17023SJohn Marino /* Warn about format/argument anomalies in calls to formatted I/O functions
593*e4b17023SJohn Marino    (*printf, *scanf, strftime, strfmon, etc.).  */
594*e4b17023SJohn Marino 
595*e4b17023SJohn Marino extern int warn_format;
596*e4b17023SJohn Marino 
597*e4b17023SJohn Marino 
598*e4b17023SJohn Marino /* C/ObjC language option variables.  */
599*e4b17023SJohn Marino 
600*e4b17023SJohn Marino 
601*e4b17023SJohn Marino /* Nonzero means allow type mismatches in conditional expressions;
602*e4b17023SJohn Marino    just make their values `void'.  */
603*e4b17023SJohn Marino 
604*e4b17023SJohn Marino extern int flag_cond_mismatch;
605*e4b17023SJohn Marino 
606*e4b17023SJohn Marino /* Nonzero means enable C89 Amendment 1 features.  */
607*e4b17023SJohn Marino 
608*e4b17023SJohn Marino extern int flag_isoc94;
609*e4b17023SJohn Marino 
610*e4b17023SJohn Marino /* Nonzero means use the ISO C99 (or C11) dialect of C.  */
611*e4b17023SJohn Marino 
612*e4b17023SJohn Marino extern int flag_isoc99;
613*e4b17023SJohn Marino 
614*e4b17023SJohn Marino /* Nonzero means use the ISO C11 dialect of C.  */
615*e4b17023SJohn Marino 
616*e4b17023SJohn Marino extern int flag_isoc11;
617*e4b17023SJohn Marino 
618*e4b17023SJohn Marino /* Nonzero means that we have builtin functions, and main is an int.  */
619*e4b17023SJohn Marino 
620*e4b17023SJohn Marino extern int flag_hosted;
621*e4b17023SJohn Marino 
622*e4b17023SJohn Marino /* ObjC language option variables.  */
623*e4b17023SJohn Marino 
624*e4b17023SJohn Marino 
625*e4b17023SJohn Marino /* Tells the compiler that this is a special run.  Do not perform any
626*e4b17023SJohn Marino    compiling, instead we are to test some platform dependent features
627*e4b17023SJohn Marino    and output a C header file with appropriate definitions.  */
628*e4b17023SJohn Marino 
629*e4b17023SJohn Marino extern int print_struct_values;
630*e4b17023SJohn Marino 
631*e4b17023SJohn Marino /* Tells the compiler what is the constant string class for ObjC.  */
632*e4b17023SJohn Marino 
633*e4b17023SJohn Marino extern const char *constant_string_class_name;
634*e4b17023SJohn Marino 
635*e4b17023SJohn Marino 
636*e4b17023SJohn Marino /* C++ language option variables.  */
637*e4b17023SJohn Marino 
638*e4b17023SJohn Marino 
639*e4b17023SJohn Marino /* Nonzero means generate separate instantiation control files and
640*e4b17023SJohn Marino    juggle them at link time.  */
641*e4b17023SJohn Marino 
642*e4b17023SJohn Marino extern int flag_use_repository;
643*e4b17023SJohn Marino 
644*e4b17023SJohn Marino /* The supported C++ dialects.  */
645*e4b17023SJohn Marino 
646*e4b17023SJohn Marino enum cxx_dialect {
647*e4b17023SJohn Marino   /* C++98 with TC1  */
648*e4b17023SJohn Marino   cxx98,
649*e4b17023SJohn Marino   cxx03 = cxx98,
650*e4b17023SJohn Marino   /* C++11  */
651*e4b17023SJohn Marino   cxx0x,
652*e4b17023SJohn Marino   cxx11 = cxx0x
653*e4b17023SJohn Marino };
654*e4b17023SJohn Marino 
655*e4b17023SJohn Marino /* The C++ dialect being used. C++98 is the default.  */
656*e4b17023SJohn Marino extern enum cxx_dialect cxx_dialect;
657*e4b17023SJohn Marino 
658*e4b17023SJohn Marino /* Maximum template instantiation depth.  This limit is rather
659*e4b17023SJohn Marino    arbitrary, but it exists to limit the time it takes to notice
660*e4b17023SJohn Marino    excessively recursive template instantiations.  */
661*e4b17023SJohn Marino 
662*e4b17023SJohn Marino extern int max_tinst_depth;
663*e4b17023SJohn Marino 
664*e4b17023SJohn Marino /* Nonzero means that we should not issue warnings about problems that
665*e4b17023SJohn Marino    occur when the code is executed, because the code being processed
666*e4b17023SJohn Marino    is not expected to be executed.  This is set during parsing.  This
667*e4b17023SJohn Marino    is used for cases like sizeof() and "0 ? a : b".  This is a count,
668*e4b17023SJohn Marino    not a bool, because unexecuted expressions can nest.  */
669*e4b17023SJohn Marino 
670*e4b17023SJohn Marino extern int c_inhibit_evaluation_warnings;
671*e4b17023SJohn Marino 
672*e4b17023SJohn Marino /* Whether lexing has been completed, so subsequent preprocessor
673*e4b17023SJohn Marino    errors should use the compiler's input_location.  */
674*e4b17023SJohn Marino 
675*e4b17023SJohn Marino extern bool done_lexing;
676*e4b17023SJohn Marino 
677*e4b17023SJohn Marino /* C types are partitioned into three subsets: object, function, and
678*e4b17023SJohn Marino    incomplete types.  */
679*e4b17023SJohn Marino #define C_TYPE_OBJECT_P(type) \
680*e4b17023SJohn Marino   (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type))
681*e4b17023SJohn Marino 
682*e4b17023SJohn Marino #define C_TYPE_INCOMPLETE_P(type) \
683*e4b17023SJohn Marino   (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0)
684*e4b17023SJohn Marino 
685*e4b17023SJohn Marino #define C_TYPE_FUNCTION_P(type) \
686*e4b17023SJohn Marino   (TREE_CODE (type) == FUNCTION_TYPE)
687*e4b17023SJohn Marino 
688*e4b17023SJohn Marino /* For convenience we define a single macro to identify the class of
689*e4b17023SJohn Marino    object or incomplete types.  */
690*e4b17023SJohn Marino #define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \
691*e4b17023SJohn Marino   (!C_TYPE_FUNCTION_P (type))
692*e4b17023SJohn Marino 
693*e4b17023SJohn Marino struct visibility_flags
694*e4b17023SJohn Marino {
695*e4b17023SJohn Marino   unsigned inpragma : 1;	/* True when in #pragma GCC visibility.  */
696*e4b17023SJohn Marino   unsigned inlines_hidden : 1;	/* True when -finlineshidden in effect.  */
697*e4b17023SJohn Marino };
698*e4b17023SJohn Marino 
699*e4b17023SJohn Marino /* Global visibility options.  */
700*e4b17023SJohn Marino extern struct visibility_flags visibility_options;
701*e4b17023SJohn Marino 
702*e4b17023SJohn Marino /* Attribute table common to the C front ends.  */
703*e4b17023SJohn Marino extern const struct attribute_spec c_common_attribute_table[];
704*e4b17023SJohn Marino extern const struct attribute_spec c_common_format_attribute_table[];
705*e4b17023SJohn Marino 
706*e4b17023SJohn Marino /* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc.
707*e4b17023SJohn Marino    ID is the identifier to use, NAME is the string.
708*e4b17023SJohn Marino    TYPE_DEP indicates whether it depends on type of the function or not
709*e4b17023SJohn Marino    (i.e. __PRETTY_FUNCTION__).  */
710*e4b17023SJohn Marino 
711*e4b17023SJohn Marino extern tree (*make_fname_decl) (location_t, tree, int);
712*e4b17023SJohn Marino 
713*e4b17023SJohn Marino /* In c-decl.c and cp/tree.c.  FIXME.  */
714*e4b17023SJohn Marino extern void c_register_addr_space (const char *str, addr_space_t as);
715*e4b17023SJohn Marino 
716*e4b17023SJohn Marino /* In c-common.c.  */
717*e4b17023SJohn Marino extern bool in_late_binary_op;
718*e4b17023SJohn Marino extern const char *c_addr_space_name (addr_space_t as);
719*e4b17023SJohn Marino extern tree identifier_global_value (tree);
720*e4b17023SJohn Marino extern tree c_linkage_bindings (tree);
721*e4b17023SJohn Marino extern void record_builtin_type (enum rid, const char *, tree);
722*e4b17023SJohn Marino extern tree build_void_list_node (void);
723*e4b17023SJohn Marino extern void start_fname_decls (void);
724*e4b17023SJohn Marino extern void finish_fname_decls (void);
725*e4b17023SJohn Marino extern const char *fname_as_string (int);
726*e4b17023SJohn Marino extern tree fname_decl (location_t, unsigned, tree);
727*e4b17023SJohn Marino 
728*e4b17023SJohn Marino extern int check_user_alignment (const_tree, bool);
729*e4b17023SJohn Marino extern void check_function_arguments (const_tree, int, tree *);
730*e4b17023SJohn Marino extern void check_function_arguments_recurse (void (*)
731*e4b17023SJohn Marino 					      (void *, tree,
732*e4b17023SJohn Marino 					       unsigned HOST_WIDE_INT),
733*e4b17023SJohn Marino 					      void *, tree,
734*e4b17023SJohn Marino 					      unsigned HOST_WIDE_INT);
735*e4b17023SJohn Marino extern bool check_builtin_function_arguments (tree, int, tree *);
736*e4b17023SJohn Marino extern void check_function_format (tree, int, tree *);
737*e4b17023SJohn Marino extern void set_Wformat (int);
738*e4b17023SJohn Marino extern tree handle_format_attribute (tree *, tree, tree, int, bool *);
739*e4b17023SJohn Marino extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
740*e4b17023SJohn Marino extern bool attribute_takes_identifier_p (const_tree);
741*e4b17023SJohn Marino extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
742*e4b17023SJohn Marino 				    const struct cl_option_handlers *);
743*e4b17023SJohn Marino extern bool default_handle_c_option (size_t, const char *, int);
744*e4b17023SJohn Marino extern tree c_common_type_for_mode (enum machine_mode, int);
745*e4b17023SJohn Marino extern tree c_common_type_for_size (unsigned int, int);
746*e4b17023SJohn Marino extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
747*e4b17023SJohn Marino 						int, int);
748*e4b17023SJohn Marino extern tree c_common_unsigned_type (tree);
749*e4b17023SJohn Marino extern tree c_common_signed_type (tree);
750*e4b17023SJohn Marino extern tree c_common_signed_or_unsigned_type (int, tree);
751*e4b17023SJohn Marino extern void c_common_init_ts (void);
752*e4b17023SJohn Marino extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
753*e4b17023SJohn Marino extern bool unsafe_conversion_p (tree, tree, bool);
754*e4b17023SJohn Marino extern bool decl_with_nonnull_addr_p (const_tree);
755*e4b17023SJohn Marino extern tree c_fully_fold (tree, bool, bool *);
756*e4b17023SJohn Marino extern tree decl_constant_value_for_optimization (tree);
757*e4b17023SJohn Marino extern tree c_wrap_maybe_const (tree, bool);
758*e4b17023SJohn Marino extern tree c_save_expr (tree);
759*e4b17023SJohn Marino extern tree c_common_truthvalue_conversion (location_t, tree);
760*e4b17023SJohn Marino extern void c_apply_type_quals_to_decl (int, tree);
761*e4b17023SJohn Marino extern tree c_sizeof_or_alignof_type (location_t, tree, bool, int);
762*e4b17023SJohn Marino extern tree c_alignof_expr (location_t, tree);
763*e4b17023SJohn Marino /* Print an error message for invalid operands to arith operation CODE.
764*e4b17023SJohn Marino    NOP_EXPR is used as a special case (see truthvalue_conversion).  */
765*e4b17023SJohn Marino extern void binary_op_error (location_t, enum tree_code, tree, tree);
766*e4b17023SJohn Marino extern tree fix_string_type (tree);
767*e4b17023SJohn Marino extern void constant_expression_warning (tree);
768*e4b17023SJohn Marino extern void constant_expression_error (tree);
769*e4b17023SJohn Marino extern bool strict_aliasing_warning (tree, tree, tree);
770*e4b17023SJohn Marino extern void warnings_for_convert_and_check (tree, tree, tree);
771*e4b17023SJohn Marino extern tree convert_and_check (tree, tree);
772*e4b17023SJohn Marino extern void overflow_warning (location_t, tree);
773*e4b17023SJohn Marino extern void warn_logical_operator (location_t, enum tree_code, tree,
774*e4b17023SJohn Marino 				   enum tree_code, tree, enum tree_code, tree);
775*e4b17023SJohn Marino extern void check_main_parameter_types (tree decl);
776*e4b17023SJohn Marino extern bool c_determine_visibility (tree);
777*e4b17023SJohn Marino extern bool same_scalar_type_ignoring_signedness (tree, tree);
778*e4b17023SJohn Marino extern void mark_valid_location_for_stdc_pragma (bool);
779*e4b17023SJohn Marino extern bool valid_location_for_stdc_pragma_p (void);
780*e4b17023SJohn Marino extern void set_float_const_decimal64 (void);
781*e4b17023SJohn Marino extern void clear_float_const_decimal64 (void);
782*e4b17023SJohn Marino extern bool float_const_decimal64_p (void);
783*e4b17023SJohn Marino 
784*e4b17023SJohn Marino extern bool keyword_begins_type_specifier (enum rid);
785*e4b17023SJohn Marino extern bool keyword_is_storage_class_specifier (enum rid);
786*e4b17023SJohn Marino extern bool keyword_is_type_qualifier (enum rid);
787*e4b17023SJohn Marino extern bool keyword_is_decl_specifier (enum rid);
788*e4b17023SJohn Marino 
789*e4b17023SJohn Marino #define c_sizeof(LOC, T)  c_sizeof_or_alignof_type (LOC, T, true, 1)
790*e4b17023SJohn Marino #define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, 1)
791*e4b17023SJohn Marino 
792*e4b17023SJohn Marino /* Subroutine of build_binary_op, used for certain operations.  */
793*e4b17023SJohn Marino extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise);
794*e4b17023SJohn Marino 
795*e4b17023SJohn Marino /* Subroutine of build_binary_op, used for comparison operations.
796*e4b17023SJohn Marino    See if the operands have both been converted from subword integer types
797*e4b17023SJohn Marino    and, if so, perhaps change them both back to their original type.  */
798*e4b17023SJohn Marino extern tree shorten_compare (tree *, tree *, tree *, enum tree_code *);
799*e4b17023SJohn Marino 
800*e4b17023SJohn Marino extern tree pointer_int_sum (location_t, enum tree_code, tree, tree);
801*e4b17023SJohn Marino 
802*e4b17023SJohn Marino /* Add qualifiers to a type, in the fashion for C.  */
803*e4b17023SJohn Marino extern tree c_build_qualified_type (tree, int);
804*e4b17023SJohn Marino 
805*e4b17023SJohn Marino /* Build tree nodes and builtin functions common to both C and C++ language
806*e4b17023SJohn Marino    frontends.  */
807*e4b17023SJohn Marino extern void c_common_nodes_and_builtins (void);
808*e4b17023SJohn Marino 
809*e4b17023SJohn Marino extern void disable_builtin_function (const char *);
810*e4b17023SJohn Marino 
811*e4b17023SJohn Marino extern void set_compound_literal_name (tree decl);
812*e4b17023SJohn Marino 
813*e4b17023SJohn Marino extern tree build_va_arg (location_t, tree, tree);
814*e4b17023SJohn Marino 
815*e4b17023SJohn Marino extern const unsigned int c_family_lang_mask;
816*e4b17023SJohn Marino extern unsigned int c_common_option_lang_mask (void);
817*e4b17023SJohn Marino extern void c_common_initialize_diagnostics (diagnostic_context *);
818*e4b17023SJohn Marino extern bool c_common_complain_wrong_lang_p (const struct cl_option *);
819*e4b17023SJohn Marino extern void c_common_init_options_struct (struct gcc_options *);
820*e4b17023SJohn Marino extern void c_common_init_options (unsigned int, struct cl_decoded_option *);
821*e4b17023SJohn Marino extern bool c_common_post_options (const char **);
822*e4b17023SJohn Marino extern bool c_common_init (void);
823*e4b17023SJohn Marino extern void c_common_finish (void);
824*e4b17023SJohn Marino extern void c_common_parse_file (void);
825*e4b17023SJohn Marino extern alias_set_type c_common_get_alias_set (tree);
826*e4b17023SJohn Marino extern void c_register_builtin_type (tree, const char*);
827*e4b17023SJohn Marino extern bool c_promoting_integer_type_p (const_tree);
828*e4b17023SJohn Marino extern int self_promoting_args_p (const_tree);
829*e4b17023SJohn Marino extern tree strip_pointer_operator (tree);
830*e4b17023SJohn Marino extern tree strip_pointer_or_array_types (tree);
831*e4b17023SJohn Marino extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
832*e4b17023SJohn Marino 
833*e4b17023SJohn Marino /* This is the basic parsing function.  */
834*e4b17023SJohn Marino extern void c_parse_file (void);
835*e4b17023SJohn Marino 
836*e4b17023SJohn Marino extern void warn_for_omitted_condop (location_t, tree);
837*e4b17023SJohn Marino 
838*e4b17023SJohn Marino /* These macros provide convenient access to the various _STMT nodes.  */
839*e4b17023SJohn Marino 
840*e4b17023SJohn Marino /* Nonzero if a given STATEMENT_LIST represents the outermost binding
841*e4b17023SJohn Marino    if a statement expression.  */
842*e4b17023SJohn Marino #define STATEMENT_LIST_STMT_EXPR(NODE) \
843*e4b17023SJohn Marino   TREE_LANG_FLAG_1 (STATEMENT_LIST_CHECK (NODE))
844*e4b17023SJohn Marino 
845*e4b17023SJohn Marino /* Nonzero if a label has been added to the statement list.  */
846*e4b17023SJohn Marino #define STATEMENT_LIST_HAS_LABEL(NODE) \
847*e4b17023SJohn Marino   TREE_LANG_FLAG_3 (STATEMENT_LIST_CHECK (NODE))
848*e4b17023SJohn Marino 
849*e4b17023SJohn Marino /* C_MAYBE_CONST_EXPR accessors.  */
850*e4b17023SJohn Marino #define C_MAYBE_CONST_EXPR_PRE(NODE)			\
851*e4b17023SJohn Marino   TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 0)
852*e4b17023SJohn Marino #define C_MAYBE_CONST_EXPR_EXPR(NODE)			\
853*e4b17023SJohn Marino   TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 1)
854*e4b17023SJohn Marino #define C_MAYBE_CONST_EXPR_INT_OPERANDS(NODE)		\
855*e4b17023SJohn Marino   TREE_LANG_FLAG_0 (C_MAYBE_CONST_EXPR_CHECK (NODE))
856*e4b17023SJohn Marino #define C_MAYBE_CONST_EXPR_NON_CONST(NODE)		\
857*e4b17023SJohn Marino   TREE_LANG_FLAG_1 (C_MAYBE_CONST_EXPR_CHECK (NODE))
858*e4b17023SJohn Marino #define EXPR_INT_CONST_OPERANDS(EXPR)			\
859*e4b17023SJohn Marino   (INTEGRAL_TYPE_P (TREE_TYPE (EXPR))			\
860*e4b17023SJohn Marino    && (TREE_CODE (EXPR) == INTEGER_CST			\
861*e4b17023SJohn Marino        || (TREE_CODE (EXPR) == C_MAYBE_CONST_EXPR	\
862*e4b17023SJohn Marino 	   && C_MAYBE_CONST_EXPR_INT_OPERANDS (EXPR))))
863*e4b17023SJohn Marino 
864*e4b17023SJohn Marino /* In a FIELD_DECL, nonzero if the decl was originally a bitfield.  */
865*e4b17023SJohn Marino #define DECL_C_BIT_FIELD(NODE) \
866*e4b17023SJohn Marino   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) == 1)
867*e4b17023SJohn Marino #define SET_DECL_C_BIT_FIELD(NODE) \
868*e4b17023SJohn Marino   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 1)
869*e4b17023SJohn Marino #define CLEAR_DECL_C_BIT_FIELD(NODE) \
870*e4b17023SJohn Marino   (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0)
871*e4b17023SJohn Marino 
872*e4b17023SJohn Marino extern tree do_case (location_t, tree, tree);
873*e4b17023SJohn Marino extern tree build_stmt (location_t, enum tree_code, ...);
874*e4b17023SJohn Marino extern tree build_real_imag_expr (location_t, enum tree_code, tree);
875*e4b17023SJohn Marino 
876*e4b17023SJohn Marino /* These functions must be defined by each front-end which implements
877*e4b17023SJohn Marino    a variant of the C language.  They are used in c-common.c.  */
878*e4b17023SJohn Marino 
879*e4b17023SJohn Marino extern tree build_unary_op (location_t, enum tree_code, tree, int);
880*e4b17023SJohn Marino extern tree build_binary_op (location_t, enum tree_code, tree, tree, int);
881*e4b17023SJohn Marino extern tree perform_integral_promotions (tree);
882*e4b17023SJohn Marino 
883*e4b17023SJohn Marino /* These functions must be defined by each front-end which implements
884*e4b17023SJohn Marino    a variant of the C language.  They are used by port files.  */
885*e4b17023SJohn Marino 
886*e4b17023SJohn Marino extern tree default_conversion (tree);
887*e4b17023SJohn Marino 
888*e4b17023SJohn Marino /* Given two integer or real types, return the type for their sum.
889*e4b17023SJohn Marino    Given two compatible ANSI C types, returns the merged type.  */
890*e4b17023SJohn Marino 
891*e4b17023SJohn Marino extern tree common_type (tree, tree);
892*e4b17023SJohn Marino 
893*e4b17023SJohn Marino extern tree decl_constant_value (tree);
894*e4b17023SJohn Marino 
895*e4b17023SJohn Marino /* Handle increment and decrement of boolean types.  */
896*e4b17023SJohn Marino extern tree boolean_increment (enum tree_code, tree);
897*e4b17023SJohn Marino 
898*e4b17023SJohn Marino extern int case_compare (splay_tree_key, splay_tree_key);
899*e4b17023SJohn Marino 
900*e4b17023SJohn Marino extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree);
901*e4b17023SJohn Marino 
902*e4b17023SJohn Marino extern void c_do_switch_warnings (splay_tree, location_t, tree, tree);
903*e4b17023SJohn Marino 
904*e4b17023SJohn Marino extern tree build_function_call (location_t, tree, tree);
905*e4b17023SJohn Marino 
906*e4b17023SJohn Marino extern tree build_function_call_vec (location_t, tree,
907*e4b17023SJohn Marino     				     VEC(tree,gc) *, VEC(tree,gc) *);
908*e4b17023SJohn Marino 
909*e4b17023SJohn Marino extern tree resolve_overloaded_builtin (location_t, tree, VEC(tree,gc) *);
910*e4b17023SJohn Marino 
911*e4b17023SJohn Marino extern tree finish_label_address_expr (tree, location_t);
912*e4b17023SJohn Marino 
913*e4b17023SJohn Marino /* Same function prototype, but the C and C++ front ends have
914*e4b17023SJohn Marino    different implementations.  Used in c-common.c.  */
915*e4b17023SJohn Marino extern tree lookup_label (tree);
916*e4b17023SJohn Marino extern tree lookup_name (tree);
917*e4b17023SJohn Marino extern bool lvalue_p (const_tree);
918*e4b17023SJohn Marino 
919*e4b17023SJohn Marino extern bool vector_targets_convertible_p (const_tree t1, const_tree t2);
920*e4b17023SJohn Marino extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note);
921*e4b17023SJohn Marino 
922*e4b17023SJohn Marino extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
923*e4b17023SJohn Marino 
924*e4b17023SJohn Marino extern void init_c_lex (void);
925*e4b17023SJohn Marino 
926*e4b17023SJohn Marino extern void c_cpp_builtins (cpp_reader *);
927*e4b17023SJohn Marino extern void c_cpp_builtins_optimize_pragma (cpp_reader *, tree, tree);
928*e4b17023SJohn Marino extern bool c_cpp_error (cpp_reader *, int, int, location_t, unsigned int,
929*e4b17023SJohn Marino 			 const char *, va_list *)
930*e4b17023SJohn Marino      ATTRIBUTE_GCC_DIAG(6,0);
931*e4b17023SJohn Marino 
932*e4b17023SJohn Marino extern bool parse_optimize_options (tree, bool);
933*e4b17023SJohn Marino 
934*e4b17023SJohn Marino /* Positive if an implicit `extern "C"' scope has just been entered;
935*e4b17023SJohn Marino    negative if such a scope has just been exited.  */
936*e4b17023SJohn Marino extern GTY(()) int pending_lang_change;
937*e4b17023SJohn Marino 
938*e4b17023SJohn Marino /* Information recorded about each file examined during compilation.  */
939*e4b17023SJohn Marino 
940*e4b17023SJohn Marino struct c_fileinfo
941*e4b17023SJohn Marino {
942*e4b17023SJohn Marino   int time;	/* Time spent in the file.  */
943*e4b17023SJohn Marino 
944*e4b17023SJohn Marino   /* Flags used only by C++.
945*e4b17023SJohn Marino      INTERFACE_ONLY nonzero means that we are in an "interface" section
946*e4b17023SJohn Marino      of the compiler.  INTERFACE_UNKNOWN nonzero means we cannot trust
947*e4b17023SJohn Marino      the value of INTERFACE_ONLY.  If INTERFACE_UNKNOWN is zero and
948*e4b17023SJohn Marino      INTERFACE_ONLY is zero, it means that we are responsible for
949*e4b17023SJohn Marino      exporting definitions that others might need.  */
950*e4b17023SJohn Marino   short interface_only;
951*e4b17023SJohn Marino   short interface_unknown;
952*e4b17023SJohn Marino };
953*e4b17023SJohn Marino 
954*e4b17023SJohn Marino struct c_fileinfo *get_fileinfo (const char *);
955*e4b17023SJohn Marino extern void dump_time_statistics (void);
956*e4b17023SJohn Marino 
957*e4b17023SJohn Marino extern bool c_dump_tree (void *, tree);
958*e4b17023SJohn Marino 
959*e4b17023SJohn Marino extern void verify_sequence_points (tree);
960*e4b17023SJohn Marino 
961*e4b17023SJohn Marino extern tree fold_offsetof_1 (tree);
962*e4b17023SJohn Marino extern tree fold_offsetof (tree);
963*e4b17023SJohn Marino 
964*e4b17023SJohn Marino /* Places where an lvalue, or modifiable lvalue, may be required.
965*e4b17023SJohn Marino    Used to select diagnostic messages in lvalue_error and
966*e4b17023SJohn Marino    readonly_error.  */
967*e4b17023SJohn Marino enum lvalue_use {
968*e4b17023SJohn Marino   lv_assign,
969*e4b17023SJohn Marino   lv_increment,
970*e4b17023SJohn Marino   lv_decrement,
971*e4b17023SJohn Marino   lv_addressof,
972*e4b17023SJohn Marino   lv_asm
973*e4b17023SJohn Marino };
974*e4b17023SJohn Marino 
975*e4b17023SJohn Marino extern void readonly_error (tree, enum lvalue_use);
976*e4b17023SJohn Marino extern void lvalue_error (location_t, enum lvalue_use);
977*e4b17023SJohn Marino extern void invalid_indirection_error (location_t, tree, ref_operator);
978*e4b17023SJohn Marino 
979*e4b17023SJohn Marino extern int complete_array_type (tree *, tree, bool);
980*e4b17023SJohn Marino 
981*e4b17023SJohn Marino extern tree builtin_type_for_size (int, bool);
982*e4b17023SJohn Marino 
983*e4b17023SJohn Marino extern void c_common_mark_addressable_vec (tree);
984*e4b17023SJohn Marino 
985*e4b17023SJohn Marino extern void warn_array_subscript_with_type_char (tree);
986*e4b17023SJohn Marino extern void warn_about_parentheses (enum tree_code,
987*e4b17023SJohn Marino 				    enum tree_code, tree,
988*e4b17023SJohn Marino 				    enum tree_code, tree);
989*e4b17023SJohn Marino extern void warn_for_unused_label (tree label);
990*e4b17023SJohn Marino extern void warn_for_div_by_zero (location_t, tree divisor);
991*e4b17023SJohn Marino extern void warn_for_sign_compare (location_t,
992*e4b17023SJohn Marino 				   tree orig_op0, tree orig_op1,
993*e4b17023SJohn Marino 				   tree op0, tree op1,
994*e4b17023SJohn Marino 				   tree result_type,
995*e4b17023SJohn Marino 				   enum tree_code resultcode);
996*e4b17023SJohn Marino extern void do_warn_double_promotion (tree, tree, tree, const char *,
997*e4b17023SJohn Marino 				      location_t);
998*e4b17023SJohn Marino extern void set_underlying_type (tree);
999*e4b17023SJohn Marino extern void record_locally_defined_typedef (tree);
1000*e4b17023SJohn Marino extern void maybe_record_typedef_use (tree);
1001*e4b17023SJohn Marino extern void maybe_warn_unused_local_typedefs (void);
1002*e4b17023SJohn Marino extern VEC(tree,gc) *make_tree_vector (void);
1003*e4b17023SJohn Marino extern void release_tree_vector (VEC(tree,gc) *);
1004*e4b17023SJohn Marino extern VEC(tree,gc) *make_tree_vector_single (tree);
1005*e4b17023SJohn Marino extern VEC(tree,gc) *make_tree_vector_from_list (tree);
1006*e4b17023SJohn Marino extern VEC(tree,gc) *make_tree_vector_copy (const VEC(tree,gc) *);
1007*e4b17023SJohn Marino 
1008*e4b17023SJohn Marino /* In c-gimplify.c  */
1009*e4b17023SJohn Marino extern void c_genericize (tree);
1010*e4b17023SJohn Marino extern int c_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
1011*e4b17023SJohn Marino extern tree c_build_bind_expr (location_t, tree, tree);
1012*e4b17023SJohn Marino 
1013*e4b17023SJohn Marino /* In c-pch.c  */
1014*e4b17023SJohn Marino extern void pch_init (void);
1015*e4b17023SJohn Marino extern int c_common_valid_pch (cpp_reader *pfile, const char *name, int fd);
1016*e4b17023SJohn Marino extern void c_common_read_pch (cpp_reader *pfile, const char *name, int fd,
1017*e4b17023SJohn Marino 			       const char *orig);
1018*e4b17023SJohn Marino extern void c_common_write_pch (void);
1019*e4b17023SJohn Marino extern void c_common_no_more_pch (void);
1020*e4b17023SJohn Marino extern void c_common_pch_pragma (cpp_reader *pfile, const char *);
1021*e4b17023SJohn Marino extern void c_common_print_pch_checksum (FILE *f);
1022*e4b17023SJohn Marino 
1023*e4b17023SJohn Marino /* In *-checksum.c */
1024*e4b17023SJohn Marino extern const unsigned char executable_checksum[16];
1025*e4b17023SJohn Marino 
1026*e4b17023SJohn Marino /* In c-cppbuiltin.c  */
1027*e4b17023SJohn Marino extern void builtin_define_std (const char *macro);
1028*e4b17023SJohn Marino extern void builtin_define_with_value (const char *, const char *, int);
1029*e4b17023SJohn Marino extern void c_stddef_cpp_builtins (void);
1030*e4b17023SJohn Marino extern void fe_file_change (const struct line_map *);
1031*e4b17023SJohn Marino extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char);
1032*e4b17023SJohn Marino 
1033*e4b17023SJohn Marino /* In c-ppoutput.c  */
1034*e4b17023SJohn Marino extern void init_pp_output (FILE *);
1035*e4b17023SJohn Marino extern void preprocess_file (cpp_reader *);
1036*e4b17023SJohn Marino extern void pp_file_change (const struct line_map *);
1037*e4b17023SJohn Marino extern void pp_dir_change (cpp_reader *, const char *);
1038*e4b17023SJohn Marino extern bool check_missing_format_attribute (tree, tree);
1039*e4b17023SJohn Marino 
1040*e4b17023SJohn Marino /* In c-omp.c  */
1041*e4b17023SJohn Marino extern tree c_finish_omp_master (location_t, tree);
1042*e4b17023SJohn Marino extern tree c_finish_omp_critical (location_t, tree, tree);
1043*e4b17023SJohn Marino extern tree c_finish_omp_ordered (location_t, tree);
1044*e4b17023SJohn Marino extern void c_finish_omp_barrier (location_t);
1045*e4b17023SJohn Marino extern tree c_finish_omp_atomic (location_t, enum tree_code, enum tree_code,
1046*e4b17023SJohn Marino 				 tree, tree, tree, tree, tree);
1047*e4b17023SJohn Marino extern void c_finish_omp_flush (location_t);
1048*e4b17023SJohn Marino extern void c_finish_omp_taskwait (location_t);
1049*e4b17023SJohn Marino extern void c_finish_omp_taskyield (location_t);
1050*e4b17023SJohn Marino extern tree c_finish_omp_for (location_t, tree, tree, tree, tree, tree, tree);
1051*e4b17023SJohn Marino extern void c_split_parallel_clauses (location_t, tree, tree *, tree *);
1052*e4b17023SJohn Marino extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree);
1053*e4b17023SJohn Marino 
1054*e4b17023SJohn Marino /* Not in c-omp.c; provided by the front end.  */
1055*e4b17023SJohn Marino extern bool c_omp_sharing_predetermined (tree);
1056*e4b17023SJohn Marino extern tree c_omp_remap_decl (tree, bool);
1057*e4b17023SJohn Marino extern void record_types_used_by_current_var_decl (tree);
1058*e4b17023SJohn Marino 
1059*e4b17023SJohn Marino /* Return next tree in the chain for chain_next walking of tree nodes.  */
1060*e4b17023SJohn Marino static inline tree
c_tree_chain_next(tree t)1061*e4b17023SJohn Marino c_tree_chain_next (tree t)
1062*e4b17023SJohn Marino {
1063*e4b17023SJohn Marino   /* TREE_CHAIN of a type is TYPE_STUB_DECL, which is different
1064*e4b17023SJohn Marino      kind of object, never a long chain of nodes.  Prefer
1065*e4b17023SJohn Marino      TYPE_NEXT_VARIANT for types.  */
1066*e4b17023SJohn Marino   if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_TYPE_COMMON))
1067*e4b17023SJohn Marino     return TYPE_NEXT_VARIANT (t);
1068*e4b17023SJohn Marino   /* Otherwise, if there is TREE_CHAIN, return it.  */
1069*e4b17023SJohn Marino   if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_COMMON))
1070*e4b17023SJohn Marino     return TREE_CHAIN (t);
1071*e4b17023SJohn Marino   return NULL;
1072*e4b17023SJohn Marino }
1073*e4b17023SJohn Marino 
1074*e4b17023SJohn Marino /* Mask used by tm_stmt_attr.  */
1075*e4b17023SJohn Marino #define TM_STMT_ATTR_OUTER	2
1076*e4b17023SJohn Marino #define TM_STMT_ATTR_ATOMIC	4
1077*e4b17023SJohn Marino #define TM_STMT_ATTR_RELAXED	8
1078*e4b17023SJohn Marino 
1079*e4b17023SJohn Marino extern int parse_tm_stmt_attr (tree, int);
1080*e4b17023SJohn Marino 
1081*e4b17023SJohn Marino /* Mask used by tm_attr_to_mask and tm_mask_to_attr.  Note that these
1082*e4b17023SJohn Marino    are ordered specifically such that more restrictive attributes are
1083*e4b17023SJohn Marino    at lower bit positions.  This fact is known by the C++ tm attribute
1084*e4b17023SJohn Marino    inheritance code such that least bit extraction (mask & -mask) results
1085*e4b17023SJohn Marino    in the most restrictive attribute.  */
1086*e4b17023SJohn Marino #define TM_ATTR_SAFE			1
1087*e4b17023SJohn Marino #define TM_ATTR_CALLABLE		2
1088*e4b17023SJohn Marino #define TM_ATTR_PURE			4
1089*e4b17023SJohn Marino #define TM_ATTR_IRREVOCABLE		8
1090*e4b17023SJohn Marino #define TM_ATTR_MAY_CANCEL_OUTER	16
1091*e4b17023SJohn Marino 
1092*e4b17023SJohn Marino extern int tm_attr_to_mask (tree);
1093*e4b17023SJohn Marino extern tree tm_mask_to_attr (int);
1094*e4b17023SJohn Marino extern tree find_tm_attribute (tree);
1095*e4b17023SJohn Marino 
1096*e4b17023SJohn Marino /* A suffix-identifier value doublet that represents user-defined literals
1097*e4b17023SJohn Marino    for C++-0x.  */
1098*e4b17023SJohn Marino struct GTY(()) tree_userdef_literal {
1099*e4b17023SJohn Marino   struct tree_base base;
1100*e4b17023SJohn Marino   tree suffix_id;
1101*e4b17023SJohn Marino   tree value;
1102*e4b17023SJohn Marino   tree num_string;
1103*e4b17023SJohn Marino };
1104*e4b17023SJohn Marino 
1105*e4b17023SJohn Marino #define USERDEF_LITERAL_SUFFIX_ID(NODE) \
1106*e4b17023SJohn Marino   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->suffix_id)
1107*e4b17023SJohn Marino 
1108*e4b17023SJohn Marino #define USERDEF_LITERAL_VALUE(NODE) \
1109*e4b17023SJohn Marino   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->value)
1110*e4b17023SJohn Marino 
1111*e4b17023SJohn Marino #define USERDEF_LITERAL_NUM_STRING(NODE) \
1112*e4b17023SJohn Marino   (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->num_string)
1113*e4b17023SJohn Marino 
1114*e4b17023SJohn Marino #define USERDEF_LITERAL_TYPE(NODE) \
1115*e4b17023SJohn Marino   (TREE_TYPE (USERDEF_LITERAL_VALUE (NODE)))
1116*e4b17023SJohn Marino 
1117*e4b17023SJohn Marino extern tree build_userdef_literal (tree suffix_id, tree value, tree num_string);
1118*e4b17023SJohn Marino 
1119*e4b17023SJohn Marino #endif /* ! GCC_C_COMMON_H */
1120