OSDN Git Service

* cp-tree.h (remap_save_expr): Add walk_subtrees parameter.
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-tree.h
1 /* Definitions for C++ parsing and type checking.
2    Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
3    Hacked by Michael Tiemann (tiemann@cygnus.com)
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #include "c-common.h"
23 #include "function.h"
24 #include "splay-tree.h"
25 #include "varray.h"
26
27 #ifndef _CP_TREE_H
28 #define _CP_TREE_H
29
30 /* Usage of TREE_LANG_FLAG_?:
31    0: BINFO_MARKED (BINFO nodes).
32       COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
33       NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
34       DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
35       LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
36       TREE_NEGATED_INT (in INTEGER_CST).
37       TREE_INDIRECT_USING (in NAMESPACE_DECL).
38       IDENTIFIER_MARKED (used by search routines).
39       LOCAL_BINDING_P (in CPLUS_BINDING)
40       ICS_USER_FLAG (in _CONV)
41       CLEANUP_P (in TRY_BLOCK)
42       AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
43       SCOPE_BEGIN_P (in SCOPE_STMT)
44       CTOR_BEGIN_P (in CTOR_STMT)
45    1: IDENTIFIER_VIRTUAL_P.
46       TI_PENDING_TEMPLATE_FLAG.
47       TEMPLATE_PARMS_FOR_INLINE.
48       DELETE_EXPR_USE_VEC (in DELETE_EXPR).
49       (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
50       TYPE_USES_COMPLEX_INHERITANCE (in _TYPE).
51       C_DECLARED_LABEL_FLAG (in LABEL_DECL)
52       INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
53       BASELINK_P (in TREE_LIST)
54       ICS_ELLIPSIS_FLAG (in _CONV)
55       STMT_IS_FULL_EXPR_P (in _STMT)
56    2: IDENTIFIER_OPNAME_P.
57       BINFO_VBASE_MARKED.
58       BINFO_FIELDS_MARKED.
59       TYPE_VIRTUAL_P.
60       ICS_THIS_FLAG (in _CONV)
61       STMT_LINENO_FOR_FN_P (in _STMT)
62       BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
63    3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
64       BINFO_VTABLE_PATH_MARKED.
65       BINFO_PUSHDECLS_MARKED.
66       (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
67       ICS_BAD_FLAG (in _CONV)
68       FN_TRY_BLOCK_P (in TRY_BLOCK)
69       SCOPE_NO_CLEANUPS_P (in SCOPE_STMT)
70    4: BINFO_NEW_VTABLE_MARKED.
71       TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
72           or FIELD_DECL).
73       NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
74       SCOPE_PARTIAL_P (in SCOPE_STMT)
75    5: Not used.
76    6: Not used.
77
78    Usage of TYPE_LANG_FLAG_?:
79    0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
80    1: TYPE_HAS_CONSTRUCTOR.
81    2: TYPE_HAS_DESTRUCTOR.
82    3: TYPE_FOR_JAVA.
83    4: TYPE_NEEDS_DESTRUCTOR.
84    5: IS_AGGR_TYPE.
85    6: TYPE_BUILT_IN.
86
87    Usage of DECL_LANG_FLAG_?:
88    0: DECL_ERROR_REPORTED (in VAR_DECL).
89       DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
90       DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
91    1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
92       DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
93    2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
94       DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
95    3: DECL_IN_AGGR_P.
96    4: DECL_MAYBE_TEMPLATE.
97    5: DECL_INTERFACE_KNOWN.
98    6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
99    7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
100
101    Usage of language-independent fields in a language-dependent manner:
102    
103    TYPE_ALIAS_SET
104      This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
105      forth as a substitute for the mark bits provided in `lang_type'.
106      At present, only the six low-order bits are used.
107
108    TYPE_BINFO
109      For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
110      For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME.
111      For a TEMPLATE_TEMPLATE_PARM, this is
112      TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
113
114    DECL_SAVED_INSNS/DECL_FIELD_SIZE
115      For a static VAR_DECL, this is DECL_INIT_PRIORITY.
116
117    BINFO_VIRTUALS
118      For a binfo, this is a TREE_LIST.  The TREE_PURPOSE of each node
119      gives the amount by which to adjust the `this' pointer when
120      calling the function.  The TREE_VALUE is the declaration for the 
121      virtual function itself.  When CLASSTYPE_COM_INTERFACE_P does not
122      hold, the first entry does not have a TREE_VALUE; it is just an
123      offset.
124
125    DECL_ARGUMENTS
126      For a VAR_DECL this is DECL_ANON_UNION_ELEMS.  */
127
128 /* Language-specific tree checkers. */
129
130 #if defined ENABLE_CHECKING && (GCC_VERSION >= 2007)
131
132 #define VAR_OR_FUNCTION_DECL_CHECK(NODE)                        \
133 ({  const tree __t = NODE;                                      \
134     enum tree_code __c = TREE_CODE(__t);                        \
135     if (__c != VAR_DECL && __c != FUNCTION_DECL)                \
136       tree_check_failed (__t, VAR_DECL, __FILE__,               \
137                          __LINE__, __PRETTY_FUNCTION__);        \
138     __t; })
139
140 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE)             \
141 ({  const tree __t = NODE;                                      \
142     enum tree_code __c = TREE_CODE(__t);                        \
143     if (__c != VAR_DECL                                         \
144         && __c != FUNCTION_DECL                                 \
145         && __c != TYPE_DECL                                     \
146         && __c != TEMPLATE_DECL)                                \
147       tree_check_failed (__t, VAR_DECL, __FILE__,               \
148                          __LINE__, __PRETTY_FUNCTION__);        \
149     __t; })
150
151 #define RECORD_OR_UNION_TYPE_CHECK(NODE)                        \
152 ({  const tree __t = NODE;                                      \
153     enum tree_code __c = TREE_CODE(__t);                        \
154     if (__c != RECORD_TYPE && __c != UNION_TYPE)                \
155       tree_check_failed (__t, RECORD_TYPE, __FILE__,            \
156                          __LINE__, __PRETTY_FUNCTION__);        \
157     __t; })
158
159 #else /* not ENABLE_CHECKING, or not gcc */
160
161 #define VAR_OR_FUNCTION_DECL_CHECK(NODE)        NODE
162 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE)     NODE
163 #define RECORD_OR_UNION_TYPE_CHECK(NODE)        NODE
164
165 #endif
166
167 /* Language-dependent contents of an identifier.  */
168
169 struct lang_identifier
170 {
171   struct tree_identifier ignore;
172   tree namespace_bindings;
173   tree bindings;
174   tree class_value;
175   tree class_template_info;
176   struct lang_id2 *x;
177 };
178
179 #define LANG_IDENTIFIER_CAST(NODE) \
180         ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
181
182 struct lang_id2
183 {
184   tree label_value, implicit_decl;
185   tree error_locus;
186 };
187
188 typedef struct 
189 {
190   tree t;
191   int new_type_flag;
192 } flagged_type_tree;
193
194 typedef struct 
195 {
196   char common[sizeof (struct tree_common)];
197   HOST_WIDE_INT index;
198   HOST_WIDE_INT level;
199   HOST_WIDE_INT orig_level;
200   tree decl;
201 } template_parm_index;
202
203 typedef struct ptrmem_cst
204 {
205   char common[sizeof (struct tree_common)];
206   /* This isn't used, but the middle-end expects all constants to have 
207      this field.  */
208   struct rtx_def *rtl;
209   tree member;
210 }* ptrmem_cst_t;
211
212 /* Nonzero if this binding is for a local scope, as opposed to a class
213    or namespace scope.  */
214 #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE)
215
216 /* Nonzero if BINDING_VALUE is from a base class of the class which is
217    currently being defined.  */
218 #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE)
219
220 /* For a binding between a name and an entity at a non-local scope,
221    defines the scope where the binding is declared.  (Either a class
222    _TYPE node, or a NAMESPACE_DECL.)  This macro should be used only
223    for namespace-level bindings; on the IDENTIFIER_BINDING list
224    BINDING_LEVEL is used instead.  */
225 #define BINDING_SCOPE(NODE) (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->scope.scope)
226
227 /* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE.  */
228 #define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 ((NODE))
229
230 /* This is the declaration bound to the name. Possible values:
231    variable, overloaded function, namespace, template, enumerator.  */
232 #define BINDING_VALUE(NODE)    (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->value)
233
234 /* If name is bound to a type, this is the type (struct, union, enum).  */
235 #define BINDING_TYPE(NODE)     TREE_TYPE(NODE)
236
237 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
238   namespace_binding (NODE, global_namespace)
239 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
240   set_namespace_binding (NODE, global_namespace, VAL)
241 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
242   namespace_binding (NODE, current_namespace)
243 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
244   set_namespace_binding (NODE, current_namespace, VAL)
245
246 struct tree_binding
247 {
248   char common[sizeof (struct tree_common)];
249   union {
250     tree scope;
251     struct binding_level *level;
252   } scope;
253   tree value;
254 };
255
256 /* The overloaded FUNCTION_DECL. */
257 #define OVL_FUNCTION(NODE)   (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
258 #define OVL_CHAIN(NODE)      TREE_CHAIN(NODE)
259 /* Polymorphic access to FUNCTION and CHAIN. */
260 #define OVL_CURRENT(NODE)     \
261   ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
262 #define OVL_NEXT(NODE)        \
263   ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
264 /* If set, this was imported in a using declaration.
265    This is not to confuse with being used somewhere, which
266    is not important for this node. */
267 #define OVL_USED(NODE)        TREE_USED(NODE)
268
269 struct tree_overload
270 {
271   char common[sizeof (struct tree_common)];
272   tree function;
273 };
274
275 /* A `baselink' is a TREE_LIST whose TREE_PURPOSE is a BINFO
276    indicating a particular base class, and whose TREE_VALUE is a
277    (possibly overloaded) function from that base class.  */
278 #define BASELINK_P(NODE) \
279   (TREE_CODE (NODE) == TREE_LIST && TREE_LANG_FLAG_1 (NODE))
280 #define SET_BASELINK_P(NODE) \
281   (TREE_LANG_FLAG_1 (NODE) = 1)
282
283 #define WRAPPER_PTR(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.ptr)
284 #define WRAPPER_INT(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.i)
285
286 struct tree_wrapper
287 {
288   char common[sizeof (struct tree_common)];
289   union {
290     void *ptr;
291     int i;
292   } u;
293 };
294
295 #define SRCLOC_FILE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->filename)
296 #define SRCLOC_LINE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->linenum)
297 struct tree_srcloc
298 {
299   char common[sizeof (struct tree_common)];
300   char *filename;
301   int linenum;
302 };
303
304 /* To identify to the debug emitters if it should pay attention to the
305    flag `-Wtemplate-debugging'.  */
306 #define HAVE_TEMPLATES 1
307
308 /* Macros for access to language-specific slots in an identifier.  */
309
310 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE)     \
311   (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
312 #define IDENTIFIER_TEMPLATE(NODE)       \
313   (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
314
315 /* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the
316     identifier.  It's TREE_CHAIN is the next outermost binding.  Each
317     BINDING_VALUE is a DECL for the associated declaration.  Thus,
318     name lookup consists simply of pulling off the node at the front
319     of the list (modulo oddities for looking up the names of types,
320     and such.)  You can use BINDING_SCOPE or BINDING_LEVEL to
321     determine the scope that bound the name.  */
322 #define IDENTIFIER_BINDING(NODE) \
323   (LANG_IDENTIFIER_CAST (NODE)->bindings)
324
325 /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
326    NULL_TREE if there is no binding.  */
327 #define IDENTIFIER_VALUE(NODE)                  \
328   (IDENTIFIER_BINDING (NODE)                    \
329    ? BINDING_VALUE (IDENTIFIER_BINDING (NODE))  \
330    : NULL_TREE)
331
332 /* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
333    class, and IDENTIFIER_CLASS_VALUE is the value binding.  This is
334    just a pointer to the BINDING_VALUE of one of the bindings in the
335    IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
336    IDENTIFIER_BINDING.  */
337 #define IDENTIFIER_CLASS_VALUE(NODE) \
338   (LANG_IDENTIFIER_CAST (NODE)->class_value)
339
340 /* The amount of time used by the file whose special "time identifier"
341    is NODE, represented as an INTEGER_CST.  See get_time_identifier.  */
342 #define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)
343
344 /* For a "time identifier" this is a INTEGER_CST.  The
345    TREE_INT_CST_LOW is 1 if the corresponding file is "interface only".
346    The TRE_INT_CST_HIGH is 1 if it is "interface unknown".  */
347 #define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)
348
349 /* TREE_TYPE only indicates on local and class scope the current
350    type. For namespace scope, the presence of a type in any namespace
351    is indicated with global_type_node, and the real type behind must
352    be found through lookup. */
353 #define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
354 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
355 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
356 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
357
358 #define LANG_ID_FIELD(NAME,NODE)                        \
359   (LANG_IDENTIFIER_CAST (NODE)->x                       \
360    ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)   
361
362 #define SET_LANG_ID(NODE,VALUE,NAME)                                      \
363   (LANG_IDENTIFIER_CAST (NODE)->x == 0                            \
364    ? LANG_IDENTIFIER_CAST (NODE)->x                                       \
365       = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
366    LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE))
367
368 #define IDENTIFIER_LABEL_VALUE(NODE)        LANG_ID_FIELD(label_value, NODE)
369 #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE)   \
370         SET_LANG_ID(NODE, VALUE, label_value)
371
372 #define IDENTIFIER_IMPLICIT_DECL(NODE)      LANG_ID_FIELD(implicit_decl, NODE)
373 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
374         SET_LANG_ID(NODE, VALUE, implicit_decl)
375
376 #define IDENTIFIER_ERROR_LOCUS(NODE)        LANG_ID_FIELD(error_locus, NODE)
377 #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE)  \
378         SET_LANG_ID(NODE, VALUE, error_locus)
379
380
381 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
382
383 /* Nonzero if this identifier is the prefix for a mangled C++ operator
384    name.  */
385 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
386
387 /* Nonzero if this identifier is the name of a type-conversion
388    operator.  */
389 #define IDENTIFIER_TYPENAME_P(NODE)                     \
390   (! strncmp (IDENTIFIER_POINTER (NODE),                \
391               OPERATOR_TYPENAME_FORMAT,                 \
392               strlen (OPERATOR_TYPENAME_FORMAT)))
393
394 /* Nonzero means reject anything that ANSI standard C forbids.  */
395 extern int pedantic;
396
397 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
398 #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
399
400 /* Record in each node resulting from a binary operator
401    what operator was specified for it.  */
402 #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
403
404 /* Store a value in that field.  */
405 #define C_SET_EXP_ORIGINAL_CODE(exp, code) \
406   (TREE_COMPLEXITY (exp) = (int)(code))
407 \f
408 /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
409    next exception handler.  */
410 extern tree exception_throw_decl;
411
412 enum cp_tree_index
413 {
414     CPTI_JAVA_BYTE_TYPE,
415     CPTI_JAVA_SHORT_TYPE,
416     CPTI_JAVA_INT_TYPE,
417     CPTI_JAVA_LONG_TYPE,
418     CPTI_JAVA_FLOAT_TYPE,
419     CPTI_JAVA_DOUBLE_TYPE,
420     CPTI_JAVA_CHAR_TYPE,
421     CPTI_JAVA_BOOLEAN_TYPE,
422
423     CPTI_VOID_ZERO,
424     CPTI_WCHAR_DECL,
425     CPTI_VTABLE_ENTRY_TYPE,
426     CPTI_DELTA_TYPE,
427     CPTI_CLEANUP_TYPE,
428
429     CPTI_TP_DESC_TYPE,
430     CPTI_ACCESS_MODE_TYPE,
431     CPTI_BLTN_DESC_TYPE,
432     CPTI_USER_DESC_TYPE,
433     CPTI_CLASS_DESC_TYPE,
434     CPTI_PTR_DESC_TYPE,
435     CPTI_ATTR_DESC_TYPE,
436     CPTI_FUNC_DESC_TYPE,
437     CPTI_PTMF_DESC_TYPE,
438     CPTI_PTMD_DESC_TYPE,
439     
440     CPTI_CLASS_STAR_TYPE,
441     CPTI_CLASS_TYPE,
442     CPTI_RECORD_TYPE,
443     CPTI_UNION_TYPE,
444     CPTI_ENUM_TYPE,
445     CPTI_UNKNOWN_TYPE,
446     CPTI_VTBL_TYPE,
447     CPTI_VTBL_PTR_TYPE,
448     CPTI_STD,
449     CPTI_TYPE_INFO_TYPE,
450     CPTI_TINFO_FN_ID,
451     CPTI_TINFO_FN_TYPE,
452     CPTI_ABORT_FNDECL,
453     CPTI_GLOBAL_DELETE_FNDECL,
454
455     CPTI_ACCESS_DEFAULT,
456     CPTI_ACCESS_PUBLIC,
457     CPTI_ACCESS_PROTECTED,
458     CPTI_ACCESS_PRIVATE,
459     CPTI_ACCESS_DEFAULT_VIRTUAL,
460     CPTI_ACCESS_PUBLIC_VIRTUAL,
461     CPTI_ACCESS_PROTECTED_VIRTUAL,
462     CPTI_ACCESS_PRIVATE_VIRTUAL,
463
464     CPTI_CTOR_IDENTIFIER,
465     CPTI_DELTA2_IDENTIFIER,
466     CPTI_DELTA_IDENTIFIER,
467     CPTI_DTOR_IDENTIFIER,
468     CPTI_IN_CHARGE_IDENTIFIER,
469     CPTI_INDEX_IDENTIFIER,
470     CPTI_NELTS_IDENTIFIER,
471     CPTI_THIS_IDENTIFIER,
472     CPTI_PFN_IDENTIFIER,
473     CPTI_PFN_OR_DELTA2_IDENTIFIER,
474     CPTI_VPTR_IDENTIFIER,
475
476     CPTI_LANG_NAME_C,
477     CPTI_LANG_NAME_CPLUSPLUS,
478     CPTI_LANG_NAME_JAVA,
479
480     CPTI_EMPTY_EXCEPT_SPEC,
481     CPTI_NULL,
482     CPTI_JCLASS,
483     CPTI_MINUS_ONE,
484     CPTI_TERMINATE,
485     CPTI_ATEXIT,
486
487     CPTI_MAX
488 };
489
490 extern tree cp_global_trees[CPTI_MAX];
491
492 #define java_byte_type_node             cp_global_trees[CPTI_JAVA_BYTE_TYPE]
493 #define java_short_type_node            cp_global_trees[CPTI_JAVA_SHORT_TYPE]
494 #define java_int_type_node              cp_global_trees[CPTI_JAVA_INT_TYPE]
495 #define java_long_type_node             cp_global_trees[CPTI_JAVA_LONG_TYPE]
496 #define java_float_type_node            cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
497 #define java_double_type_node           cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
498 #define java_char_type_node             cp_global_trees[CPTI_JAVA_CHAR_TYPE]
499 #define java_boolean_type_node          cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
500
501 #define void_zero_node                  cp_global_trees[CPTI_VOID_ZERO]
502 #define wchar_decl_node                 cp_global_trees[CPTI_WCHAR_DECL]
503 #define vtable_entry_type               cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
504 #define delta_type_node                 cp_global_trees[CPTI_DELTA_TYPE]
505 #define __tp_desc_type_node             cp_global_trees[CPTI_TP_DESC_TYPE]
506 #define __access_mode_type_node         cp_global_trees[CPTI_ACCESS_MODE_TYPE]
507 #define __bltn_desc_type_node           cp_global_trees[CPTI_BLTN_DESC_TYPE]
508 #define __user_desc_type_node           cp_global_trees[CPTI_USER_DESC_TYPE]
509 #define __class_desc_type_node          cp_global_trees[CPTI_CLASS_DESC_TYPE]
510 #define __ptr_desc_type_node            cp_global_trees[CPTI_PTR_DESC_TYPE]
511 #define __attr_desc_type_node           cp_global_trees[CPTI_ATTR_DESC_TYPE]
512 #define __func_desc_type_node           cp_global_trees[CPTI_FUNC_DESC_TYPE]
513 #define __ptmf_desc_type_node           cp_global_trees[CPTI_PTMF_DESC_TYPE]
514 #define __ptmd_desc_type_node           cp_global_trees[CPTI_PTMD_DESC_TYPE]
515 #define class_star_type_node            cp_global_trees[CPTI_CLASS_STAR_TYPE]
516 #define class_type_node                 cp_global_trees[CPTI_CLASS_TYPE]
517 #define record_type_node                cp_global_trees[CPTI_RECORD_TYPE]
518 #define union_type_node                 cp_global_trees[CPTI_UNION_TYPE]
519 #define enum_type_node                  cp_global_trees[CPTI_ENUM_TYPE]
520 #define unknown_type_node               cp_global_trees[CPTI_UNKNOWN_TYPE]
521 #define vtbl_type_node                  cp_global_trees[CPTI_VTBL_TYPE]
522 #define vtbl_ptr_type_node              cp_global_trees[CPTI_VTBL_PTR_TYPE]
523 #define std_node                        cp_global_trees[CPTI_STD]
524 #define type_info_type_node             cp_global_trees[CPTI_TYPE_INFO_TYPE]
525 #define tinfo_fn_id                     cp_global_trees[CPTI_TINFO_FN_ID]
526 #define tinfo_fn_type                   cp_global_trees[CPTI_TINFO_FN_TYPE]
527 #define abort_fndecl                    cp_global_trees[CPTI_ABORT_FNDECL]
528 #define global_delete_fndecl            cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
529
530 /* Define the sets of attributes that member functions and baseclasses
531    can have.  These are sensible combinations of {public,private,protected}
532    cross {virtual,non-virtual}.  */
533
534 #define access_default_node             cp_global_trees[CPTI_ACCESS_DEFAULT]
535 #define access_public_node              cp_global_trees[CPTI_ACCESS_PUBLIC]
536 #define access_protected_node           cp_global_trees[CPTI_ACCESS_PROTECTED]
537 #define access_private_node             cp_global_trees[CPTI_ACCESS_PRIVATE]
538 #define access_default_virtual_node     cp_global_trees[CPTI_ACCESS_DEFAULT_VIRTUAL]
539 #define access_public_virtual_node      cp_global_trees[CPTI_ACCESS_PUBLIC_VIRTUAL]
540 #define access_protected_virtual_node   cp_global_trees[CPTI_ACCESS_PROTECTED_VIRTUAL]
541 #define access_private_virtual_node     cp_global_trees[CPTI_ACCESS_PRIVATE_VIRTUAL]
542
543 /* We cache these tree nodes so as to call get_identifier less
544    frequently.  */
545
546 #define ctor_identifier                 cp_global_trees[CPTI_CTOR_IDENTIFIER]
547 #define delta2_identifier               cp_global_trees[CPTI_DELTA2_IDENTIFIER]
548 #define delta_identifier                cp_global_trees[CPTI_DELTA_IDENTIFIER]
549 #define dtor_identifier                 cp_global_trees[CPTI_DTOR_IDENTIFIER]
550 #define in_charge_identifier            cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
551 #define index_identifier                cp_global_trees[CPTI_INDEX_IDENTIFIER]
552 #define nelts_identifier                cp_global_trees[CPTI_NELTS_IDENTIFIER]
553 #define this_identifier                 cp_global_trees[CPTI_THIS_IDENTIFIER]
554 #define pfn_identifier                  cp_global_trees[CPTI_PFN_IDENTIFIER]
555 #define pfn_or_delta2_identifier        cp_global_trees[CPTI_PFN_OR_DELTA2_IDENTIFIER]
556 #define vptr_identifier                 cp_global_trees[CPTI_VPTR_IDENTIFIER]
557
558 #define lang_name_c                     cp_global_trees[CPTI_LANG_NAME_C]
559 #define lang_name_cplusplus             cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
560 #define lang_name_java                  cp_global_trees[CPTI_LANG_NAME_JAVA]
561
562 /* Exception specifier used for throw().  */
563 #define empty_except_spec               cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
564
565 /* The node for `__null'.  */
566 #define null_node                       cp_global_trees[CPTI_NULL]
567
568 /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
569 #define jclass_node                     cp_global_trees[CPTI_JCLASS]
570
571 /* A node for `(int) -1'.  */
572 #define minus_one_node                  cp_global_trees[CPTI_MINUS_ONE]
573
574 /* The declaration for `std::terminate'.  */
575 #define terminate_node                  cp_global_trees[CPTI_TERMINATE]
576
577 /* The declaration for `std::atexit'.  */
578 #define atexit_node                     cp_global_trees[CPTI_ATEXIT]
579
580 /* The type of a destructor.  */
581 #define cleanup_type                    cp_global_trees[CPTI_CLEANUP_TYPE]
582
583 /* Global state.  */
584
585 struct stmt_tree {
586   tree x_last_stmt;
587   tree x_last_expr_type;
588   int stmts_are_full_exprs_p; 
589 };
590
591 struct saved_scope {
592   tree old_bindings;
593   tree old_namespace;
594   tree class_name;
595   tree class_type;
596   tree access_specifier;
597   tree function_decl;
598   varray_type lang_base;
599   tree *lang_stack;
600   tree lang_name;
601   tree x_function_parms;
602   tree template_parms;
603   tree x_previous_class_type;
604   tree x_previous_class_values;
605   tree x_saved_tree;
606
607   HOST_WIDE_INT x_processing_template_decl;
608   int x_processing_specialization;
609   int x_processing_explicit_instantiation;
610   int need_pop_function_context;
611
612   struct stmt_tree x_stmt_tree;
613
614   struct binding_level *class_bindings;
615   struct binding_level *bindings;
616
617   struct saved_scope *prev;
618 };
619
620 /* The current open namespace.  */
621
622 #define current_namespace scope_chain->old_namespace
623
624 /* IDENTIFIER_NODE: name of current class */
625
626 #define current_class_name scope_chain->class_name
627
628 /* _TYPE: the type of the current class */
629
630 #define current_class_type scope_chain->class_type
631
632 /* When parsing a class definition, the access specifier most recently
633    given by the user, or, if no access specifier was given, the
634    default value appropriate for the kind of class (i.e., struct,
635    class, or union).  */
636
637 #define current_access_specifier scope_chain->access_specifier
638
639 /* Pointer to the top of the language name stack.  */
640
641 #define current_lang_stack scope_chain->lang_stack
642 #define current_lang_base scope_chain->lang_base
643 #define current_lang_name scope_chain->lang_name
644
645 /* Parsing a function declarator leaves a list of parameter names
646    or a chain or parameter decls here.  */
647
648 #define current_function_parms scope_chain->x_function_parms
649 #define current_template_parms scope_chain->template_parms
650
651 #define processing_template_decl scope_chain->x_processing_template_decl
652 #define processing_specialization scope_chain->x_processing_specialization
653 #define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
654
655 /* _TYPE: the previous type that was a class */
656
657 #define previous_class_type scope_chain->x_previous_class_type
658
659 /* This is a copy of the class_shadowed list of the previous class
660    binding contour when at global scope.  It's used to reset
661    IDENTIFIER_CLASS_VALUEs when entering another class scope (i.e. a
662    cache miss).  */
663
664 #define previous_class_values scope_chain->x_previous_class_values
665
666 extern struct saved_scope *scope_chain;
667
668 /* Global state pertinent to the current function.  */
669
670 struct language_function
671 {
672   tree x_named_labels;
673   tree x_ctor_label;
674   tree x_dtor_label;
675   tree x_base_init_list;
676   tree x_member_init_list;
677   tree x_current_class_ptr;
678   tree x_current_class_ref;
679   tree x_eh_spec_try_block;
680   tree x_scope_stmt_stack;
681   tree x_in_charge_parm;
682
683   tree *x_vcalls_possible_p;
684
685   struct rtx_def *x_result_rtx;
686
687   int returns_value;
688   int returns_null;
689   int parms_stored;
690   int temp_name_counter;
691   int in_function_try_handler;
692   int x_expanding_p;
693   int name_declared;
694   int vtbls_set_up_p;
695
696   struct stmt_tree x_stmt_tree;
697
698   struct named_label_list *x_named_label_uses;
699   struct binding_level *bindings;
700
701   const char *cannot_inline;
702 };
703
704 /* The current C++-specific per-function global variables.  */
705
706 #define cp_function_chain (current_function->language)
707
708 /* In a destructor, the point at which all derived class destroying
709    has been done, just before any base class destroying will be done.  */
710
711 #define dtor_label cp_function_chain->x_dtor_label
712
713 /* In a constructor, the point at which we are ready to return
714    the pointer to the initialized object.  */
715
716 #define ctor_label cp_function_chain->x_ctor_label
717
718 /* In C++, structures with well-defined constructors are initialized by
719    those constructors, unasked.  CURRENT_BASE_INIT_LIST
720    holds a list of stmts for a BASE_INIT term in the grammar.
721    This list has one element for each base class which must be
722    initialized.  The list elements are [basename, init], with
723    type basetype.  This allows the possibly anachronistic form
724    (assuming d : a, b, c) "d (int a) : c(a+5), b (a-4), a (a+3)"
725    where each successive term can be handed down the constructor
726    line.  Perhaps this was not intended.  */
727
728 #define current_base_init_list cp_function_chain->x_base_init_list
729 #define current_member_init_list cp_function_chain->x_member_init_list
730
731 /* When we're processing a member function, current_class_ptr is the
732    PARM_DECL for the `this' pointer.  The current_class_ref is an
733    expression for `*this'.  */
734
735 #define current_class_ptr \
736   (current_function ? cp_function_chain->x_current_class_ptr : NULL_TREE)
737 #define current_class_ref \
738   (current_function ? cp_function_chain->x_current_class_ref : NULL_TREE)
739
740 /* Information about the current statement tree.  */
741
742 #define current_stmt_tree                       \
743   (current_function                             \
744    ? &cp_function_chain->x_stmt_tree            \
745    : &scope_chain->x_stmt_tree)
746
747 /* When building a statement-tree, this is the last statement added to
748    the tree.  */
749
750 #define last_tree current_stmt_tree->x_last_stmt
751
752 /* The type of the last expression-statement we have seen.  This is
753    required because the type of a statement-expression is the type of
754    the last expression statement.  */
755
756 #define last_expr_type current_stmt_tree->x_last_expr_type
757
758 /* The TRY_BLOCK for the exception-specifiers for the current
759    function, if any.  */
760
761 #define current_eh_spec_try_block cp_function_chain->x_eh_spec_try_block
762
763 /* The stack of SCOPE_STMTs for the current function.  */
764
765 #define current_scope_stmt_stack cp_function_chain->x_scope_stmt_stack
766
767 /* The `__in_chrg' parameter for the current function.  Only used for
768    destructors.  */
769
770 #define current_in_charge_parm cp_function_chain->x_in_charge_parm
771
772 /* In destructors, this is a pointer to a condition in an
773    if-statement.  If the pointed-to value is boolean_true_node, then
774    there may be virtual function calls in this destructor.  */
775
776 #define current_vcalls_possible_p cp_function_chain->x_vcalls_possible_p
777
778 /* Set to 0 at beginning of a function definition, set to 1 if
779    a return statement that specifies a return value is seen.  */
780
781 #define current_function_returns_value cp_function_chain->returns_value
782
783 /* Set to 0 at beginning of a function definition, set to 1 if
784    a return statement with no argument is seen.  */
785
786 #define current_function_returns_null cp_function_chain->returns_null
787
788 #define current_function_just_assigned_this \
789   cp_function_chain->just_assigned_this
790
791 #define current_function_parms_stored \
792   cp_function_chain->parms_stored
793
794 /* One if we have already declared __FUNCTION__ (and related
795    variables) in the current function.  Two if we are in the process
796    of doing so.  */
797
798 #define current_function_name_declared \
799   cp_function_chain->name_declared
800
801 /* Nonzero if we have already generated code to initialize virtual
802    function tables in this function.  */
803
804 #define vtbls_set_up_p cp_function_chain->vtbls_set_up_p
805
806 /* Used to help generate temporary names which are unique within
807    a function.  Reset to 0 by start_function.  */
808
809 #define temp_name_counter cp_function_chain->temp_name_counter
810
811 /* Non-zero if we should generate RTL for functions that we process.
812    When this is zero, we just accumulate tree structure, without
813    interacting with the back end.  */
814
815 #define expanding_p cp_function_chain->x_expanding_p
816
817 /* Non-zero if we are in the semantic analysis phase for the current
818    function.  */
819
820 #define doing_semantic_analysis_p() (!expanding_p)
821
822 /* Non-zero if we should treat statements as full expressions.  In
823    particular, this variable is no-zero if at the end of a statement
824    we should destroy any temporaries created during that statement.
825    Similarly, if, at the end of a block, we should destroy any local
826    variables in this block.  Normally, this variable is non-zero,
827    since those are the normal semantics of C++.
828
829    However, in order to represent aggregate initialization code as
830    tree structure, we use statement-expressions.  The statements
831    within the statement expression should not result in cleanups being
832    run until the entire enclosing statement is complete.  */
833
834 #define stmts_are_full_exprs_p \
835   current_stmt_tree->stmts_are_full_exprs_p
836
837 #define in_function_try_handler cp_function_chain->in_function_try_handler
838
839 extern tree current_function_return_value;
840 extern tree global_namespace;
841
842 extern tree ridpointers[];
843 extern tree ansi_opname[];
844 extern tree ansi_assopname[];
845
846 /* Nonzero means `$' can be in an identifier.  */
847
848 extern int dollars_in_ident;
849
850 /* Nonzero means allow type mismatches in conditional expressions;
851    just make their values `void'.   */
852
853 extern int flag_cond_mismatch;
854
855 /* Nonzero means don't recognize the keyword `asm'.  */
856
857 extern int flag_no_asm;
858
859 /* For cross referencing.  */
860
861 extern int flag_gnu_xref;
862
863 /* For environments where you can use GNU binutils (as, ld in particular).  */
864
865 extern int flag_gnu_binutils;
866
867 /* Nonzero means warn about implicit declarations.  */
868
869 extern int warn_implicit;
870
871 /* Nonzero means warn about usage of long long when `-pedantic'.  */
872
873 extern int warn_long_long;
874
875 /* Nonzero means warn when all ctors or dtors are private, and the class
876    has no friends.  */
877
878 extern int warn_ctor_dtor_privacy;
879
880 /* Nonzero means warn about function definitions that default the return type
881    or that use a null return and have a return-type other than void.  */
882
883 extern int warn_return_type;
884
885 /* Nonzero means give string constants the type `const char *', as mandated
886    by the standard.  */
887
888 extern int flag_const_strings;
889
890 /* If non-NULL, dump the tree structure for the entire translation
891    unit to this file.  */
892
893 extern char *flag_dump_translation_unit;
894
895 /* Nonzero means warn about deprecated conversion from string constant to
896    `char *'.  */
897
898 extern int warn_write_strings;
899
900 /* Nonzero means warn about sizeof(function) or addition/subtraction
901    of function pointers.  */
902
903 extern int warn_pointer_arith;
904
905 /* Nonzero means warn about suggesting putting in ()'s.  */
906
907 extern int warn_parentheses;
908
909 /* Nonzero means warn about multiple (redundant) decls for the same single
910    variable or function.  */
911
912 extern int warn_redundant_decls;
913
914 /* Warn if initializer is not completely bracketed.  */
915
916 extern int warn_missing_braces;
917
918 /* Warn about comparison of signed and unsigned values.  */
919
920 extern int warn_sign_compare;
921
922 /* Warn about testing equality of floating point numbers. */
923
924 extern int warn_float_equal;
925
926 /* Warn about a subscript that has type char.  */
927
928 extern int warn_char_subscripts;
929
930 /* Nonzero means warn about pointer casts that can drop a type qualifier
931    from the pointer target type.  */
932
933 extern int warn_cast_qual;
934
935 /* Warn about *printf or *scanf format/argument anomalies.  */
936
937 extern int warn_format;
938
939 /* Nonzero means warn about non virtual destructors in classes that have
940    virtual functions.  */
941
942 extern int warn_nonvdtor;
943
944 /* Non-zero means warn when we convert a pointer to member function
945    into a pointer to (void or function).  */
946
947 extern int warn_pmf2ptr;
948
949 /* Nonzero means warn about violation of some Effective C++ style rules.  */
950
951 extern int warn_ecpp;
952
953 /* Nonzero means warn where overload resolution chooses a promotion from
954    unsigned to signed over a conversion to an unsigned of the same size.  */
955
956 extern int warn_sign_promo;
957
958 /* Non-zero means warn when a function is declared extern and later inline.  */
959
960 extern int warn_extern_inline;
961
962 /* Non-zero means warn when an old-style cast is used.  */
963
964 extern int warn_old_style_cast;
965
966 /* Nonzero means to treat bitfields as unsigned unless they say `signed'.  */
967
968 extern int flag_signed_bitfields;
969
970 /* True for more efficient but incompatible (not fully tested)
971    vtable implementation (using thunks).
972    0 is old behavior; 1 is new behavior.  */
973 extern int flag_vtable_thunks;
974
975 /* INTERFACE_ONLY nonzero means that we are in an "interface"
976    section of the compiler.  INTERFACE_UNKNOWN nonzero means
977    we cannot trust the value of INTERFACE_ONLY.  If INTERFACE_UNKNOWN
978    is zero and INTERFACE_ONLY is zero, it means that we are responsible
979    for exporting definitions that others might need.  */
980 extern int interface_only, interface_unknown;
981
982 /* Nonzero means we should attempt to elide constructors when possible.  */
983
984 extern int flag_elide_constructors;
985
986 /* Nonzero means enable obscure ANSI features and disable GNU extensions
987    that might cause ANSI-compliant code to be miscompiled.  */
988
989 extern int flag_ansi;
990
991 /* Nonzero means that member functions defined in class scope are
992    inline by default.  */
993
994 extern int flag_default_inline;
995
996 /* The name-mangling scheme to use.  Versions of gcc before 2.8 use
997    version 0.  */
998 extern int name_mangling_version;
999
1000 /* Nonzero means that guiding declarations are allowed.  */
1001 extern int flag_guiding_decls;
1002
1003 /* Nonzero if wchar_t should be `unsigned short' instead of whatever it
1004    would normally be, for use with WINE.  */
1005 extern int flag_short_wchar;
1006
1007 /* Nonzero if squashed mangling is to be performed. 
1008    This uses the B and K codes to reference previously seen class types 
1009    and class qualifiers.       */
1010 extern int flag_do_squangling;
1011
1012 /* Nonzero means generate separate instantiation control files and juggle
1013    them at link time.  */
1014 extern int flag_use_repository;
1015
1016 /* Nonzero if we want to issue diagnostics that the standard says are not
1017    required.  */
1018 extern int flag_optional_diags;
1019
1020 /* Nonzero means do not consider empty argument prototype to mean function
1021    takes no arguments.  */
1022 extern int flag_strict_prototype;
1023
1024 /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc.  */
1025 extern int flag_vtable_gc;
1026
1027 /* Nonzero means make the default pedwarns warnings instead of errors.
1028    The value of this flag is ignored if -pedantic is specified.  */
1029 extern int flag_permissive;
1030
1031 /* Nonzero if we want to obey access control semantics.  */
1032
1033 extern int flag_access_control;
1034
1035 /* If this variable is defined to a non-NULL value, it will be called
1036    after the file has been completely parsed.  The argument will be
1037    the GLOBAL_NAMESPACE.  */
1038
1039 extern void (*back_end_hook) PROTO((tree));
1040
1041 \f
1042 /* C++ language-specific tree codes.  */
1043 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
1044 enum cplus_tree_code {
1045   __DUMMY = LAST_AND_UNUSED_TREE_CODE,
1046 #include "cp-tree.def"
1047   LAST_CPLUS_TREE_CODE
1048 };
1049 #undef DEFTREECODE
1050
1051 enum languages { lang_c, lang_cplusplus, lang_java };
1052
1053 /* Macros to make error reporting functions' lives easier.  */
1054 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
1055 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
1056 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
1057
1058 #define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME  (NODE))))
1059 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
1060
1061 /* The _DECL for this _TYPE.  */
1062 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
1063
1064 /* Nonzero if T is a class (or struct or union) type.  Also nonzero
1065    for template type parameters, typename types, and instantiated
1066    template template parameters.  Despite its name,
1067    this macro has nothing to do with the definition of aggregate given
1068    in the standard.  Think of this macro as MAYBE_CLASS_TYPE_P.  */
1069 #define IS_AGGR_TYPE(t)                         \
1070   (TREE_CODE (t) == TEMPLATE_TYPE_PARM          \
1071    || TREE_CODE (t) == TYPENAME_TYPE            \
1072    || TREE_CODE (t) == TYPEOF_TYPE              \
1073    || (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM  \
1074        && TYPE_TEMPLATE_INFO (t))               \
1075    || TYPE_LANG_FLAG_5 (t))
1076
1077 /* Set IS_AGGR_TYPE for T to VAL.  T must be a class, struct, or 
1078    union type.  */ 
1079 #define SET_IS_AGGR_TYPE(T, VAL) \
1080   (TYPE_LANG_FLAG_5 (T) = (VAL))
1081
1082 /* Nonzero if T is a class type.  Zero for template type parameters,
1083    typename types, and so forth.  */
1084 #define CLASS_TYPE_P(t) \
1085   (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t))
1086
1087 #define IS_AGGR_TYPE_CODE(t)    (t == RECORD_TYPE || t == UNION_TYPE)
1088 #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
1089   (TREE_CODE (TYPE1) == TREE_CODE (TYPE2)       \
1090    && IS_AGGR_TYPE (TYPE1) && IS_AGGR_TYPE (TYPE2))
1091 #define IS_OVERLOAD_TYPE(t) \
1092   (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
1093
1094 /* In a *_TYPE, nonzero means a built-in type.  */
1095 #define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
1096
1097 /* True if this a "Java" type, defined in 'extern "Java"'. */
1098 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
1099
1100 /* The type qualifiers for this type, including the qualifiers on the
1101    elements for an array type.  */
1102 #define CP_TYPE_QUALS(NODE)                     \
1103   ((TREE_CODE (NODE) != ARRAY_TYPE)             \
1104    ? TYPE_QUALS (NODE) : cp_type_quals (NODE))
1105
1106 /* Nonzero if this type is const-qualified.  */
1107 #define CP_TYPE_CONST_P(NODE)                           \
1108   ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0)
1109
1110 /* Nonzero if this type is volatile-qualified.  */
1111 #define CP_TYPE_VOLATILE_P(NODE)                        \
1112   ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0)
1113
1114 /* Nonzero if this type is restrict-qualified.  */
1115 #define CP_TYPE_RESTRICT_P(NODE)                        \
1116   ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0)
1117
1118 /* Nonzero if this type is const-qualified, but not
1119    volatile-qualified.  Other qualifiers are ignored.  This macro is
1120    used to test whether or not it is OK to bind an rvalue to a
1121    reference.  */
1122 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE)                              \
1123   ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE))      \
1124    == TYPE_QUAL_CONST)
1125
1126 #define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
1127   (!flag_vtable_thunks ? \
1128      TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
1129    : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
1130    : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
1131
1132 /* Virtual function addresses can be gotten from a virtual function
1133    table entry using this macro.  */
1134 #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
1135   (!flag_vtable_thunks ? \
1136      TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
1137    : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
1138    : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
1139 #define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
1140   (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
1141 #define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
1142 #define PROMOTES_TO_AGGR_TYPE(NODE,CODE)        \
1143   (((CODE) == TREE_CODE (NODE)                  \
1144        && IS_AGGR_TYPE (TREE_TYPE (NODE)))      \
1145    || IS_AGGR_TYPE (NODE))
1146
1147 /* Nonzero iff TYPE is uniquely derived from PARENT.  Under MI, PARENT can
1148    be an ambiguous base class of TYPE, and this macro will be false.  */
1149 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
1150 #define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
1151 #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
1152 #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
1153 \f
1154 /* This structure provides additional information above and beyond
1155    what is provide in the ordinary tree_type.  In the past, we used it
1156    for the types of class types, template parameters types, typename
1157    types, and so forth.  However, there can be many (tens to hundreds
1158    of thousands) of template parameter types in a compilation, and
1159    there's no need for this additional information in that case.
1160    Therefore, we now use this data structure only for class types.
1161
1162    In the past, it was thought that there would be relatively few
1163    class types.  However, in the presence of heavy use of templates,
1164    many (i.e., thousands) of classes can easily be generated.
1165    Therefore, we should endeavor to keep the size of this structure to
1166    a minimum.  */
1167 struct lang_type
1168 {
1169   unsigned char align;
1170
1171   unsigned has_type_conversion : 1;
1172   unsigned has_init_ref : 1;
1173   unsigned has_default_ctor : 1;
1174   unsigned uses_multiple_inheritance : 1;
1175   unsigned const_needs_init : 1;
1176   unsigned ref_needs_init : 1;
1177   unsigned has_const_assign_ref : 1;
1178   unsigned anon_aggr : 1;
1179
1180   unsigned has_nonpublic_ctor : 2;
1181   unsigned has_nonpublic_assign_ref : 2;
1182   unsigned vtable_needs_writing : 1;
1183   unsigned has_assign_ref : 1;
1184   unsigned gets_new : 2;
1185
1186   unsigned gets_delete : 2;
1187   unsigned has_call_overloaded : 1;
1188   unsigned has_array_ref_overloaded : 1;
1189   unsigned has_arrow_overloaded : 1;
1190   unsigned interface_only : 1;
1191   unsigned interface_unknown : 1;
1192   unsigned needs_virtual_reinit : 1;
1193
1194   unsigned marks: 6;
1195   unsigned vec_delete_takes_size : 1;
1196   unsigned declared_class : 1;
1197
1198   unsigned being_defined : 1;
1199   unsigned redefined : 1;
1200   unsigned debug_requested : 1;
1201   unsigned use_template : 2;
1202   unsigned got_semicolon : 1;
1203   unsigned ptrmemfunc_flag : 1;
1204   unsigned was_anonymous : 1;
1205
1206   unsigned has_real_assign_ref : 1;
1207   unsigned has_const_init_ref : 1;
1208   unsigned has_complex_init_ref : 1;
1209   unsigned has_complex_assign_ref : 1;
1210   unsigned has_abstract_assign_ref : 1;
1211   unsigned non_aggregate : 1;
1212   unsigned is_partial_instantiation : 1;
1213   unsigned has_mutable : 1;
1214
1215   unsigned com_interface : 1;
1216   unsigned non_pod_class : 1;
1217
1218   /* When adding a flag here, consider whether or not it ought to
1219      apply to a template instance if it applies to the template.  If
1220      so, make sure to copy it in instantiate_class_template!  */
1221
1222   /* There are six bits left to fill out a 32-bit word.  Keep track of
1223      this by updating the size of this bitfield whenever you add or
1224      remove a flag.  */
1225   unsigned dummy : 6;
1226       
1227   int vsize;
1228   int vfield_parent;
1229
1230   union tree_node *vfields;
1231   union tree_node *vbases;
1232
1233   union tree_node *tags;
1234
1235   union tree_node *search_slot;
1236
1237   union tree_node *size;
1238
1239   union tree_node *abstract_virtuals;
1240   union tree_node *friend_classes;
1241
1242   union tree_node *rtti;
1243
1244   union tree_node *methods;
1245
1246   union tree_node *template_info;
1247   tree befriending_classes;
1248 };
1249
1250 /* Indicates whether or not (and how) a template was expanded for this class.
1251      0=no information yet/non-template class
1252      1=implicit template instantiation
1253      2=explicit template specialization
1254      3=explicit template instantiation  */
1255 #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->use_template)
1256
1257 /* Fields used for storing information before the class is defined.
1258    After the class is defined, these fields hold other information.  */
1259
1260 /* List of friends which were defined inline in this class definition.  */
1261 #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
1262
1263 /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
1264    respectively.  */
1265 #define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->gets_new)
1266 #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->gets_delete)
1267 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
1268
1269 /* Nonzero for _CLASSTYPE means that operator vec delete is defined and
1270    takes the optional size_t argument.  */
1271 #define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
1272   (TYPE_LANG_SPECIFIC(NODE)->vec_delete_takes_size)
1273 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
1274   (TYPE_NEEDS_DESTRUCTOR (NODE) \
1275    || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
1276
1277 /* Nonzero means that this _CLASSTYPE node defines ways of converting
1278    itself to other types.  */
1279 #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_type_conversion)
1280
1281 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
1282 #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_assign_ref)
1283 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_const_assign_ref)
1284
1285 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor.  */
1286 #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_init_ref)
1287 #define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_const_init_ref)
1288
1289 /* Nonzero means that this type is being defined.  I.e., the left brace
1290    starting the definition of this type has been seen.  */
1291 #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->being_defined)
1292 /* Nonzero means that this type has been redefined.  In this case, if
1293    convenient, don't reprocess any methods that appear in its redefinition.  */
1294 #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->redefined)
1295
1296 /* The is the basetype that contains NODE's rtti.  */
1297 #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
1298
1299 /* Nonzero means that this _CLASSTYPE node overloads operator().  */
1300 #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_call_overloaded)
1301
1302 /* Nonzero means that this _CLASSTYPE node overloads operator[].  */
1303 #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_array_ref_overloaded)
1304
1305 /* Nonzero means that this _CLASSTYPE node overloads operator->.  */
1306 #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_arrow_overloaded)
1307
1308 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
1309    multiple inheritance.  If this is 0 for the root of a type
1310    hierarchy, then we can use more efficient search techniques.  */
1311 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->uses_multiple_inheritance)
1312
1313 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
1314    virtual base classes.  If this is 0 for the root of a type
1315    hierarchy, then we can use more efficient search techniques.  */
1316 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
1317
1318 /* Vector member functions defined in this class.  Each element is
1319    either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD.  All
1320    functions with the same name end up in the same slot.  The first
1321    two elements are for constructors, and destructors, respectively.
1322    These are followed by ordinary member functions.  There may be
1323    empty entries at the end of the vector.  */
1324 #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
1325
1326 /* The first type conversion operator in the class (the others can be
1327    searched with TREE_CHAIN), or the first non-constructor function if
1328    there are no type conversion operators.  */
1329 #define CLASSTYPE_FIRST_CONVERSION(NODE) \
1330   TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
1331     ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
1332     : NULL_TREE;
1333
1334 /* Mark bits for depth-first and breath-first searches.  */
1335
1336 /* Get the value of the Nth mark bit.  */
1337 #define CLASSTYPE_MARKED_N(NODE, N)                                     \
1338   (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->marks     \
1339      : TYPE_ALIAS_SET (NODE)) & (1 << N)) != 0)
1340
1341 /* Set the Nth mark bit.  */
1342 #define SET_CLASSTYPE_MARKED_N(NODE, N)                                 \
1343   (CLASS_TYPE_P (NODE)                                                  \
1344    ? (TYPE_LANG_SPECIFIC (NODE)->marks |= (1 << (N)))   \
1345    : (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
1346
1347 /* Clear the Nth mark bit.  */
1348 #define CLEAR_CLASSTYPE_MARKED_N(NODE, N)                               \
1349   (CLASS_TYPE_P (NODE)                                                  \
1350    ? (TYPE_LANG_SPECIFIC (NODE)->marks &= ~(1 << (N)))  \
1351    : (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
1352
1353 /* Get the value of the mark bits.  */
1354 #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0)
1355 #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1)
1356 #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2)
1357 #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3)
1358 #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4)
1359 #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5)
1360
1361 /* Macros to modify the above flags */
1362 #define SET_CLASSTYPE_MARKED(NODE)    SET_CLASSTYPE_MARKED_N(NODE, 0)
1363 #define CLEAR_CLASSTYPE_MARKED(NODE)  CLEAR_CLASSTYPE_MARKED_N(NODE, 0)
1364 #define SET_CLASSTYPE_MARKED2(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 1)
1365 #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1)
1366 #define SET_CLASSTYPE_MARKED3(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 2)
1367 #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2) 
1368 #define SET_CLASSTYPE_MARKED4(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 3)
1369 #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3)
1370 #define SET_CLASSTYPE_MARKED5(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 4)
1371 #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4)
1372 #define SET_CLASSTYPE_MARKED6(NODE)   SET_CLASSTYPE_MARKED_N(NODE, 5)
1373 #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5)
1374
1375 /* A list of the nested tag-types (class, struct, union, or enum)
1376    found within this class.  The TREE_PURPOSE of each node is the name
1377    of the type; the TREE_VALUE is the type itself.  This list includes
1378    nested member class templates.  */
1379 #define CLASSTYPE_TAGS(NODE)            (TYPE_LANG_SPECIFIC(NODE)->tags)
1380
1381 /* If this class has any bases, this is the number of the base class from
1382    which our VFIELD is based, -1 otherwise.  If this class has no base
1383    classes, this is not used.
1384    In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
1385    1, if D's vtable came from B2.  */
1386 #define CLASSTYPE_VFIELD_PARENT(NODE)   (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
1387
1388 /* The number of virtual functions defined for this
1389    _CLASSTYPE node.  */
1390 #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
1391 /* The virtual base classes that this type uses.  */
1392 #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
1393 /* The virtual function pointer fields that this type contains.  */
1394 #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
1395
1396 /* Number of baseclasses defined for this type.
1397    0 means no base classes.  */
1398 #define CLASSTYPE_N_BASECLASSES(NODE) \
1399   (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
1400
1401 /* Used for keeping search-specific information.  Any search routine
1402    which uses this must define what exactly this slot is used for.  */
1403 #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
1404
1405 /* These are the size, mode and alignment of the type without its
1406    virtual base classes, for when we use this type as a base itself.  */
1407 #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
1408 #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
1409
1410 /* A cons list of virtual functions which cannot be inherited by
1411    derived classes.  When deriving from this type, the derived
1412    class must provide its own definition for each of these functions.  */
1413 #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
1414
1415 /* Nonzero means that this aggr type has been `closed' by a semicolon.  */
1416 #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon)
1417
1418 /* Nonzero means that the main virtual function table pointer needs to be
1419    set because base constructors have placed the wrong value there.
1420    If this is zero, it means that they placed the right value there,
1421    and there is no need to change it.  */
1422 #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->needs_virtual_reinit)
1423
1424 /* Nonzero means that if this type has virtual functions, that
1425    the virtual function table will be written out.  */
1426 #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtable_needs_writing)
1427
1428 /* Nonzero means that this type has an X() constructor.  */
1429 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_default_ctor)
1430
1431 /* Nonzero means the type declared a ctor as private or protected.  We
1432    use this to make sure we don't try to generate a copy ctor for a 
1433    class that has a member of type NODE.  */
1434 #define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_nonpublic_ctor)
1435
1436 /* Ditto, for operator=.  */
1437 #define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_nonpublic_assign_ref)
1438
1439 /* Nonzero means that this type contains a mutable member */
1440 #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_mutable)
1441 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1442
1443 /*  Nonzero means that this class type is a non-POD class.  */
1444 #define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_pod_class)
1445
1446 /* Nonzero means that this type is meant for communication via COM.  */
1447 #define CLASSTYPE_COM_INTERFACE(NODE) \
1448   (TYPE_LANG_SPECIFIC(NODE)->com_interface)
1449
1450 /* A list of class types of which this type is a friend.  The
1451    TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1452    case of a template friend.  */
1453 #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
1454
1455 /* A list of the classes which grant friendship to this class.  */
1456 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1457   (TYPE_LANG_SPECIFIC (NODE)->befriending_classes)
1458
1459 /* Say whether this node was declared as a "class" or a "struct".  */
1460 #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->declared_class)
1461
1462 /* Nonzero if this class has const members which have no specified initialization.  */
1463 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->const_needs_init)
1464
1465 /* Nonzero if this class has ref members which have no specified initialization.  */
1466 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->ref_needs_init)
1467
1468 /* Nonzero if this class is included from a header file which employs
1469    `#pragma interface', and it is not included in its implementation file.  */
1470 #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_only)
1471
1472 /* Same as above, but for classes whose purpose we do not know.  */
1473 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown)
1474 #define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown == 0)
1475 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = !!(X))
1476 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = 1)
1477 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = 0)
1478
1479 /* Nonzero if a _DECL node requires us to output debug info for this class.  */
1480 #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->debug_requested)
1481 \f
1482 /* Additional macros for inheritance information.  */
1483
1484 /* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
1485    gcc/tree.h.  In particular if D is derived from B then the BINFO
1486    for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
1487    D.  In tree.h, this pointer is described as pointing in other
1488    direction.  There is a different BINFO for each path to a virtual
1489    base; BINFOs for virtual bases are not shared.  In addition, shared
1490    versions of each of the virtual class BINFOs are stored in
1491    CLASSTYPE_VBASECLASSES.
1492
1493    We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
1494    inheritance is indicated by the absence of the other two flags, not
1495    by TREE_VIA_PRIVATE, which is unused.
1496
1497    The TREE_CHAIN is for scratch space in search.c.  */
1498
1499 /* Nonzero means marked by DFS or BFS search, including searches
1500    by `get_binfo' and `get_base_distance'.  */
1501 #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
1502 /* Macros needed because of C compilers that don't allow conditional
1503    expressions to be lvalues.  Grr!  */
1504 #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
1505 #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
1506
1507 /* Nonzero means marked in search through virtual inheritance hierarchy.  */
1508 #define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1509 /* Modifier macros */
1510 #define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1511 #define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1512
1513 /* Nonzero means marked in search for members or member functions.  */
1514 #define BINFO_FIELDS_MARKED(NODE) \
1515   (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
1516 #define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
1517 #define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
1518
1519 /* Nonzero means that this class is on a path leading to a new vtable.  */
1520 #define BINFO_VTABLE_PATH_MARKED(NODE) \
1521   (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
1522 #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
1523 #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
1524
1525 /* Nonzero means that this class has a new vtable.  */
1526 #define BINFO_NEW_VTABLE_MARKED(NODE) \
1527   (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
1528 #define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
1529 #define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
1530
1531 /* Nonzero means this class has done dfs_pushdecls.  */
1532 #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
1533 #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
1534 #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
1535
1536 /* Used by various search routines.  */
1537 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1538 \f
1539 /* Accessor macros for the vfield slots in structures.  */
1540
1541 /* Get the assoc info that caused this vfield to exist.  */
1542 #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1543
1544 /* Get that same information as a _TYPE.  */
1545 #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1546
1547 /* Get the value of the top-most type dominating the non-`normal' vfields.  */
1548 #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
1549
1550 /* Get the value of the top-most type that's `normal' for the vfield.  */
1551 #define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
1552 \f
1553 /* Nonzero for TREE_LIST node means that this list of things
1554    is a list of parameters, as opposed to a list of expressions.  */
1555 #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
1556
1557 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1558    this type can raise.  Each TREE_VALUE is a _TYPE.  The TREE_VALUE
1559    will be NULL_TREE to indicate a throw specification of `()', or
1560    no exceptions allowed.  */
1561 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
1562
1563 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'.  */
1564 #define TYPE_NOTHROW_P(NODE) \
1565   (TYPE_RAISES_EXCEPTIONS (NODE) \
1566    && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
1567
1568 /* The binding level associated with the namespace.  */
1569 #define NAMESPACE_LEVEL(NODE) \
1570   (DECL_LANG_SPECIFIC(NODE)->decl_flags.u.level)
1571 \f
1572
1573 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
1574    a lang_decl (which has lang_decl_flags as its initial prefix).
1575    This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
1576    the full lang_decl, and not just lang_decl_flags.  */
1577 #define CAN_HAVE_FULL_LANG_DECL_P(NODE)         \
1578   (!(TREE_CODE ((NODE)) == VAR_DECL             \
1579      || TREE_CODE ((NODE)) == CONST_DECL        \
1580      || TREE_CODE ((NODE)) == FIELD_DECL        \
1581      || TREE_CODE ((NODE)) == USING_DECL))
1582
1583 struct lang_decl_flags
1584 {
1585 #ifdef ONLY_INT_FIELDS
1586   int language : 8;
1587 #else
1588   enum languages language : 8;
1589 #endif
1590
1591   unsigned operator_attr : 1;
1592   unsigned constructor_attr : 1;
1593   unsigned friend_attr : 1;
1594   unsigned static_function : 1;
1595   unsigned const_memfunc : 1;
1596   unsigned volatile_memfunc : 1;
1597   unsigned abstract_virtual : 1;
1598   unsigned constructor_for_vbase_attr : 1;
1599
1600   unsigned mutable_flag : 1;
1601   unsigned saved_inline : 1;
1602   unsigned use_template : 2;
1603   unsigned nonconverting : 1;
1604   unsigned declared_inline : 1;
1605   unsigned not_really_extern : 1;
1606   unsigned needs_final_overrider : 1;
1607
1608   unsigned bitfield : 1;
1609   unsigned defined_in_class : 1;
1610   unsigned pending_inline_p : 1;
1611   unsigned global_ctor_p : 1;
1612   unsigned global_dtor_p : 1;
1613   unsigned pretty_function_p : 1;
1614   unsigned dummy : 2;
1615
1616   tree context;
1617
1618   union {
1619     /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
1620        is DECL_TEMPLATE_INFO.  */
1621     tree template_info;
1622
1623     /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL.  */
1624     struct binding_level *level;
1625   } u;
1626
1627   union {
1628     /* This is DECL_ACCESS.  */
1629     tree access;
1630
1631     /* In a namespace-scope FUNCTION_DECL, this is
1632        GLOBAL_INIT_PRIORITY.  */
1633     int init_priority;
1634   } u2;
1635 };
1636
1637 struct lang_decl
1638 {
1639   struct lang_decl_flags decl_flags;
1640
1641   tree main_decl_variant;
1642   tree befriending_classes;
1643
1644   /* In a FUNCTION_DECL, this is DECL_SAVED_TREE.  */
1645   tree saved_tree;
1646
1647   union
1648   {
1649     tree sorted_fields;
1650     struct pending_inline *pending_inline_info;
1651     struct language_function *saved_language_function;
1652   } u;
1653 };
1654
1655 /* Non-zero if NODE is a _DECL with TREE_READONLY set.  */
1656 #define TREE_READONLY_DECL_P(NODE) \
1657   (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
1658
1659 /* Non-zero iff DECL is memory-based.  The DECL_RTL of
1660    certain const variables might be a CONST_INT, or a REG
1661    in some cases.  We cannot use `memory_operand' as a test
1662    here because on most RISC machines, a variable's address
1663    is not, by itself, a legitimate address.  */
1664 #define DECL_IN_MEMORY_P(NODE) \
1665   (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
1666
1667 /* For FUNCTION_DECLs: return the language in which this decl
1668    was declared.  */
1669 #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
1670
1671 /* For FUNCTION_DECLs: nonzero means that this function is a constructor.  */
1672 #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
1673
1674 /* There ought to be a better way to find out whether or not something is
1675    a destructor.  */
1676 #define DECL_DESTRUCTOR_P(NODE)                         \
1677   (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (NODE))       \
1678    && DECL_LANGUAGE (NODE) == lang_cplusplus)
1679
1680 /* Non-zero if NODE is a user-defined conversion operator.  */
1681 #define DECL_CONV_FN_P(NODE)                                                 \
1682   (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)) && TREE_TYPE (DECL_NAME (NODE)))
1683
1684 /* Non-zero if NODE is an overloaded operator.  */
1685 #define DECL_OVERLOADED_OPERATOR_P(NODE)        \
1686   (IDENTIFIER_OPNAME_P (DECL_NAME ((NODE))))
1687
1688 /* For FUNCTION_DECLs: nonzero means that this function is a constructor
1689    for an object with virtual baseclasses.  */
1690 #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
1691
1692 /* Non-zero for a FUNCTION_DECL that declares a type-info function.  */
1693 #define DECL_TINFO_FN_P(NODE)                                   \
1694   (TREE_CODE (NODE) == FUNCTION_DECL                            \
1695    && DECL_ARTIFICIAL (NODE)                                    \
1696    && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1697
1698 /* Mark NODE as a type-info function.  */
1699 #define SET_DECL_TINFO_FN_P(NODE) \
1700   (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1)
1701
1702 /* Nonzero for _DECL means that this decl appears in (or will appear
1703    in) as a member in a RECORD_TYPE or UNION_TYPE node.  It is also for
1704    detecting circularity in case members are multiply defined.  In the
1705    case of a VAR_DECL, it is also used to determine how program storage
1706    should be allocated.  */
1707 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
1708
1709 /* Nonzero if the DECL was defined in the class definition itself,
1710    rather than outside the class.  */
1711 #define DECL_DEFINED_IN_CLASS_P(DECL) \
1712  (DECL_LANG_SPECIFIC (DECL)->decl_flags.defined_in_class)
1713
1714 /* Nonzero for FUNCTION_DECL means that this decl is just a
1715    friend declaration, and should not be added to the list of
1716    member functions for this class.  */
1717 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
1718
1719 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL.  */
1720 #define DECL_BEFRIENDING_CLASSES(NODE) \
1721   (DECL_LANG_SPECIFIC(NODE)->befriending_classes)
1722
1723 /* Nonzero for FUNCTION_DECL means that this decl is a static
1724    member function.  */
1725 #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
1726
1727 /* Nonzero for a class member means that it is shared between all objects
1728    of that class.  */
1729 #define SHARED_MEMBER_P(NODE) \
1730   (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
1731    || TREE_CODE (NODE) == CONST_DECL)
1732                                 
1733 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
1734    member function.  */
1735 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
1736   (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
1737
1738 /* Nonzero for FUNCTION_DECL means that this decl is a member function
1739    (static or non-static).  */
1740 #define DECL_FUNCTION_MEMBER_P(NODE) \
1741  (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
1742
1743 /* Nonzero for FUNCTION_DECL means that this member function
1744    has `this' as const X *const.  */
1745 #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
1746
1747 /* Nonzero for FUNCTION_DECL means that this member function
1748    has `this' as volatile X *const.  */
1749 #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
1750
1751 /* Nonzero for a DECL means that this member is a non-static member.  */
1752 #define DECL_NONSTATIC_MEMBER_P(NODE)           \
1753   ((TREE_CODE (NODE) == FUNCTION_DECL           \
1754     && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
1755    || TREE_CODE (NODE) == FIELD_DECL)
1756
1757 /* Nonzero for _DECL means that this member object type
1758    is mutable.  */
1759 #define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1760
1761 /* Nonzero for _DECL means that this constructor is a non-converting
1762    constructor.  */
1763 #define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
1764
1765 /* Nonzero for FUNCTION_DECL means that this member function
1766    exists as part of an abstract class's interface.  */
1767 #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
1768
1769 /* Nonzero for FUNCTION_DECL means that this member function
1770    must be overridden by derived classes.  */
1771 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
1772
1773 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
1774    template function.  */
1775 #define DECL_PRETTY_FUNCTION_P(NODE) \
1776   (DECL_LANG_SPECIFIC(NODE)->decl_flags.pretty_function_p)
1777
1778 /* The _TYPE context in which this _DECL appears.  This field holds the
1779    class where a virtual function instance is actually defined, and the
1780    lexical scope of a friend function defined in a class body. */
1781 #define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
1782 #define DECL_REAL_CONTEXT(NODE) \
1783   ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
1784    ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE))
1785
1786 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
1787 #define CP_DECL_CONTEXT(NODE) \
1788   (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
1789 #define FROB_CONTEXT(NODE)   ((NODE) == global_namespace ? NULL_TREE : (NODE))
1790
1791 /* For a virtual function, the base where we find its vtable entry.
1792    For a non-virtual function, the base where it is defined.  */
1793 #define DECL_VIRTUAL_CONTEXT(NODE) DECL_CONTEXT (NODE)
1794
1795 /* 1 iff NODE has namespace scope, including the global namespace.  */
1796 #define DECL_NAMESPACE_SCOPE_P(NODE)                            \
1797   (!DECL_TEMPLATE_PARM_P (NODE)                                 \
1798    && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
1799
1800 /* 1 iff NODE is a class member.  */
1801 #define DECL_CLASS_SCOPE_P(NODE) \
1802   (DECL_CONTEXT (NODE) \
1803    && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
1804
1805 /* 1 iff NODE is function-local.  */
1806 #define DECL_FUNCTION_SCOPE_P(NODE) \
1807   (DECL_CONTEXT (NODE) \
1808    && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
1809      
1810 /* For a NAMESPACE_DECL: the list of using namespace directives
1811    The PURPOSE is the used namespace, the value is the namespace
1812    that is the common ancestor. */
1813 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
1814
1815 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
1816    of a namespace, to record the transitive closure of using namespace. */
1817 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
1818
1819 /* In a NAMESPACE_DECL, points to the original namespace if this is
1820    a namespace alias.  */
1821 #define DECL_NAMESPACE_ALIAS(NODE) \
1822         DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
1823 #define ORIGINAL_NAMESPACE(NODE)  \
1824   (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
1825
1826 /* In a non-local VAR_DECL with static storage duration, this is the
1827    initialization priority.  If this value is zero, the NODE will be
1828    initialized at the DEFAULT_INIT_PRIORITY.  */
1829 #define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE (VAR_DECL_CHECK (NODE)))
1830
1831 /* In a TREE_LIST concatenating using directives, indicate indirekt
1832    directives  */
1833 #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
1834
1835 /* In a VAR_DECL for a variable declared in a for statement,
1836    this is the shadowed (local) variable.  */
1837 #define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(VAR_DECL_CHECK (NODE))
1838
1839 /* Points back to the decl which caused this lang_decl to be allocated.  */
1840 #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
1841
1842 /* In a FUNCTION_DECL, this is nonzero if this function was defined in
1843    the class definition.  We have saved away the text of the function,
1844    but have not yet processed it.  */
1845 #define DECL_PENDING_INLINE_P(NODE) \
1846   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->decl_flags.pending_inline_p)
1847    
1848 /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
1849    function.  */
1850 #define DECL_PENDING_INLINE_INFO(NODE) \
1851   (DECL_LANG_SPECIFIC(NODE)->u.pending_inline_info)
1852
1853 /* For a TYPE_DECL: if this function has many fields, we'll sort them
1854    and put them into a TREE_VEC. */
1855 #define DECL_SORTED_FIELDS(NODE) \
1856         (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields)
1857
1858 /* True if on the saved_inlines (see decl2.c) list.  */
1859 #define DECL_SAVED_INLINE(DECL) \
1860   (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
1861
1862 /* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL:
1863    template-specific information.  */
1864 #define DECL_TEMPLATE_INFO(NODE) \
1865   (DECL_LANG_SPECIFIC(VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE))->decl_flags.u.template_info)
1866
1867 /* Template information for a RECORD_TYPE or UNION_TYPE.  */
1868 #define CLASSTYPE_TEMPLATE_INFO(NODE) \
1869   (TYPE_LANG_SPECIFIC(RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
1870
1871 /* Template information for an ENUMERAL_TYPE.  Although an enumeration may
1872    not be a primary template, it may be declared within the scope of a
1873    primary template and the enumeration constants may depend on
1874    non-type template parameters.  */
1875 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
1876
1877 /* Template information for a template template parameter.  */
1878 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1879
1880 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
1881 #define TYPE_TEMPLATE_INFO(NODE)                        \
1882   (TREE_CODE (NODE) == ENUMERAL_TYPE                    \
1883    ? ENUM_TEMPLATE_INFO (NODE) :                        \
1884    (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM          \
1885     ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE)       \
1886     : CLASSTYPE_TEMPLATE_INFO (NODE)))
1887
1888 /* Set the template information for an ENUMERAL_, RECORD_, or
1889    UNION_TYPE to VAL.  */
1890 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL)       \
1891   (TREE_CODE (NODE) == ENUMERAL_TYPE            \
1892    ? (ENUM_TEMPLATE_INFO (NODE) = VAL)          \
1893    : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
1894
1895 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
1896 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
1897 #define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE))
1898 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
1899
1900 /* We use TREE_VECs to hold template arguments.  If there is only one
1901    level of template arguments, then the TREE_VEC contains the
1902    arguments directly.  If there is more than one level of template
1903    arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
1904    containing the template arguments for a single level.  The first
1905    entry in the outer TREE_VEC is the outermost level of template
1906    parameters; the last is the innermost.  
1907
1908    It is incorrect to ever form a template argument vector containing
1909    only one level of arguments, but which is a TREE_VEC containing as
1910    its only entry the TREE_VEC for that level.  */
1911
1912 /* Non-zero if the template arguments is actually a vector of vectors,
1913    rather than just a vector.  */
1914 #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
1915   (NODE != NULL_TREE                                            \
1916    && TREE_CODE (NODE) == TREE_VEC                              \
1917    && TREE_VEC_LENGTH (NODE) > 0                                \
1918    && TREE_VEC_ELT (NODE, 0) != NULL_TREE                       \
1919    && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
1920
1921 /* The depth of a template argument vector.  When called directly by
1922    the parser, we use a TREE_LIST rather than a TREE_VEC to represent
1923    template arguments.  In fact, we may even see NULL_TREE if there
1924    are no template arguments.  In both of those cases, there is only
1925    one level of template arguments.  */
1926 #define TMPL_ARGS_DEPTH(NODE)                                   \
1927   (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
1928
1929 /* The LEVELth level of the template ARGS.  Note that template
1930    parameter levels are indexed from 1, not from 0.  */
1931 #define TMPL_ARGS_LEVEL(ARGS, LEVEL)            \
1932   (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS)        \
1933    ? TREE_VEC_ELT ((ARGS), (LEVEL) - 1) : ARGS)
1934
1935 /* Set the LEVELth level of the template ARGS to VAL.  This macro does
1936    not work with single-level argument vectors.  */
1937 #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL)   \
1938   (TREE_VEC_ELT ((ARGS), (LEVEL) - 1) = (VAL))
1939
1940 /* Accesses the IDXth parameter in the LEVELth level of the ARGS.  */
1941 #define TMPL_ARG(ARGS, LEVEL, IDX)                              \
1942   (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
1943
1944 /* Set the IDXth element in the LEVELth level of ARGS to VAL.  This
1945    macro does not work with single-level argument vectors.  */
1946 #define SET_TMPL_ARG(ARGS, LEVEL, IDX, VAL)                     \
1947   (TREE_VEC_ELT (TREE_VEC_ELT ((ARGS), (LEVEL) - 1), (IDX)) = (VAL))
1948
1949 /* Given a single level of template arguments in NODE, return the
1950    number of arguments.  */
1951 #define NUM_TMPL_ARGS(NODE)                             \
1952   ((NODE) == NULL_TREE ? 0                              \
1953    : (TREE_CODE (NODE) == TREE_VEC                      \
1954       ? TREE_VEC_LENGTH (NODE) : list_length (NODE)))
1955
1956 /* The number of levels of template parameters given by NODE.  */
1957 #define TMPL_PARMS_DEPTH(NODE) \
1958   (TREE_INT_CST_HIGH (TREE_PURPOSE (NODE)))
1959
1960 /* The TEMPLATE_DECL instantiated or specialized by NODE.  This
1961    TEMPLATE_DECL will be the immediate parent, not the most general
1962    template.  For example, in:
1963
1964       template <class T> struct S { template <class U> void f(U); }
1965
1966    the FUNCTION_DECL for S<int>::f<double> will have, as its
1967    DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'. 
1968
1969    As a special case, for a member friend template of a template
1970    class, this value will not be a TEMPLATE_DECL, but rather a
1971    LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
1972    and any explicit template arguments provided.  For example, in:
1973
1974      template <class T> struct S { friend void f<int>(int, double); }
1975
1976    the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
1977    DECL_TI_ARGS will be {int}.  */ 
1978 #define DECL_TI_TEMPLATE(NODE)      TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
1979
1980 /* The template arguments used to obtain this decl from the most
1981    general form of DECL_TI_TEMPLATE.  For the example given for
1982    DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}.  These
1983    are always the full set of arguments required to instantiate this
1984    declaration from the most general template specialized here.  */
1985 #define DECL_TI_ARGS(NODE)          TI_ARGS (DECL_TEMPLATE_INFO (NODE))
1986 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
1987 #define CLASSTYPE_TI_ARGS(NODE)     TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
1988 #define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE))
1989 #define ENUM_TI_TEMPLATE(NODE)                  \
1990   TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
1991 #define ENUM_TI_ARGS(NODE)                      \
1992   TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
1993
1994 /* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
1995 #define TYPE_TI_TEMPLATE(NODE)                  \
1996   (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
1997
1998 /* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
1999 #define TYPE_TI_ARGS(NODE)                      \
2000   (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
2001
2002 #define INNERMOST_TEMPLATE_PARMS(NODE)  TREE_VALUE(NODE)
2003
2004 /* Nonzero if the NODE corresponds to the template parameters for a
2005    member template, whose inline definition is being processed after
2006    the class definition is complete.  */
2007 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
2008
2009 /* In a FUNCTION_DECL, the saved representation of the body of the
2010    entire function.  Usually a COMPOUND_STMT, but this may also be a
2011    RETURN_INIT, CTOR_INITIALIZER, or TRY_BLOCK.  */
2012 #define DECL_SAVED_TREE(NODE) \
2013   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->saved_tree)
2014
2015 /* In a FUNCTION_DECL, the saved language-specific per-function data.  */
2016 #define DECL_SAVED_FUNCTION_DATA(NODE) \
2017   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.saved_language_function)
2018
2019 #define COMPOUND_STMT_NO_SCOPE(NODE)    TREE_LANG_FLAG_0 (NODE)
2020 #define NEW_EXPR_USE_GLOBAL(NODE)       TREE_LANG_FLAG_0 (NODE)
2021 #define DELETE_EXPR_USE_GLOBAL(NODE)    TREE_LANG_FLAG_0 (NODE)
2022 #define DELETE_EXPR_USE_VEC(NODE)       TREE_LANG_FLAG_1 (NODE)
2023 #define LOOKUP_EXPR_GLOBAL(NODE)        TREE_LANG_FLAG_0 (NODE)
2024
2025 /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
2026    constructor call, rather than an ordinary function call.  */
2027 #define AGGR_INIT_VIA_CTOR_P(NODE) \
2028   TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
2029
2030 /* Nonzero if this statement should be considered a full-expression.  */
2031 #define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
2032
2033 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
2034    TEMPLATE_DECL.  This macro determines whether or not a given class
2035    type is really a template type, as opposed to an instantiation or
2036    specialization of one.  */
2037 #define CLASSTYPE_IS_TEMPLATE(NODE)  \
2038   (CLASSTYPE_TEMPLATE_INFO (NODE)    \
2039    && !CLASSTYPE_USE_TEMPLATE (NODE) \
2040    && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
2041
2042 /* The name used by the user to name the typename type.  Typically,
2043    this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
2044    corresponding TYPE_DECL.  However, this may also be a
2045    TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'.  */
2046 #define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE)
2047
2048 /* Nonzero if NODE is an implicit typename.  */
2049 #define IMPLICIT_TYPENAME_P(NODE) \
2050   (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
2051
2052 /* Nonzero if NODE is a TYPE_DECL that should not be visible because
2053    it is from a dependent base class.  */
2054 #define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE)     \
2055   (TREE_CODE (NODE) == TYPE_DECL                \
2056    && DECL_ARTIFICIAL (NODE)                    \
2057    && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
2058
2059 /* Nonzero in INTEGER_CST means that this int is negative by dint of
2060    using a twos-complement negated operand.  */
2061 #define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
2062
2063 #if 0                           /* UNUSED */
2064 /* Nonzero in any kind of _EXPR or _REF node means that it is a call
2065    to a storage allocation routine.  If, later, alternate storage
2066    is found to hold the object, this call can be ignored.  */
2067 #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
2068 #endif
2069
2070 /* Nonzero in any kind of _TYPE that uses multiple inheritance
2071    or virtual baseclasses.  */
2072 #define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
2073
2074 #if 0                           /* UNUSED */
2075 /* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
2076    gave; it's a DECL_NESTED_TYPENAME.  Someone may want to set this on
2077    mangled function names, too, but it isn't currently.  */
2078 #define TREE_MANGLED(NODE) (FOO)
2079 #endif
2080
2081 #if 0                           /* UNUSED */
2082 /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
2083    should be looked up in a non-standard way.  */
2084 #define DECL_OVERLOADED(NODE) (FOO)
2085 #endif
2086
2087 /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
2088    For a FUNCTION_DECL, this is when the function is a virtual function.
2089    For a VAR_DECL, this is when the variable is a virtual function table.
2090    For a FIELD_DECL, when the field is the field for the virtual function table.
2091    For an IDENTIFIER_NODE, nonzero if any function with this name
2092    has been declared virtual.
2093
2094    For a _TYPE if it uses virtual functions (or is derived from
2095    one that does).  */
2096 #define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
2097
2098 extern int flag_new_for_scope;
2099
2100 /* This flag is true of a local VAR_DECL if it was declared in a for
2101    statement, but we are no longer in the scope of the for.  */
2102 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
2103
2104 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
2105    if we already emitted a warning about using it.  */
2106 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
2107
2108 /* Nonzero if NODE is a FUNCTION_DECL (for a function with global
2109    scope) declared in a local scope.  */
2110 #define DECL_LOCAL_FUNCTION_P(NODE) \
2111   DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
2112
2113 /* This _DECL represents a compiler-generated entity.  */
2114 #define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
2115
2116 /* Record whether a typedef for type `int' was actually `signed int'.  */
2117 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
2118
2119 /* In a FIELD_DECL, nonzero if the decl was originally a bitfield.  */
2120 #define DECL_C_BIT_FIELD(NODE) \
2121   (DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))\
2122    && DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield)
2123 #define SET_DECL_C_BIT_FIELD(NODE) \
2124   (DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))->decl_flags.bitfield = 1)
2125
2126 /* In a FUNCTION_DECL, nonzero if the function cannot be inlined.  */
2127 #define DECL_UNINLINABLE(NODE) \
2128   (DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield)
2129
2130 #define INTEGRAL_CODE_P(CODE) \
2131   (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
2132
2133 /* [basic.fundamental]
2134
2135    Types  bool, char, wchar_t, and the signed and unsigned integer types
2136    are collectively called integral types.  
2137
2138    Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
2139    types as well, which is incorrect in C++.  */
2140 #define CP_INTEGRAL_TYPE_P(TYPE)                \
2141   (TREE_CODE ((TYPE)) == BOOLEAN_TYPE           \
2142    || TREE_CODE ((TYPE)) == INTEGER_TYPE)
2143
2144 /* [basic.fundamental]
2145
2146    Integral and floating types are collectively called arithmetic
2147    types.  */
2148 #define ARITHMETIC_TYPE_P(TYPE) \
2149   (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
2150
2151 /* Mark which labels are explicitly declared.
2152    These may be shadowed, and may be referenced from nested functions.  */
2153 #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
2154
2155 /* Nonzero for _TYPE means that the _TYPE defines
2156    at least one constructor.  */
2157 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
2158
2159 /* When appearing in an INDIRECT_REF, it means that the tree structure
2160    underneath is actually a call to a constructor.  This is needed
2161    when the constructor must initialize local storage (which can
2162    be automatically destroyed), rather than allowing it to allocate
2163    space from the heap.
2164
2165    When appearing in a SAVE_EXPR, it means that underneath
2166    is a call to a constructor.
2167
2168    When appearing in a CONSTRUCTOR, it means that it was
2169    a GNU C constructor expression.
2170
2171    When appearing in a FIELD_DECL, it means that this field
2172    has been duly initialized in its constructor.  */
2173 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
2174
2175 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR         \
2176                                    && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
2177                                    && ! TREE_HAS_CONSTRUCTOR (NODE))
2178
2179 #if 0
2180 /* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
2181    Used to generate more helpful error message in case somebody
2182    tries to take its address.  */
2183 #define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
2184 #endif
2185
2186 /* Nonzero for _TYPE means that the _TYPE defines a destructor.  */
2187 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
2188
2189 /* Nonzero means that an object of this type can not be initialized using
2190    an initializer list.  */
2191 #define CLASSTYPE_NON_AGGREGATE(NODE) \
2192   (TYPE_LANG_SPECIFIC (NODE)->non_aggregate)
2193 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
2194   (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
2195
2196 /* Nonzero if there is a user-defined X::op=(x&) for this class.  */
2197 #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_real_assign_ref)
2198 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_assign_ref)
2199 #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_abstract_assign_ref)
2200 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_init_ref)
2201
2202 /* Nonzero for _TYPE node means that destroying an object of this type
2203    will involve a call to a destructor.  This can apply to objects
2204    of ARRAY_TYPE is the type of the elements needs a destructor.  */
2205 #define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
2206
2207 /* Nonzero for class type means that initialization of this type can use
2208    a bitwise copy.  */
2209 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
2210   (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
2211
2212 /* Nonzero for class type means that assignment of this type can use
2213    a bitwise copy.  */
2214 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
2215   (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
2216
2217 #define TYPE_PTRMEM_P(NODE)                                     \
2218   (TREE_CODE (NODE) == POINTER_TYPE                             \
2219    && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
2220 #define TYPE_PTR_P(NODE)                                \
2221   (TREE_CODE (NODE) == POINTER_TYPE                     \
2222    && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
2223 #define TYPE_PTROB_P(NODE)                                              \
2224   (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE   \
2225    && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
2226 #define TYPE_PTROBV_P(NODE)                                             \
2227   (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
2228 #define TYPE_PTRFN_P(NODE)                              \
2229   (TREE_CODE (NODE) == POINTER_TYPE                     \
2230    && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2231
2232 /* Nonzero for _TYPE node means that this type is a pointer to member
2233    function type.  */
2234 #define TYPE_PTRMEMFUNC_P(NODE)         \
2235   (TREE_CODE(NODE) == RECORD_TYPE       \
2236    && TYPE_LANG_SPECIFIC(NODE)          \
2237    && TYPE_PTRMEMFUNC_FLAG (NODE))
2238
2239 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
2240   (TYPE_LANG_SPECIFIC(NODE)->ptrmemfunc_flag)
2241
2242 /* A pointer-to-function member type looks like:
2243
2244    struct {
2245      short __delta;
2246      short __index;
2247      union {
2248        P __pfn;
2249        short __delta2;
2250      } __pfn_or_delta2;
2251    };
2252
2253    where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
2254    pointer to member.  The fields are used as follows:
2255
2256      If __INDEX is -1, then the function to call is non-virtual, and
2257      is located at the address given by __PFN.
2258
2259      If __INDEX is zero, then this a NULL pointer-to-member.
2260
2261      Otherwise, the function to call is virtual.  Then, __DELTA2 gives
2262      the offset from an instance of the object to the virtual function
2263      table, and __INDEX - 1 is the index into the vtable to use to
2264      find the function.
2265
2266      The value to use for the THIS parameter is the address of the
2267      object plus __DELTA.
2268
2269    For example, given:
2270
2271      struct B1 {
2272        int i;
2273      };
2274
2275      struct B2 {
2276        double d;
2277        void f();
2278      };
2279
2280      struct S : public B1, B2 {};
2281
2282    the pointer-to-member for `&S::f' looks like:
2283
2284      { 4, -1, { &f__2B2 } };
2285
2286    The `4' means that given an `S*' you have to add 4 bytes to get to
2287    the address of the `B2*'.  Then, the -1 indicates that this is a
2288    non-virtual function.  Of course, `&f__2B2' is the name of that
2289    function.
2290
2291    (Of course, the exact values may differ depending on the mangling
2292    scheme, sizes of types, and such.).  */
2293      
2294 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
2295    pointer to member function.  TYPE_PTRMEMFUNC_P _must_ be true,
2296    before using this macro.  */
2297 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
2298
2299 /* Returns `A' for a type like `int (A::*)(double)' */
2300 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
2301   TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
2302
2303 /* These are use to manipulate the canonical RECORD_TYPE from the
2304    hashed POINTER_TYPE, and can only be used on the POINTER_TYPE.  */
2305 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
2306 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
2307 /* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P.  */
2308 #define DELTA2_FROM_PTRMEMFUNC(NODE) delta2_from_ptrmemfunc ((NODE))
2309 #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
2310
2311 /* For a pointer-to-member type of the form `T X::*', this is `X'.  */
2312 #define TYPE_PTRMEM_CLASS_TYPE(NODE)                    \
2313   (TYPE_PTRMEM_P ((NODE))                               \
2314    ? TYPE_OFFSET_BASETYPE (TREE_TYPE ((NODE)))          \
2315    : TYPE_PTRMEMFUNC_OBJECT_TYPE ((NODE)))
2316
2317 /* For a pointer-to-member type of the form `T X::*', this is `T'.  */
2318 #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE)               \
2319    (TYPE_PTRMEM_P ((NODE))                              \
2320     ? TREE_TYPE (TREE_TYPE (NODE))                      \
2321     : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE ((NODE))))
2322
2323 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
2324    `X'.  */
2325 #define PTRMEM_CST_CLASS(NODE) \
2326   TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
2327
2328 /* For a pointer-to-member constant `X::Y' this is the _DECL for 
2329    `Y'.  */
2330 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
2331
2332 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
2333    specified in its declaration.  */
2334 #define DECL_THIS_EXTERN(NODE) \
2335   DECL_LANG_FLAG_2 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
2336
2337 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
2338    specified in its declaration.  */
2339 #define DECL_THIS_STATIC(NODE) \
2340   DECL_LANG_FLAG_6 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
2341
2342 /* Nonzero in FUNCTION_DECL means it is really an operator.
2343    Just used to communicate formatting information to dbxout.c.  */
2344 #define DECL_OPERATOR(NODE) \
2345   (DECL_LANG_SPECIFIC(FUNCTION_DECL_CHECK (NODE))->decl_flags.operator_attr)
2346
2347 /* Nonzero if TYPE is an anonymous union or struct type.  We have to use a
2348    flag for this because "A union for which objects or pointers are
2349    declared is not an anonymous union" [class.union].  */
2350 #define ANON_AGGR_TYPE_P(NODE)                          \
2351   (CLASS_TYPE_P (NODE) && TYPE_LANG_SPECIFIC (NODE)->anon_aggr)
2352 #define SET_ANON_AGGR_TYPE_P(NODE)                      \
2353   (TYPE_LANG_SPECIFIC (NODE)->anon_aggr = 1)
2354
2355 /* Nonzero if TYPE is an anonymous union type.  */
2356 #define ANON_UNION_TYPE_P(NODE) \
2357   (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
2358
2359 /* For a VAR_DECL that is an anonymous union, these are the various
2360    sub-variables that make up the anonymous union.  */
2361 #define DECL_ANON_UNION_ELEMS(NODE) DECL_ARGUMENTS ((NODE))
2362
2363 #define UNKNOWN_TYPE LANG_TYPE
2364
2365 /* Define fields and accessors for nodes representing declared names.  */
2366
2367 #if 0
2368 /* C++: A derived class may be able to directly use the virtual
2369    function table of a base class.  When it does so, it may
2370    still have a decl node used to access the virtual function
2371    table (so that variables of this type can initialize their
2372    virtual function table pointers by name).  When such thievery
2373    is committed, know exactly which base class's virtual function
2374    table is the one being stolen.  This effectively computes the
2375    transitive closure.  */
2376 #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
2377 #endif
2378
2379 #define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->was_anonymous)
2380
2381 /* C++: all of these are overloaded!  These apply only to TYPE_DECLs.  */
2382
2383 /* The format of each node in the DECL_FRIENDLIST is as follows:
2384
2385    The TREE_PURPOSE will be the name of a function, i.e., an
2386    IDENTIFIER_NODE.  The TREE_VALUE will be itself a TREE_LIST, the
2387    list of functions with that name which are friends.  The
2388    TREE_PURPOSE of each node in this sublist will be error_mark_node,
2389    if the function was declared a friend individually, in which case
2390    the TREE_VALUE will be the function_decl.  If, however, all
2391    functions with a given name in a class were declared to be friends,
2392    the TREE_PUROSE will be the class type, and the TREE_VALUE will be
2393    NULL_TREE.  */
2394 #define DECL_FRIENDLIST(NODE)           (DECL_INITIAL (NODE))
2395 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
2396 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
2397
2398 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST.  The TREE_PURPOSE of
2399    each node is a type; the TREE_VALUE is the access granted for this
2400    DECL in that type.  The DECL_ACCESS is set by access declarations.
2401    For example, if a member that would normally be public in a
2402    derived class is made protected, then the derived class and the
2403    protected_access_node will appear in the DECL_ACCESS for the node.  */
2404 #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.u2.access)
2405
2406 /* Nonzero if the FUNCTION_DECL is a global constructor.  */
2407 #define DECL_GLOBAL_CTOR_P(NODE) \
2408   (DECL_LANG_SPECIFIC ((NODE))->decl_flags.global_ctor_p)
2409
2410 /* Nonzero if the FUNCTION_DECL is a global destructor.  */
2411 #define DECL_GLOBAL_DTOR_P(NODE) \
2412   (DECL_LANG_SPECIFIC ((NODE))->decl_flags.global_dtor_p)
2413
2414 /* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro
2415    returns the initialization priority for the function.  Constructors
2416    with lower numbers should be run first.  Destructors should be run
2417    in the reverse order of constructors.  */
2418 #define GLOBAL_INIT_PRIORITY(NODE) \
2419   (DECL_LANG_SPECIFIC ((NODE))->decl_flags.u2.init_priority)
2420
2421 /* Accessor macros for C++ template decl nodes.  */
2422
2423 /* The DECL_TEMPLATE_PARMS are a list.  The TREE_PURPOSE of each node
2424    is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
2425    template parameters, with 1 being the outermost set of template
2426    parameters.  The TREE_VALUE is a vector, whose elements are the
2427    template parameters at each level.  Each element in the vector is a
2428    TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
2429    non-type parameter), or a TYPE_DECL (if the parameter is a type
2430    parameter).  The TREE_PURPOSE is the default value, if any.  The
2431    TEMPLATE_PARM_INDEX for the parameter is avilable as the
2432    DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
2433    TYPE_DECL).  */
2434 #define DECL_TEMPLATE_PARMS(NODE)       DECL_ARGUMENTS(NODE)
2435 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
2436    INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
2437 #define DECL_NTPARMS(NODE) \
2438    TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
2439 /* For function, method, class-data templates.  */
2440 #define DECL_TEMPLATE_RESULT(NODE)      DECL_RESULT(NODE)
2441 /* For a static member variable template, the
2442    DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
2443    implicitly generated instantiations of the variable.  There are no
2444    partial instantiations of static member variables, so all of these
2445    will be full instantiations.
2446
2447    For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
2448    all instantiations and specializations of the class type, including
2449    partial instantiations and partial specializations.
2450
2451    In both cases, the TREE_PURPOSE of each node contains the arguments
2452    used; the TREE_VALUE contains the generated variable.  The template
2453    arguments are always complete.  For example, given:
2454
2455       template <class T> struct S1 {
2456         template <class U> struct S2 {};
2457         template <class U> struct S2<U*> {};
2458       };
2459
2460    the record for the partial specialization will contain, as its
2461    argument list, { {T}, {U*} }, and will be on the
2462    DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
2463    <class U> struct S1<T>::S2'.
2464
2465    This list is not used for function templates.  */
2466 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
2467 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
2468    contains all instantiations and specializations of the function,
2469    including partial instantiations.  For a partial instantiation
2470    which is a specialization, this list holds only full
2471    specializations of the template that are instantiations of the
2472    partial instantiation.  For example, given:
2473
2474       template <class T> struct S {
2475         template <class U> void f(U);
2476         template <> void f(T); 
2477       };
2478
2479    the `S<int>::f<int>(int)' function will appear on the
2480    DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
2481    template <class U> void S<T>::f(U)' and `template <class T> void
2482    S<int>::f(T)'.  In the latter case, however, it will have only the
2483    innermost set of arguments (T, in this case).  The DECL_TI_TEMPLATE
2484    for the function declaration will point at the specialization, not
2485    the fully general template.
2486
2487    For a class template, this list contains the partial
2488    specializations of this template.  (Full specializations are not
2489    recorded on this list.)  The TREE_PURPOSE holds the innermost
2490    arguments used in the partial specialization (e.g., for `template
2491    <class T> struct S<T*, int>' this will be `T*'.)  The TREE_VALUE
2492    holds the innermost template parameters for the specialization
2493    (e.g., `T' in the example above.)  The TREE_TYPE is the _TYPE node
2494    for the partial specialization.
2495
2496    This list is not used for static variable templates.  */
2497 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE)     DECL_SIZE(NODE)
2498
2499 /* Nonzero for a DECL which is actually a template parameter.  */
2500 #define DECL_TEMPLATE_PARM_P(NODE)              \
2501   (DECL_LANG_FLAG_0 (NODE)                      \
2502    && (TREE_CODE (NODE) == CONST_DECL           \
2503        || TREE_CODE (NODE) == TYPE_DECL         \
2504        || TREE_CODE (NODE) == TEMPLATE_DECL))
2505
2506 /* Mark NODE as a template parameter.  */
2507 #define SET_DECL_TEMPLATE_PARM_P(NODE) \
2508   (DECL_LANG_FLAG_0 (NODE) = 1)
2509
2510 /* Nonzero if NODE is a template template parameter.  */
2511 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
2512   (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
2513
2514 #define DECL_FUNCTION_TEMPLATE_P(NODE)  \
2515   (TREE_CODE (NODE) == TEMPLATE_DECL \
2516    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
2517
2518 /* Nonzero for a DECL that represents a template class.  */
2519 #define DECL_CLASS_TEMPLATE_P(NODE) \
2520   (TREE_CODE (NODE) == TEMPLATE_DECL \
2521    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
2522    && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
2523
2524 /* Nonzero if NODE which declares a type.  */
2525 #define DECL_DECLARES_TYPE_P(NODE) \
2526   (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
2527
2528 /* Nonzero if NODE is the typedef implicitly generated for a type when
2529    the type is declared.  (In C++, `struct S {};' is roughly equivalent
2530    to `struct S {}; typedef struct S S;' in C.  This macro will hold
2531    for the typedef indicated in this example.  Note that in C++, there
2532    is a second implicit typedef for each class, in the scope of `S'
2533    itself, so that you can `S::S'.  This macro does *not* hold for
2534    those typedefs.  */
2535 #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
2536   (TREE_CODE ((NODE)) == TYPE_DECL && DECL_LANG_FLAG_2 ((NODE)))
2537 #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
2538   (DECL_LANG_FLAG_2 ((NODE)) = 1)
2539
2540 /* A `primary' template is one that has its own template header.  A
2541    member function of a class template is a template, but not primary.
2542    A member template is primary.  Friend templates are primary, too.  */
2543
2544 /* Returns the primary template corresponding to these parameters.  */
2545 #define DECL_PRIMARY_TEMPLATE(NODE) \
2546   (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
2547
2548 /* Returns non-zero if NODE is a primary template.  */
2549 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
2550
2551 #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
2552   (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
2553
2554 /* Indicates whether or not (and how) a template was expanded for this
2555    FUNCTION_DECL or VAR_DECL.
2556      0=normal declaration, e.g. int min (int, int);
2557      1=implicit template instantiation
2558      2=explicit template specialization, e.g. int min<int> (int, int);
2559      3=explicit template instantiation, e.g. template int min<int> (int, int);  */
2560 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
2561
2562 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
2563 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
2564   (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
2565
2566 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
2567 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
2568 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2569   (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
2570 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2571   (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
2572
2573 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
2574 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
2575 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2576   (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
2577 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2578   (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
2579
2580 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
2581 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
2582 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2583   (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
2584 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2585   (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
2586
2587 /* Non-zero if DECL is a friend function which is an instantiation
2588    from the point of view of the compiler, but not from the point of
2589    view of the language.  For example given:
2590       template <class T> struct S { friend void f(T) {}; };
2591    the declaration of `void f(int)' generated when S<int> is
2592    instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
2593    a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION.  */
2594 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
2595   (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
2596
2597 /* Non-zero if TYPE is a partial instantiation of a template class,
2598    i.e., an instantiation whose instantiation arguments involve
2599    template types.  */
2600 #define PARTIAL_INSTANTIATION_P(TYPE) \
2601   (TYPE_LANG_SPECIFIC (TYPE)->is_partial_instantiation)
2602
2603 /* Non-zero iff we are currently processing a declaration for an
2604    entity with its own template parameter list, and which is not a
2605    full specialization.  */
2606 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
2607   (processing_template_decl > template_class_depth (current_class_type))
2608
2609 /* This function may be a guiding decl for a template.  */
2610 #define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
2611
2612 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
2613    instantiated, i.e. its definition has been generated from the
2614    pattern given in the the template.  */
2615 #define DECL_TEMPLATE_INSTANTIATED(NODE) \
2616   DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
2617
2618 /* We know what we're doing with this decl now.  */
2619 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
2620
2621 /* This function was declared inline.  This flag controls the linkage
2622    semantics of 'inline'; whether or not the function is inlined is
2623    controlled by DECL_INLINE.  */
2624 #define DECL_THIS_INLINE(NODE) \
2625   (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
2626
2627 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
2628    so that assemble_external will work properly.  So we have this flag to
2629    tell us whether the decl is really not external.  */
2630 #define DECL_NOT_REALLY_EXTERN(NODE) \
2631   (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
2632
2633 #define DECL_REALLY_EXTERN(NODE) \
2634   (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
2635
2636 #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
2637
2638 /* DECL_NEEDED_P holds of a declaration when we need to emit its
2639    definition.  This is true when the back-end tells us that
2640    the symbol has been referenced in the generated code.  If, however,
2641    we are not generating code, then it is also true when a symbol has
2642    just been used somewhere, even if it's not really needed.  */
2643 #define DECL_NEEDED_P(DECL)                                     \
2644   ((TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME ((DECL))))      \
2645    || (flag_syntax_only && TREE_USED ((DECL))))
2646
2647 /* An un-parsed default argument looks like an identifier.  */
2648 #define DEFARG_LENGTH(NODE)  (DEFAULT_ARG_CHECK(NODE)->identifier.length)
2649 #define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.pointer)
2650
2651 /* These macros provide convenient access to the various _STMT nodes
2652    created when parsing template declarations.  */
2653 #define IF_COND(NODE)           TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
2654 #define THEN_CLAUSE(NODE)       TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
2655 #define ELSE_CLAUSE(NODE)       TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
2656 #define WHILE_COND(NODE)        TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
2657 #define WHILE_BODY(NODE)        TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
2658 #define DO_COND(NODE)           TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
2659 #define DO_BODY(NODE)           TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
2660 #define RETURN_EXPR(NODE)       TREE_OPERAND (RETURN_STMT_CHECK (NODE), 0)
2661 #define EXPR_STMT_EXPR(NODE)    TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
2662 #define FOR_INIT_STMT(NODE)     TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
2663 #define FOR_COND(NODE)          TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
2664 #define FOR_EXPR(NODE)          TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
2665 #define FOR_BODY(NODE)          TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
2666 #define SWITCH_COND(NODE)       TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
2667 #define SWITCH_BODY(NODE)       TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
2668 #define CASE_LOW(NODE)          TREE_OPERAND (CASE_LABEL_CHECK (NODE), 0)
2669 #define CASE_HIGH(NODE)         TREE_OPERAND (CASE_LABEL_CHECK (NODE), 1)
2670 #define GOTO_DESTINATION(NODE)  TREE_OPERAND (GOTO_STMT_CHECK (NODE), 0)
2671 #define TRY_STMTS(NODE)         TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
2672 #define TRY_HANDLERS(NODE)      TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
2673 #define CLEANUP_P(NODE)         TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
2674 /* Nonzero if this try block is a function try block.  */
2675 #define FN_TRY_BLOCK_P(NODE)    TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
2676 #define HANDLER_PARMS(NODE)     TREE_OPERAND (HANDLER_CHECK (NODE), 0)
2677 #define HANDLER_BODY(NODE)      TREE_OPERAND (HANDLER_CHECK (NODE), 1)
2678 #define COMPOUND_BODY(NODE)     TREE_OPERAND (COMPOUND_STMT_CHECK (NODE), 0)
2679 #define ASM_CV_QUAL(NODE)       TREE_OPERAND (ASM_STMT_CHECK (NODE), 0)
2680 #define ASM_STRING(NODE)        TREE_OPERAND (ASM_STMT_CHECK (NODE), 1)
2681 #define ASM_OUTPUTS(NODE)       TREE_OPERAND (ASM_STMT_CHECK (NODE), 2)
2682 #define ASM_INPUTS(NODE)        TREE_OPERAND (ASM_STMT_CHECK (NODE), 3)
2683 #define ASM_CLOBBERS(NODE)      TREE_OPERAND (ASM_STMT_CHECK (NODE), 4)
2684 #define DECL_STMT_DECL(NODE)    TREE_OPERAND (DECL_STMT_CHECK (NODE), 0)
2685 #define STMT_EXPR_STMT(NODE)    TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
2686 #define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (SUBOBJECT_CHECK (NODE), 0)
2687 #define CLEANUP_DECL(NODE)      TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
2688 #define CLEANUP_EXPR(NODE)      TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
2689 #define START_CATCH_TYPE(NODE)  TREE_TYPE (START_CATCH_STMT_CHECK (NODE))
2690 #define LABEL_STMT_LABEL(NODE)  TREE_OPERAND (LABEL_STMT_CHECK (NODE), 0)
2691
2692 /* Nonzero if this SCOPE_STMT is for the beginning of a scope.  */
2693 #define SCOPE_BEGIN_P(NODE) \
2694   (TREE_LANG_FLAG_0 (SCOPE_STMT_CHECK (NODE))) 
2695
2696 /* Nonzero if this SCOPE_STMT is for the end of a scope.  */
2697 #define SCOPE_END_P(NODE) \
2698   (!SCOPE_BEGIN_P (SCOPE_STMT_CHECK (NODE)))
2699
2700 /* The BLOCK containing the declarations contained in this scope.  */
2701 #define SCOPE_STMT_BLOCK(NODE) \
2702   (TREE_OPERAND (SCOPE_STMT_CHECK (NODE), 0))
2703
2704 /* Nonzero if this CTOR_STMT is for the beginning of a constructor.  */
2705 #define CTOR_BEGIN_P(NODE) \
2706   (TREE_LANG_FLAG_0 (CTOR_STMT_CHECK (NODE)))
2707
2708 /* Nonzero if this CTOR_STMT is for the end of a constructor.  */
2709 #define CTOR_END_P(NODE) \
2710   (!CTOR_BEGIN_P (NODE))
2711
2712 /* Nonzero for a SCOPE_STMT if there were no variables in this scope.  */
2713 #define SCOPE_NULLIFIED_P(NODE) \
2714   (SCOPE_STMT_BLOCK ((NODE)) == NULL_TREE)
2715
2716 /* Nonzero for a SCOPE_STMT which represents a lexical scope, but
2717    which should be treated as non-existant from the point of view of
2718    running cleanup actions.  */
2719 #define SCOPE_NO_CLEANUPS_P(NODE) \
2720   (TREE_LANG_FLAG_3 (SCOPE_STMT_CHECK (NODE)))
2721
2722 /* Nonzero for a SCOPE_STMT if this statement is for a partial scope.
2723    For example, in:
2724   
2725      S s;
2726      l:
2727      S s2;
2728      goto l;
2729
2730    there is (implicitly) a new scope after `l', even though there are
2731    no curly braces.  In particular, when we hit the goto, we must
2732    destroy s2 and then re-construct it.  For the implicit scope,
2733    SCOPE_PARTIAL_P will be set.  */
2734 #define SCOPE_PARTIAL_P(NODE) \
2735   (TREE_LANG_FLAG_4 (SCOPE_STMT_CHECK (NODE)))
2736
2737 /* Nonzero for an ASM_STMT if the assembly statement is volatile.  */
2738 #define ASM_VOLATILE_P(NODE)                    \
2739   (ASM_CV_QUAL (ASM_STMT_CHECK (NODE)) != NULL_TREE)
2740
2741 /* The line-number at which a statement began.  But if
2742    STMT_LINENO_FOR_FN_P does holds, then this macro gives the
2743    line number for the end of the current function instead.  */
2744 #define STMT_LINENO(NODE)                       \
2745   (TREE_COMPLEXITY ((NODE)))
2746
2747 /* If non-zero, the STMT_LINENO for NODE is the line at which the
2748    function ended.  */
2749 #define STMT_LINENO_FOR_FN_P(NODE)              \
2750   (TREE_LANG_FLAG_2 ((NODE)))
2751
2752 /* The parameters for a call-declarator.  */
2753 #define CALL_DECLARATOR_PARMS(NODE) \
2754   (TREE_PURPOSE (TREE_OPERAND ((NODE), 1)))
2755
2756 /* The cv-qualifiers for a call-declarator.  */
2757 #define CALL_DECLARATOR_QUALS(NODE) \
2758   (TREE_VALUE (TREE_OPERAND ((NODE), 1)))
2759
2760 /* The exception-specification for a call-declarator.  */
2761 #define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \
2762   (TREE_TYPE ((NODE)))
2763
2764 /* An enumeration of the kind of tags that C++ accepts.  */
2765 enum tag_types { record_type, class_type, union_type, enum_type };
2766
2767 /* The various kinds of lvalues we distinguish.  */
2768 typedef enum cp_lvalue_kind {
2769   clk_none = 0,     /* Things that are not an lvalue.  */
2770   clk_ordinary = 1, /* An ordinary lvalue.  */
2771   clk_class = 2,    /* An rvalue of class-type.  */
2772   clk_bitfield = 4, /* An lvalue for a bit-field.  */
2773 } cp_lvalue_kind;
2774
2775 /* Zero means prototype weakly, as in ANSI C (no args means nothing).
2776    Each language context defines how this variable should be set.  */
2777 extern int strict_prototype;
2778 extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
2779
2780 /* Non-zero means that if a label exists, and no other identifier
2781    applies, use the value of the label.  */
2782 extern int flag_labels_ok;
2783
2784 /* Nonzero means allow Microsoft extensions without a pedwarn.  */
2785 extern int flag_ms_extensions;
2786
2787 /* Non-zero means to collect statistics which might be expensive
2788    and to print them when we are done.  */
2789 extern int flag_detailed_statistics;
2790
2791 /* Non-zero means warn in function declared in derived class has the
2792    same name as a virtual in the base class, but fails to match the
2793    type signature of any virtual function in the base class.  */
2794 extern int warn_overloaded_virtual;
2795
2796 /* Nonzero means warn about use of multicharacter literals.  */
2797 extern int warn_multichar;
2798
2799 /* Non-zero means warn if a non-templatized friend function is
2800    declared in a templatized class. This behavior is warned about with
2801    flag_guiding_decls in do_friend. */
2802 extern int warn_nontemplate_friend;
2803
2804 /* in c-common.c */
2805 extern void declare_function_name               PROTO((void));
2806 extern void decl_attributes                     PROTO((tree, tree, tree));
2807 extern void init_function_format_info           PROTO((void));
2808 extern void record_function_format              PROTO((tree, tree, int, int, int));
2809 extern void check_function_format               PROTO((tree, tree, tree));
2810 /* Print an error message for invalid operands to arith operation CODE.
2811    NOP_EXPR is used as a special case (see truthvalue_conversion).  */
2812 extern void binary_op_error                     PROTO((enum tree_code));
2813 extern tree canonical_type_variant              PROTO((tree));
2814 extern void c_expand_expr_stmt                  PROTO((tree));
2815 /* Validate the expression after `case' and apply default promotions.  */
2816 extern tree check_case_value                    PROTO((tree));
2817 /* Concatenate a list of STRING_CST nodes into one STRING_CST.  */
2818 extern tree combine_strings                     PROTO((tree));
2819 extern void constant_expression_warning         PROTO((tree));
2820 extern tree convert_and_check                   PROTO((tree, tree));
2821 extern void overflow_warning                    PROTO((tree));
2822 extern void unsigned_conversion_warning         PROTO((tree, tree));
2823 extern void c_apply_type_quals_to_decl          PROTO((int, tree));
2824
2825 /* Read the rest of the current #-directive line.  */
2826 #if USE_CPPLIB
2827 extern char *get_directive_line                 PROTO((void));
2828 #define GET_DIRECTIVE_LINE() get_directive_line ()
2829 #else
2830 extern char *get_directive_line                 PROTO((FILE *));
2831 #define GET_DIRECTIVE_LINE() get_directive_line (finput)
2832 #endif
2833 /* Subroutine of build_binary_op, used for comparison operations.
2834    See if the operands have both been converted from subword integer types
2835    and, if so, perhaps change them both back to their original type.  */
2836 extern tree shorten_compare                     PROTO((tree *, tree *, tree *, enum tree_code *));
2837 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
2838    or validate its data type for an `if' or `while' statement or ?..: exp.  */
2839 extern tree truthvalue_conversion               PROTO((tree));
2840 extern tree type_for_mode                       PROTO((enum machine_mode, int));
2841 extern tree type_for_size                       PROTO((unsigned, int));
2842 extern int c_get_alias_set                      PROTO((tree));
2843
2844 /* in decl{2}.c */
2845 /* A node that is a list (length 1) of error_mark_nodes.  */
2846 extern tree error_mark_list;
2847
2848 /* A list of virtual function tables we must make sure to write out.  */
2849 extern tree pending_vtables;
2850
2851 /* Node for "pointer to (virtual) function".
2852    This may be distinct from ptr_type_node so gdb can distinguish them.  */
2853 #define vfunc_ptr_type_node \
2854   (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
2855
2856
2857 /* For building calls to `delete'.  */
2858 extern tree integer_two_node, integer_three_node;
2859
2860 extern tree anonymous_namespace_name;
2861
2862 /* in pt.c  */
2863
2864 /* These values are used for the `STRICT' parameter to type_unfication and
2865    fn_type_unification.  Their meanings are described with the
2866    documentation for fn_type_unification.  */
2867
2868 typedef enum unification_kind_t {
2869   DEDUCE_CALL,
2870   DEDUCE_CONV,
2871   DEDUCE_EXACT
2872 } unification_kind_t;
2873
2874 /* The template currently being instantiated, and where the instantiation
2875    was triggered.  */
2876 struct tinst_level
2877 {
2878   tree decl;
2879   int line;
2880   char *file;
2881   struct tinst_level *next;
2882 };
2883
2884 extern void maybe_print_template_context        PROTO ((void));
2885
2886 /* in class.c */
2887
2888 extern int current_class_depth;
2889
2890 /* Points to the name of that function. May not be the DECL_NAME
2891    of CURRENT_FUNCTION_DECL due to overloading */
2892 extern tree original_function_name;
2893
2894 /* in init.c  */
2895 extern tree global_base_init_list;
2896
2897 \f
2898 /* Here's where we control how name mangling takes place.  */
2899
2900 #define OPERATOR_ASSIGN_FORMAT "__a%s"
2901 #define OPERATOR_FORMAT "__%s"
2902 #define OPERATOR_TYPENAME_FORMAT "__op"
2903
2904 /* Cannot use '$' up front, because this confuses gdb
2905    (names beginning with '$' are gdb-local identifiers).
2906
2907    Note that all forms in which the '$' is significant are long enough
2908    for direct indexing (meaning that if we know there is a '$'
2909    at a particular location, we can index into the string at
2910    any other location that provides distinguishing characters).  */
2911
2912 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
2913    doesn't allow '$' in symbol names.  */
2914 #ifndef NO_DOLLAR_IN_LABEL
2915
2916 #define JOINER '$'
2917
2918 #define VPTR_NAME "$v"
2919 #define THROW_NAME "$eh_throw"
2920 #define DESTRUCTOR_DECL_PREFIX "_$_"
2921 #define AUTO_VTABLE_NAME "__vtbl$me__"
2922 #define AUTO_TEMP_NAME "_$tmp_"
2923 #define AUTO_TEMP_FORMAT "_$tmp_%d"
2924 #define VTABLE_BASE "$vb"
2925 #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt$")
2926 #define VFIELD_BASE "$vf"
2927 #define VFIELD_NAME "_vptr$"
2928 #define VFIELD_NAME_FORMAT "_vptr$%s"
2929 #define VBASE_NAME "_vb$"
2930 #define VBASE_NAME_FORMAT "_vb$%s"
2931 #define STATIC_NAME_FORMAT "_%s$%s"
2932 #define ANON_AGGRNAME_FORMAT "$_%d"
2933
2934 #else /* NO_DOLLAR_IN_LABEL */
2935
2936 #ifndef NO_DOT_IN_LABEL
2937
2938 #define JOINER '.'
2939
2940 #define VPTR_NAME ".v"
2941 #define THROW_NAME ".eh_throw"
2942 #define DESTRUCTOR_DECL_PREFIX "_._"
2943 #define AUTO_VTABLE_NAME "__vtbl.me__"
2944 #define AUTO_TEMP_NAME "_.tmp_"
2945 #define AUTO_TEMP_FORMAT "_.tmp_%d"
2946 #define VTABLE_BASE ".vb"
2947 #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt.")
2948 #define VFIELD_BASE ".vf"
2949 #define VFIELD_NAME "_vptr."
2950 #define VFIELD_NAME_FORMAT "_vptr.%s"
2951 #define VBASE_NAME "_vb."
2952 #define VBASE_NAME_FORMAT "_vb.%s"
2953 #define STATIC_NAME_FORMAT "_%s.%s"
2954
2955 #define ANON_AGGRNAME_FORMAT "._%d"
2956
2957 #else /* NO_DOT_IN_LABEL */
2958
2959 #define VPTR_NAME "__vptr"
2960 #define VPTR_NAME_P(ID_NODE) \
2961   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
2962 #define THROW_NAME "__eh_throw"
2963 #define DESTRUCTOR_DECL_PREFIX "__destr_"
2964 #define DESTRUCTOR_NAME_P(ID_NODE) \
2965   (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
2966              sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
2967 #define IN_CHARGE_NAME "__in_chrg"
2968 #define AUTO_VTABLE_NAME "__vtbl_me__"
2969 #define AUTO_TEMP_NAME "__tmp_"
2970 #define TEMP_NAME_P(ID_NODE) \
2971   (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
2972              sizeof (AUTO_TEMP_NAME) - 1))
2973 #define AUTO_TEMP_FORMAT "__tmp_%d"
2974 #define VTABLE_BASE "__vtb"
2975 #define VTABLE_NAME "__vt_"
2976 #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt_")
2977 #define VTABLE_NAME_P(ID_NODE) \
2978   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
2979              sizeof (VTABLE_NAME) - 1))
2980 #define VFIELD_BASE "__vfb"
2981 #define VFIELD_NAME "__vptr_"
2982 #define VFIELD_NAME_P(ID_NODE) \
2983   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
2984             sizeof (VFIELD_NAME) - 1))
2985 #define VFIELD_NAME_FORMAT "_vptr_%s"
2986 #define VBASE_NAME "__vb_"
2987 #define VBASE_NAME_P(ID_NODE) \
2988   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
2989              sizeof (VBASE_NAME) - 1))
2990 #define VBASE_NAME_FORMAT "__vb_%s"
2991 #define STATIC_NAME_FORMAT "__static_%s_%s"
2992
2993 #define ANON_AGGRNAME_PREFIX "__anon_"
2994 #define ANON_AGGRNAME_P(ID_NODE) \
2995   (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
2996              sizeof (ANON_AGGRNAME_PREFIX) - 1))
2997 #define ANON_AGGRNAME_FORMAT "__anon_%d"
2998 #define ANON_PARMNAME_FORMAT "__%d"
2999 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
3000                                   && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
3001                                   && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
3002
3003 #endif  /* NO_DOT_IN_LABEL */
3004 #endif  /* NO_DOLLAR_IN_LABEL */
3005
3006 #define THIS_NAME "this"
3007 #define DESTRUCTOR_NAME_FORMAT "~%s"
3008 #define FILE_FUNCTION_PREFIX_LEN 9
3009 #define CTOR_NAME "__ct"
3010 #define DTOR_NAME "__dt"
3011
3012 #define IN_CHARGE_NAME "__in_chrg"
3013
3014 #define VTBL_PTR_TYPE           "__vtbl_ptr_type"
3015 #define VTABLE_DELTA_NAME       "__delta"
3016 #define VTABLE_INDEX_NAME       "__index"
3017 #define VTABLE_PFN_NAME         "__pfn"
3018 #define VTABLE_DELTA2_NAME      "__delta2"
3019
3020 #define EXCEPTION_CLEANUP_NAME  "exception cleanup"
3021
3022 #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
3023
3024 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
3025
3026 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3027                               && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
3028 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
3029                                     && IDENTIFIER_POINTER (ID_NODE)[2] == '_') 
3030
3031 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
3032   && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
3033   && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
3034
3035 #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
3036   && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
3037   && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
3038
3039 #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
3040 #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
3041
3042 /* For anonymous aggregate types, we need some sort of name to
3043    hold on to.  In practice, this should not appear, but it should
3044    not be harmful if it does.  */
3045 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3046                                   && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
3047 #define ANON_PARMNAME_FORMAT "_%d"
3048 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
3049                                   && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
3050 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
3051
3052 /* Store the vbase pointer field name for type TYPE into pointer BUF.  */
3053 #define FORMAT_VBASE_NAME(BUF,TYPE) do {                                \
3054   char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE)       \
3055                          + sizeof (VBASE_NAME) + 1);                    \
3056   sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \
3057   (BUF) = wbuf;                                                         \
3058 } while (0)
3059
3060 /* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
3061    `main'.  */
3062 #define MAIN_NAME_P(ID_NODE) \
3063    (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
3064
3065 /* Returns non-zero iff NODE is a declaration for the global function
3066    `main'.  */
3067 #define DECL_MAIN_P(NODE)                               \
3068    (TREE_CODE (NODE) == FUNCTION_DECL                   \
3069     && DECL_LANGUAGE (NODE) == lang_c                   \
3070     && DECL_NAME (NODE) != NULL_TREE                    \
3071     && MAIN_NAME_P (DECL_NAME (NODE)))
3072
3073 \f
3074 /* Things for handling inline functions.  */
3075
3076 struct pending_inline
3077 {
3078   struct pending_inline *next;  /* pointer to next in chain */
3079   int lineno;                   /* line number we got the text from */
3080   char *filename;               /* name of file we were processing */
3081   tree fndecl;                  /* FUNCTION_DECL that brought us here */
3082   int token;                    /* token we were scanning */
3083   int token_value;              /* value of token we were scanning (YYSTYPE) */
3084
3085   char *buf;                    /* pointer to character stream */
3086   int len;                      /* length of stream */
3087   unsigned int can_free : 1;    /* free this after we're done with it? */
3088   unsigned int deja_vu : 1;     /* set iff we don't want to see it again.  */
3089   unsigned int interface : 2;   /* 0=interface 1=unknown 2=implementation */
3090 };
3091
3092 /* in method.c */
3093 extern struct pending_inline *pending_inlines;
3094
3095 /* Negative values means we know `this' to be of static type.  */
3096
3097 extern int flag_this_is_variable;
3098
3099 /* Nonzero means generate 'rtti' that give run-time type information.  */
3100
3101 extern int flag_rtti;
3102
3103 /* Nonzero means do emit exported implementations of functions even if
3104    they can be inlined.  */
3105
3106 extern int flag_implement_inlines;
3107
3108 /* Nonzero means templates obey #pragma interface and implementation.  */
3109
3110 extern int flag_external_templates;
3111
3112 /* Nonzero means templates are emitted where they are instantiated.  */
3113
3114 extern int flag_alt_external_templates;
3115
3116 /* Nonzero means implicit template instantiations are emitted.  */
3117
3118 extern int flag_implicit_templates;
3119
3120 /* Nonzero if we want to emit defined symbols with common-like linkage as
3121    weak symbols where possible, in order to conform to C++ semantics.
3122    Otherwise, emit them as local symbols.  */
3123
3124 extern int flag_weak;
3125
3126 /* Nonzero to enable experimental ABI changes.  */
3127
3128 extern int flag_new_abi;
3129
3130 /* Nonzero to not ignore namespace std. */
3131
3132 extern int flag_honor_std;
3133
3134 /* Nonzero if we should expand functions calls inline at the tree
3135    level, rather than at the RTL level.  */
3136
3137 extern int flag_inline_trees;
3138
3139 /* Nonzero if we're done parsing and into end-of-file activities.  */
3140
3141 extern int at_eof;
3142
3143 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
3144
3145 /* Some macros for char-based bitfields.  */
3146 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
3147 #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
3148 #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
3149
3150 /* These are uses as bits in flags passed to build_method_call
3151    to control its error reporting behavior.
3152
3153    LOOKUP_PROTECT means flag access violations.
3154    LOOKUP_COMPLAIN mean complain if no suitable member function
3155      matching the arguments is found.
3156    LOOKUP_NORMAL is just a combination of these two.
3157    LOOKUP_NONVIRTUAL means make a direct call to the member function found
3158    LOOKUP_GLOBAL means search through the space of overloaded functions,
3159      as well as the space of member functions.
3160    LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
3161      in the parameter list.
3162    LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
3163    DIRECT_BIND means that if a temporary is created, it should be created so
3164      that it lives as long as the current variable bindings; otherwise it
3165      only lives until the end of the complete-expression.
3166    LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
3167      after.  Note, LOOKUP_COMPLAIN is checked and error messages printed
3168      before LOOKUP_SPECULATIVELY is checked.
3169    LOOKUP_NO_CONVERSION means that user-defined conversions are not
3170      permitted.  Built-in conversions are permitted.
3171    LOOKUP_DESTRUCTOR means explicit call to destructor.
3172    LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references.
3173
3174    These are used in global lookup to support elaborated types and
3175    qualifiers.
3176    
3177    LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
3178    LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
3179    LOOKUP_PREFER_BOTH means class-or-namespace-name.
3180    LOOKUP_TEMPLATES_EXPECTED means that class templates also count
3181      as types.  */
3182
3183 #define LOOKUP_PROTECT (1)
3184 #define LOOKUP_COMPLAIN (2)
3185 #define LOOKUP_NORMAL (3)
3186 /* #define LOOKUP_UNUSED (4) */
3187 #define LOOKUP_NONVIRTUAL (8)
3188 #define LOOKUP_GLOBAL (16)
3189 #define LOOKUP_HAS_IN_CHARGE (32)
3190 #define LOOKUP_SPECULATIVELY (64)
3191 #define LOOKUP_ONLYCONVERTING (128)
3192 #define DIRECT_BIND (256)
3193 #define LOOKUP_NO_CONVERSION (512)
3194 #define LOOKUP_DESTRUCTOR (512)
3195 #define LOOKUP_NO_TEMP_BIND (1024)
3196 #define LOOKUP_PREFER_TYPES (2048)
3197 #define LOOKUP_PREFER_NAMESPACES (4096)
3198 #define LOOKUP_PREFER_BOTH (6144)
3199 #define LOOKUP_TEMPLATES_EXPECTED (8192)
3200
3201 #define LOOKUP_NAMESPACES_ONLY(f)  \
3202   (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES))
3203 #define LOOKUP_TYPES_ONLY(f)  \
3204   (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
3205 #define LOOKUP_QUALIFIERS_ONLY(f)     ((f) & LOOKUP_PREFER_BOTH)
3206      
3207
3208 /* These flags are used by the conversion code.
3209    CONV_IMPLICIT   :  Perform implicit conversions (standard and user-defined).
3210    CONV_STATIC     :  Perform the explicit conversions for static_cast.
3211    CONV_CONST      :  Perform the explicit conversions for const_cast.
3212    CONV_REINTERPRET:  Perform the explicit conversions for reinterpret_cast.
3213    CONV_PRIVATE    :  Perform upcasts to private bases.
3214    CONV_FORCE_TEMP :  Require a new temporary when converting to the same
3215                       aggregate type.  */
3216
3217 #define CONV_IMPLICIT    1
3218 #define CONV_STATIC      2
3219 #define CONV_CONST       4
3220 #define CONV_REINTERPRET 8
3221 #define CONV_PRIVATE     16
3222 /* #define CONV_NONCONVERTING 32 */
3223 #define CONV_FORCE_TEMP  64
3224 #define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
3225 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
3226                           | CONV_REINTERPRET)
3227 #define CONV_C_CAST      (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
3228                           | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
3229
3230 /* Used by build_expr_type_conversion to indicate which types are
3231    acceptable as arguments to the expression under consideration.  */
3232
3233 #define WANT_INT        1 /* integer types, including bool */
3234 #define WANT_FLOAT      2 /* floating point types */
3235 #define WANT_ENUM       4 /* enumerated types */
3236 #define WANT_POINTER    8 /* pointer types */
3237 #define WANT_NULL      16 /* null pointer constant */
3238 #define WANT_ARITH      (WANT_INT | WANT_FLOAT)
3239
3240 /* Used with comptypes, and related functions, to guide type
3241    comparison.  */
3242
3243 #define COMPARE_STRICT        0 /* Just check if the types are the
3244                                    same.  */
3245 #define COMPARE_BASE          1 /* Check to see if the second type is
3246                                    derived from the first, or if both
3247                                    are pointers (or references) and
3248                                    the types pointed to by the second
3249                                    type is derived from the pointed to
3250                                    by the first.  */
3251 #define COMPARE_RELAXED       2 /* Like COMPARE_DERIVED, but in
3252                                    reverse.  Also treat enmeration
3253                                    types as the same as integer types
3254                                    of the same width.  */
3255 #define COMPARE_REDECLARATION 4 /* The comparsion is being done when
3256                                    another declaration of an existing
3257                                    entity is seen.  */
3258 #define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
3259                                    extra-linguistic type attributes.  */
3260
3261 /* Used with push_overloaded_decl.  */
3262 #define PUSH_GLOBAL          0  /* Push the DECL into namespace scope,
3263                                    regardless of the current scope.  */
3264 #define PUSH_LOCAL           1  /* Push the DECL into the current
3265                                    scope.  */
3266 #define PUSH_USING           2  /* We are pushing this DECL as the
3267                                    result of a using declaration.  */
3268
3269 /* Used with start function.  */
3270 #define SF_DEFAULT           0  /* No flags.  */
3271 #define SF_PRE_PARSED        1  /* The function declaration has
3272                                    already been parsed.  */
3273 #define SF_INCLASS_INLINE    2  /* The function is an inline, defined
3274                                    in the class body.  */
3275 #define SF_EXPAND            4  /* Generate RTL for this function.  */
3276
3277 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
3278    sense of `same'.  */
3279 #define same_type_p(type1, type2) \
3280   comptypes ((type1), (type2), COMPARE_STRICT)
3281
3282 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
3283    is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
3284    class derived from the type pointed to (referred to) by TYPE1.  */
3285 #define same_or_base_type_p(type1, type2) \
3286   comptypes ((type1), (type2), COMPARE_BASE)
3287
3288 /* These macros are used to access a TEMPLATE_PARM_INDEX.  */
3289 #define TEMPLATE_PARM_INDEX_CAST(NODE) \
3290         ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
3291 #define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
3292 #define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
3293 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
3294 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
3295 #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
3296
3297 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM 
3298    and TEMPLATE_TEMPLATE_PARM nodes.  */
3299 #define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
3300 #define TEMPLATE_TYPE_IDX(NODE) \
3301   (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3302 #define TEMPLATE_TYPE_LEVEL(NODE) \
3303   (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3304 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
3305   (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3306 #define TEMPLATE_TYPE_DECL(NODE) \
3307   (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3308
3309 /* Control stringification of trees (types, decls & exprs).
3310    Bit or them together.  */
3311 enum tree_string_flags
3312 {
3313     TS_PLAIN,                    /* nothing special */
3314     TS_CHASE_TYPEDEFS = 1 <<  0, /* look through typedefs */
3315     TS_DECORATE       = 1 <<  1, /* decorate things */
3316     TS_FUNC_NORETURN  = 1 <<  2, /* inhibit function return type */
3317     TS_FUNC_THROW     = 1 <<  3, /* show throw spec */
3318     TS_PARM_DEFAULTS  = 1 <<  4, /* show parm defaults */
3319     TS_EXPR_PARENS    = 1 <<  5, /* enclose in parens */
3320     TS_AGGR_TAGS      = 1 <<  6, /* show struct tags */
3321     TS_DECL_TYPE      = 1 <<  7, /* show decl's type */
3322     TS_FUNC_SCOPE     = 1 <<  8, /* show function scope */
3323     TS_PEDANTIC_NAME  = 1 <<  9, /* pedantically name things */
3324     TS_TEMPLATE_PREFIX= 1 << 10, /* show template <parms> prefix */
3325     
3326     /* Internal use flags */
3327     TS_TEMPLATE_PARM  = 1 << 11, /* decl is really a non-type template parm */
3328     TS_TEMPLATE_PLAIN = 1 << 12, /* don't decorate primary template_name */
3329     
3330     TS_NEXT_BIT       = 13       /* next available bit */
3331 };
3332
3333 /* in lex.c  */
3334 /* Indexed by TREE_CODE, these tables give C-looking names to
3335    operators represented by TREE_CODES.  For example,
3336    opname_tab[(int) MINUS_EXPR] == "-".  */
3337 extern const char **opname_tab, **assignop_tab;
3338 \f
3339 /* in call.c */
3340 extern int check_dtor_name                      PROTO((tree, tree));
3341 extern int get_arglist_len_in_bytes             PROTO((tree));
3342
3343 extern tree build_vfield_ref                    PROTO((tree, tree));
3344 extern tree resolve_scope_to_name               PROTO((tree, tree));
3345 extern tree build_scoped_method_call            PROTO((tree, tree, tree, tree));
3346 extern tree build_addr_func                     PROTO((tree));
3347 extern tree build_call                          PROTO((tree, tree, tree));
3348 extern tree build_method_call                   PROTO((tree, tree, tree, tree, int));
3349 extern int null_ptr_cst_p                       PROTO((tree));
3350 extern tree type_decays_to                      PROTO((tree));
3351 extern tree build_user_type_conversion          PROTO((tree, tree, int));
3352 extern tree build_new_function_call             PROTO((tree, tree));
3353 extern tree build_new_op                        PROTO((enum tree_code, int, tree, tree, tree));
3354 extern tree build_op_new_call                   PROTO((enum tree_code, tree, tree, int));
3355 extern tree build_op_delete_call                PROTO((enum tree_code, tree, tree, int, tree));
3356 extern int can_convert                          PROTO((tree, tree));
3357 extern int can_convert_arg                      PROTO((tree, tree, tree));
3358 extern int enforce_access                       PROTO((tree, tree));
3359 extern tree convert_default_arg                 PROTO((tree, tree, tree));
3360 extern tree convert_arg_to_ellipsis             PROTO((tree));
3361 extern tree build_x_va_arg                      PROTO((tree, tree));
3362 extern tree convert_type_from_ellipsis          PROTO((tree));
3363 extern int is_properly_derived_from             PROTO((tree, tree));
3364 extern tree initialize_reference                PROTO((tree, tree));
3365 extern tree strip_top_quals                     PROTO((tree));
3366 extern tree perform_implicit_conversion         PROTO((tree, tree));
3367
3368 /* in class.c */
3369 extern tree build_vbase_path                    PROTO((enum tree_code, tree, tree, tree, int));
3370 extern tree build_vtbl_ref                      PROTO((tree, tree));
3371 extern tree build_vfn_ref                       PROTO((tree *, tree, tree));
3372 extern void add_method                          PROTO((tree, tree *, tree));
3373 extern int currently_open_class                 PROTO((tree));
3374 extern tree get_vfield_offset                   PROTO((tree));
3375 extern void duplicate_tag_error                 PROTO((tree));
3376 extern tree finish_struct                       PROTO((tree, tree));
3377 extern void finish_struct_1                     PROTO((tree));
3378 extern int resolves_to_fixed_type_p             PROTO((tree, int *));
3379 extern void init_class_processing               PROTO((void));
3380 extern int is_empty_class                       PROTO((tree));
3381 extern void pushclass                           PROTO((tree, int));
3382 extern void popclass                            PROTO((void));
3383 extern void push_nested_class                   PROTO((tree, int));
3384 extern void pop_nested_class                    PROTO((void));
3385 extern void push_lang_context                   PROTO((tree));
3386 extern void pop_lang_context                    PROTO((void));
3387 extern tree instantiate_type                    PROTO((tree, tree, int));
3388 extern void print_class_statistics              PROTO((void));
3389 extern unsigned HOST_WIDE_INT skip_rtti_stuff   PROTO((tree *, tree));
3390 extern void build_self_reference                PROTO((void));
3391 extern void warn_hidden                         PROTO((tree));
3392 extern tree get_enclosing_class                 PROTO((tree));
3393 int is_base_of_enclosing_class                  PROTO((tree, tree));
3394 extern void unreverse_member_declarations       PROTO((tree));
3395 extern void invalidate_class_lookup_cache       PROTO((void));
3396 extern void maybe_note_name_used_in_class       PROTO((tree, tree));
3397 extern void note_name_declared_in_class         PROTO((tree, tree));
3398
3399 /* in cvt.c */
3400 extern tree convert_to_reference                PROTO((tree, tree, int, int, tree));
3401 extern tree convert_from_reference              PROTO((tree));
3402 extern tree convert_pointer_to_real             PROTO((tree, tree));
3403 extern tree convert_pointer_to                  PROTO((tree, tree));
3404 extern tree ocp_convert                         PROTO((tree, tree, int, int));
3405 extern tree cp_convert                          PROTO((tree, tree));
3406 extern tree convert_to_void                     PROTO((tree, const char */*implicit context*/));
3407 extern tree convert                             PROTO((tree, tree));
3408 extern tree convert_force                       PROTO((tree, tree, int));
3409 extern tree build_type_conversion               PROTO((tree, tree, int));
3410 extern tree build_expr_type_conversion          PROTO((int, tree, int));
3411 extern tree type_promotes_to                    PROTO((tree));
3412 extern tree perform_qualification_conversions   PROTO((tree, tree));
3413
3414 /* decl.c */
3415 /* resume_binding_level */
3416 extern void set_identifier_local_value          PROTO((tree, tree));
3417 extern int global_bindings_p                    PROTO((void));
3418 extern int toplevel_bindings_p                  PROTO((void));
3419 extern int namespace_bindings_p                 PROTO((void));
3420 extern void keep_next_level                     PROTO((int));
3421 extern int kept_level_p                         PROTO((void));
3422 extern void declare_pseudo_global_level         PROTO((void));
3423 extern int pseudo_global_level_p                PROTO((void));
3424 extern void set_class_shadows                   PROTO((tree));
3425 extern void pushlevel                           PROTO((int));
3426 extern void note_level_for_for                  PROTO((void));
3427 extern void resume_level                        PROTO((struct binding_level *));
3428 extern void delete_block                        PROTO((tree));
3429 extern void insert_block                        PROTO((tree));
3430 extern void add_block_current_level             PROTO((tree));
3431 extern void set_block                           PROTO((tree));
3432 extern void pushlevel_class                     PROTO((void));
3433 extern void poplevel_class                      PROTO((void));
3434 extern void print_binding_stack                 PROTO((void));
3435 extern void print_binding_level                 PROTO((struct binding_level *));
3436 extern void push_namespace                      PROTO((tree));
3437 extern void pop_namespace                       PROTO((void));
3438 extern void push_nested_namespace               PROTO((tree));
3439 extern void pop_nested_namespace                PROTO((tree));
3440 extern void maybe_push_to_top_level             PROTO((int));
3441 extern void push_to_top_level                   PROTO((void));
3442 extern void pop_from_top_level                  PROTO((void));
3443 extern tree identifier_type_value               PROTO((tree));
3444 extern void set_identifier_type_value           PROTO((tree, tree));
3445 extern void pop_everything                      PROTO((void));
3446 extern void pushtag                             PROTO((tree, tree, int));
3447 extern tree make_anon_name                      PROTO((void));
3448 extern void clear_anon_tags                     PROTO((void));
3449 extern int decls_match                          PROTO((tree, tree));
3450 extern int duplicate_decls                      PROTO((tree, tree));
3451 extern tree pushdecl                            PROTO((tree));
3452 extern tree pushdecl_top_level                  PROTO((tree));
3453 extern void pushdecl_class_level                PROTO((tree));
3454 #if 0
3455 extern void pushdecl_nonclass_level             PROTO((tree));
3456 #endif
3457 extern tree pushdecl_namespace_level            PROTO((tree));
3458 extern tree push_using_decl                     PROTO((tree, tree));
3459 extern tree push_using_directive                PROTO((tree));
3460 extern void push_class_level_binding            PROTO((tree, tree));
3461 extern tree implicitly_declare                  PROTO((tree));
3462 extern tree lookup_label                        PROTO((tree));
3463 extern tree declare_local_label                 PROTO((tree));
3464 extern tree define_label                        PROTO((char *, int, tree));
3465 extern void push_switch                         PROTO((void));
3466 extern void pop_switch                          PROTO((void));
3467 extern void define_case_label                   PROTO((void));
3468 extern tree getdecls                            PROTO((void));
3469 extern tree gettags                             PROTO((void));
3470 #if 0
3471 extern void set_current_level_tags_transparency PROTO((int));
3472 #endif
3473 extern tree binding_for_name                    PROTO((tree, tree));
3474 extern tree namespace_binding                   PROTO((tree, tree));
3475 extern void set_namespace_binding               PROTO((tree, tree, tree));
3476 extern tree lookup_namespace_name               PROTO((tree, tree));
3477 extern tree build_typename_type                 PROTO((tree, tree, tree, tree));
3478 extern tree make_typename_type                  PROTO((tree, tree, int));
3479 extern tree lookup_name_nonclass                PROTO((tree));
3480 extern tree lookup_function_nonclass            PROTO((tree, tree));
3481 extern tree lookup_name                         PROTO((tree, int));
3482 extern tree lookup_name_current_level           PROTO((tree));
3483 extern tree lookup_type_current_level           PROTO((tree));
3484 extern tree lookup_name_namespace_only          PROTO((tree));
3485 extern void begin_only_namespace_names          PROTO((void));
3486 extern void end_only_namespace_names            PROTO((void));
3487 extern tree namespace_ancestor                  PROTO((tree, tree));
3488 extern tree unqualified_namespace_lookup        PROTO((tree, int, tree *));
3489 extern int  lookup_using_namespace              PROTO((tree, tree, tree, tree, int, tree *));
3490 extern int  qualified_lookup_using_namespace    PROTO((tree, tree, tree, int));
3491 extern tree auto_function                       PROTO((tree, tree));
3492 extern void init_decl_processing                PROTO((void));
3493 extern int init_type_desc                       PROTO((void));
3494 extern tree define_function                     PROTO((const char *, tree,
3495                                                        void (*) (tree),
3496                                                        const char *));
3497 extern tree check_tag_decl                      PROTO((tree));
3498 extern void shadow_tag                          PROTO((tree));
3499 extern tree groktypename                        PROTO((tree));
3500 extern tree start_decl                          PROTO((tree, tree, int, tree, tree));
3501 extern void start_decl_1                        PROTO((tree));
3502 extern void cp_finish_decl                      PROTO((tree, tree, tree, int));
3503 extern void finish_decl                         PROTO((tree, tree, tree));
3504 extern void maybe_inject_for_scope_var          PROTO((tree));
3505 extern void initialize_local_var                PROTO((tree, tree, int));
3506 extern void expand_static_init                  PROTO((tree, tree));
3507 extern tree start_handler_parms                 PROTO((tree, tree));
3508 extern int complete_array_type                  PROTO((tree, tree, int));
3509 extern tree build_ptrmemfunc_type               PROTO((tree));
3510 /* the grokdeclarator prototype is in decl.h */
3511 extern int parmlist_is_exprlist                 PROTO((tree));
3512 extern int copy_args_p                          PROTO((tree));
3513 extern int grok_ctor_properties                 PROTO((tree, tree));
3514 extern void grok_op_properties                  PROTO((tree, int, int));
3515 extern tree xref_tag                            PROTO((tree, tree, int));
3516 extern tree xref_tag_from_type                  PROTO((tree, tree, int));
3517 extern void xref_basetypes                      PROTO((tree, tree, tree, tree));
3518 extern tree start_enum                          PROTO((tree));
3519 extern tree finish_enum                         PROTO((tree));
3520 extern void build_enumerator                    PROTO((tree, tree, tree));
3521 extern int start_function                       PROTO((tree, tree, tree, int));
3522 extern void expand_start_early_try_stmts        PROTO((void));
3523 extern void store_parm_decls                    PROTO((void));
3524 extern void store_return_init                   PROTO((tree));
3525 extern tree finish_function                     PROTO((int, int));
3526 extern tree start_method                        PROTO((tree, tree, tree));
3527 extern tree finish_method                       PROTO((tree));
3528 extern void hack_incomplete_structures          PROTO((tree));
3529 extern tree maybe_build_cleanup_and_delete      PROTO((tree));
3530 extern tree maybe_build_cleanup                 PROTO((tree));
3531 extern void cplus_expand_expr_stmt              PROTO((tree));
3532 extern void finish_stmt                         PROTO((void));
3533 extern int in_function_p                        PROTO((void));
3534 extern void replace_defarg                      PROTO((tree, tree));
3535 extern void print_other_binding_stack           PROTO((struct binding_level *));
3536 extern void revert_static_member_fn             PROTO((tree*, tree*, tree*));
3537 extern void fixup_anonymous_aggr                PROTO((tree));
3538 extern int check_static_variable_definition     PROTO((tree, tree));
3539 extern tree compute_array_index_type            PROTO((tree, tree));
3540 extern void push_local_binding                  PROTO((tree, tree, int));
3541 extern int push_class_binding                   PROTO((tree, tree));
3542 extern tree check_default_argument              PROTO((tree, tree));
3543 extern tree push_overloaded_decl                PROTO((tree, int));
3544 extern void clear_identifier_class_values       PROTO((void));
3545 extern void storetags                           PROTO((tree));
3546 extern int vtable_decl_p                        PROTO((tree, void *));
3547 extern int vtype_decl_p                         PROTO((tree, void *));
3548 extern int sigtable_decl_p                      PROTO((tree, void *));
3549 typedef int (*walk_globals_pred)                PROTO((tree, void *));
3550 typedef int (*walk_globals_fn)                  PROTO((tree *, void *));
3551 extern int walk_globals                         PROTO((walk_globals_pred,
3552                                                        walk_globals_fn,
3553                                                        void *));
3554 typedef int (*walk_namespaces_fn)               PROTO((tree, void *));
3555 extern int walk_namespaces                      PROTO((walk_namespaces_fn,
3556                                                        void *));
3557 extern int wrapup_globals_for_namespace         PROTO((tree, void *));
3558 extern tree cp_namespace_decls                  PROTO((tree));
3559 extern tree create_implicit_typedef             PROTO((tree, tree));
3560 extern tree maybe_push_decl                     PROTO((tree));
3561 extern void emit_local_var                      PROTO((tree));
3562 extern tree build_target_expr_with_type         PROTO((tree, tree));
3563 extern void make_rtl_for_local_static           PROTO((tree));
3564 extern int local_variable_p                     PROTO((tree));
3565 extern int nonstatic_local_decl_p               PROTO((tree));
3566
3567 /* in decl2.c */
3568 extern void init_decl2                          PROTO((void));
3569 extern int check_java_method                    PROTO((tree));
3570 extern int lang_decode_option                   PROTO((int, char **));
3571 extern int grok_method_quals                    PROTO((tree, tree, tree));
3572 extern void warn_if_unknown_interface           PROTO((tree));
3573 extern void grok_x_components                   PROTO((tree));
3574 extern void maybe_retrofit_in_chrg              PROTO((tree));
3575 extern void maybe_make_one_only                 PROTO((tree));
3576 extern void grokclassfn                         PROTO((tree, tree, enum overload_flags, tree));
3577 extern tree grok_alignof                        PROTO((tree));
3578 extern tree grok_array_decl                     PROTO((tree, tree));
3579 extern tree delete_sanity                       PROTO((tree, tree, int, int));
3580 extern tree check_classfn                       PROTO((tree, tree));
3581 extern void check_member_template               PROTO((tree));
3582 extern tree grokfield                           PROTO((tree, tree, tree, tree, tree));
3583 extern tree grokbitfield                        PROTO((tree, tree, tree));
3584 extern tree groktypefield                       PROTO((tree, tree));
3585 extern tree grokoptypename                      PROTO((tree, tree));
3586 extern int copy_assignment_arg_p                PROTO((tree, int));
3587 extern void cplus_decl_attributes               PROTO((tree, tree, tree)); 
3588 extern tree constructor_name_full               PROTO((tree));
3589 extern tree constructor_name                    PROTO((tree));
3590 extern void setup_vtbl_ptr                      PROTO((void));
3591 extern void mark_inline_for_output              PROTO((tree));
3592 extern tree get_temp_name                       PROTO((tree, int));
3593 extern void finish_anon_union                   PROTO((tree));
3594 extern tree finish_table                        PROTO((tree, tree, tree, int));
3595 extern void finish_builtin_type                 PROTO((tree, const char *,
3596                                                        tree *, int, tree));
3597 extern tree coerce_new_type                     PROTO((tree));
3598 extern tree coerce_delete_type                  PROTO((tree));
3599 extern void comdat_linkage                      PROTO((tree));
3600 extern void import_export_class                 PROTO((tree));
3601 extern void import_export_vtable                PROTO((tree, tree, int));
3602 extern void import_export_decl                  PROTO((tree));
3603 extern tree build_cleanup                       PROTO((tree));
3604 extern void finish_file                         PROTO((void));
3605 extern tree reparse_absdcl_as_expr              PROTO((tree, tree));
3606 extern tree reparse_absdcl_as_casts             PROTO((tree, tree));
3607 extern tree build_expr_from_tree                PROTO((tree));
3608 extern tree reparse_decl_as_expr                PROTO((tree, tree));
3609 extern tree finish_decl_parsing                 PROTO((tree));
3610 extern tree check_cp_case_value                 PROTO((tree));
3611 extern void set_decl_namespace                  PROTO((tree, tree, int));
3612 extern tree current_decl_namespace              PROTO((void));
3613 extern void push_decl_namespace                 PROTO((tree));
3614 extern void pop_decl_namespace                  PROTO((void));
3615 extern void push_scope                          PROTO((tree));
3616 extern void pop_scope                           PROTO((tree));
3617 extern void do_namespace_alias                  PROTO((tree, tree));
3618 extern void do_toplevel_using_decl              PROTO((tree));
3619 extern void do_local_using_decl                 PROTO((tree));
3620 extern tree do_class_using_decl                 PROTO((tree));
3621 extern void do_using_directive                  PROTO((tree));
3622 extern void check_default_args                  PROTO((tree));
3623 extern void mark_used                           PROTO((tree));
3624 extern tree handle_class_head                   PROTO((tree, tree, tree));
3625 extern tree lookup_arg_dependent                PROTO((tree, tree, tree));
3626 extern void finish_static_data_member_decl      PROTO((tree, tree, tree, int));
3627
3628 /* in parse.y */
3629 extern void cp_parse_init                       PROTO((void));
3630
3631 /* in errfn.c */
3632 /* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */
3633 extern void cp_error                            PVPROTO((const char *, ...));
3634 extern void cp_error_at                         PVPROTO((const char *, ...));
3635 extern void cp_warning                          PVPROTO((const char *, ...));
3636 extern void cp_warning_at                       PVPROTO((const char *, ...));
3637 extern void cp_pedwarn                          PVPROTO((const char *, ...));
3638 extern void cp_pedwarn_at                       PVPROTO((const char *, ...));
3639 extern void cp_compiler_error                   PVPROTO((const char *, ...));
3640 extern void cp_sprintf                          PVPROTO((const char *, ...));
3641 extern void cp_deprecated                       PROTO((const char*));
3642
3643 /* in error.c */
3644 extern void init_error                          PROTO((void));
3645 extern const char *type_as_string               PROTO((tree, enum tree_string_flags));
3646 extern const char *decl_as_string               PROTO((tree, enum tree_string_flags));
3647 extern const char *expr_as_string               PROTO((tree, enum tree_string_flags));
3648 extern const char *context_as_string            PROTO((tree, enum tree_string_flags));
3649 extern const char *lang_decl_name               PROTO((tree, int));
3650 extern const char *cp_file_of                   PROTO((tree));
3651 extern int cp_line_of                           PROTO((tree));
3652
3653 /* in except.c */
3654 extern void init_exception_processing           PROTO((void));
3655 extern tree expand_start_catch_block            PROTO((tree));
3656 extern void expand_end_catch_block              PROTO((tree));
3657 extern void expand_builtin_throw                PROTO((void));
3658 extern tree expand_start_eh_spec                PROTO((void));
3659 extern void expand_end_eh_spec                  PROTO((tree, tree));
3660 extern void expand_exception_blocks             PROTO((void));
3661 extern tree start_anon_func                     PROTO((void));
3662 extern void end_anon_func                       PROTO((void));
3663 extern tree build_throw                         PROTO((tree));
3664 extern void mark_all_runtime_matches            PROTO((void));
3665
3666 /* in expr.c */
3667 extern void init_cplus_expand                   PROTO((void));
3668 extern void fixup_result_decl                   PROTO((tree, struct rtx_def *));
3669 extern int extract_init                         PROTO((tree, tree));
3670 extern void do_case                             PROTO((tree, tree));
3671 extern tree cplus_expand_constant               PROTO((tree));
3672
3673 /* friend.c */
3674 extern int is_friend                            PROTO((tree, tree));
3675 extern void make_friend_class                   PROTO((tree, tree));
3676 extern void add_friend                          PROTO((tree, tree));
3677 extern void add_friends                         PROTO((tree, tree, tree));
3678 extern tree do_friend                           PROTO((tree, tree, tree, tree, tree, enum overload_flags, tree, int));
3679
3680 /* in init.c */
3681 extern void init_init_processing                PROTO((void));
3682 extern void expand_direct_vtbls_init            PROTO((tree, tree, int, int, tree));
3683 extern tree emit_base_init                      PROTO((tree));
3684 extern void check_base_init                     PROTO((tree));
3685 extern void expand_member_init                  PROTO((tree, tree, tree));
3686 extern tree build_aggr_init                     PROTO((tree, tree, int));
3687 extern int is_aggr_typedef                      PROTO((tree, int));
3688 extern int is_aggr_type                         PROTO((tree, int));
3689 extern tree get_aggr_from_typedef               PROTO((tree, int));
3690 extern tree get_type_value                      PROTO((tree));
3691 extern tree build_member_call                   PROTO((tree, tree, tree));
3692 extern tree build_offset_ref                    PROTO((tree, tree));
3693 extern tree resolve_offset_ref                  PROTO((tree));
3694 extern tree decl_constant_value                 PROTO((tree));
3695 extern tree build_new                           PROTO((tree, tree, tree, int));
3696 extern tree build_new_1                         PROTO((tree));
3697 extern tree build_vec_init                      PROTO((tree, tree, tree, tree, int));
3698 extern tree build_x_delete                      PROTO((tree, int, tree));
3699 extern tree build_delete                        PROTO((tree, tree, tree, int, int));
3700 extern tree build_vbase_delete                  PROTO((tree, tree));
3701 extern tree build_vec_delete                    PROTO((tree, tree, tree, int));
3702 extern tree create_temporary_var                PROTO((tree));
3703 extern void begin_init_stmts                    PROTO((tree *, tree *));
3704 extern tree finish_init_stmts                   PROTO((tree, tree));
3705
3706 /* in input.c */
3707
3708 /* in lex.c */
3709 extern char *file_name_nondirectory             PROTO((const char *));
3710 extern tree make_pointer_declarator             PROTO((tree, tree));
3711 extern tree make_reference_declarator           PROTO((tree, tree));
3712 extern tree make_call_declarator                PROTO((tree, tree, tree, tree));
3713 extern void set_quals_and_spec                  PROTO((tree, tree, tree));
3714 extern const char *operator_name_string         PROTO((tree));
3715 extern void lang_init                           PROTO((void));
3716 extern void lang_finish                         PROTO((void));
3717 #if 0
3718 extern void reinit_lang_specific                PROTO((void));
3719 #endif
3720 extern void reinit_parse_for_function           PROTO((void));
3721 extern void print_parse_statistics              PROTO((void));
3722 extern void extract_interface_info              PROTO((void));
3723 extern void do_pending_inlines                  PROTO((void));
3724 extern void process_next_inline                 PROTO((struct pending_inline *));
3725 extern struct pending_input *save_pending_input PROTO((void));
3726 extern void restore_pending_input               PROTO((struct pending_input *));
3727 extern void yyungetc                            PROTO((int, int));
3728 extern void reinit_parse_for_method             PROTO((int, tree));
3729 extern void reinit_parse_for_block              PROTO((int, struct obstack *));
3730 extern tree cons_up_default_function            PROTO((tree, tree, int));
3731 extern void check_for_missing_semicolon         PROTO((tree));
3732 extern void note_got_semicolon                  PROTO((tree));
3733 extern void note_list_got_semicolon             PROTO((tree));
3734 extern void do_pending_lang_change              PROTO((void));
3735 extern int identifier_type                      PROTO((tree));
3736 extern void see_typename                        PROTO((void));
3737 extern tree do_identifier                       PROTO((tree, int, tree));
3738 extern tree do_scoped_id                        PROTO((tree, int));
3739 extern tree identifier_typedecl_value           PROTO((tree));
3740 extern int real_yylex                           PROTO((void));
3741 extern int is_rid                               PROTO((tree));
3742 extern tree build_lang_decl                     PROTO((enum tree_code, tree, tree));
3743 extern void retrofit_lang_decl                  PROTO((tree));
3744 extern void copy_lang_decl                      PROTO((tree));
3745 extern tree cp_make_lang_type                   PROTO((enum tree_code));
3746 extern void dump_time_statistics                PROTO((void));
3747 extern void compiler_error                      PVPROTO((const char *, ...))
3748   ATTRIBUTE_PRINTF_1;
3749 extern void yyerror                             PROTO((const char *));
3750 extern void clear_inline_text_obstack           PROTO((void));
3751 extern void maybe_snarf_defarg                  PROTO((void));
3752 extern tree snarf_defarg                        PROTO((void));
3753 extern void add_defarg_fn                       PROTO((tree));
3754 extern void do_pending_defargs                  PROTO((void));
3755 extern int identifier_type                      PROTO((tree));
3756 extern void yyhook                              PROTO((int));
3757 extern int cp_type_qual_from_rid                PROTO((tree));
3758
3759 /* in method.c */
3760 extern void init_method                         PROTO((void));
3761 extern void do_inline_function_hair             PROTO((tree, tree));
3762 extern char *build_overload_name                PROTO((tree, int, int));
3763 extern tree build_static_name                   PROTO((tree, tree));
3764 extern tree build_decl_overload                 PROTO((tree, tree, int));
3765 extern tree build_decl_overload_real            PROTO((tree, tree, tree, tree,
3766                                                        tree, int)); 
3767 extern void set_mangled_name_for_decl           PROTO((tree));
3768 extern tree build_typename_overload             PROTO((tree));
3769 extern tree build_overload_with_type            PROTO((tree, tree));
3770 extern tree build_destructor_name               PROTO((tree));
3771 extern tree build_opfncall                      PROTO((enum tree_code, int, tree, tree, tree));
3772 extern tree hack_identifier                     PROTO((tree, tree));
3773 extern tree make_thunk                          PROTO((tree, int));
3774 extern void emit_thunk                          PROTO((tree));
3775 extern void synthesize_method                   PROTO((tree));
3776 extern tree get_id_2                            PROTO((const char *, tree));
3777
3778 /* In optimize.c */
3779 extern void optimize_function                   PROTO((tree));
3780 extern int calls_setjmp_p                       PROTO((tree));
3781
3782 /* in pt.c */
3783 extern void init_pt                             PROTO ((void));
3784 extern void check_template_shadow               PROTO ((tree));
3785 extern tree innermost_args                      PROTO ((tree));
3786 extern tree tsubst                              PROTO ((tree, tree, int, tree));
3787 extern tree tsubst_expr                         PROTO ((tree, tree, int, tree));
3788 extern tree tsubst_copy                         PROTO ((tree, tree, int, tree));
3789 extern void maybe_begin_member_template_processing PROTO((tree));
3790 extern void maybe_end_member_template_processing PROTO((void));
3791 extern tree finish_member_template_decl         PROTO((tree));
3792 extern void begin_template_parm_list            PROTO((void));
3793 extern void begin_specialization                PROTO((void));
3794 extern void reset_specialization                PROTO((void));
3795 extern void end_specialization                  PROTO((void));
3796 extern void begin_explicit_instantiation        PROTO((void));
3797 extern void end_explicit_instantiation          PROTO((void));
3798 extern tree check_explicit_specialization       PROTO((tree, tree, int, int));
3799 extern tree process_template_parm               PROTO((tree, tree));
3800 extern tree end_template_parm_list              PROTO((tree));
3801 extern void end_template_decl                   PROTO((void));
3802 extern tree current_template_args               PROTO((void));
3803 extern tree push_template_decl                  PROTO((tree));
3804 extern tree push_template_decl_real             PROTO((tree, int));
3805 extern void redeclare_class_template            PROTO((tree, tree));
3806 extern tree lookup_template_class               PROTO((tree, tree, tree, tree, int));
3807 extern tree lookup_template_function            PROTO((tree, tree));
3808 extern int uses_template_parms                  PROTO((tree));
3809 extern tree instantiate_class_template          PROTO((tree));
3810 extern tree instantiate_template                PROTO((tree, tree));
3811 extern void overload_template_name              PROTO((tree));
3812 extern int fn_type_unification                  PROTO((tree, tree, tree, tree, tree, unification_kind_t));
3813 struct tinst_level *tinst_for_decl              PROTO((void));
3814 extern void mark_decl_instantiated              PROTO((tree, int));
3815 extern int more_specialized                     PROTO((tree, tree, tree));
3816 extern void mark_class_instantiated             PROTO((tree, int));
3817 extern void do_decl_instantiation               PROTO((tree, tree, tree));
3818 extern void do_type_instantiation               PROTO((tree, tree));
3819 extern tree instantiate_decl                    PROTO((tree));
3820 extern tree get_bindings                        PROTO((tree, tree, tree));
3821 extern void add_tree                            PROTO((tree));
3822 extern void add_maybe_template                  PROTO((tree, tree));
3823 extern void pop_tinst_level                     PROTO((void));
3824 extern int more_specialized_class               PROTO((tree, tree));
3825 extern int is_member_template                   PROTO((tree));
3826 extern int template_parms_equal                 PROTO((tree, tree));
3827 extern int comp_template_parms                  PROTO((tree, tree));
3828 extern int template_class_depth                 PROTO((tree));
3829 extern int is_specialization_of                 PROTO((tree, tree));
3830 extern int comp_template_args                   PROTO((tree, tree));
3831 extern void maybe_process_partial_specialization PROTO((tree));
3832 extern void maybe_check_template_type           PROTO((tree));
3833 extern tree most_specialized_instantiation      PROTO((tree, tree));
3834 extern void print_candidates                    PROTO((tree));
3835 extern int instantiate_pending_templates        PROTO((void));
3836 extern tree tsubst_default_argument             PROTO((tree, tree, tree));
3837 extern tree most_general_template               PROTO((tree));
3838
3839 extern int processing_template_parmlist;
3840
3841 /* in repo.c */
3842 extern void repo_template_used                  PROTO((tree));
3843 extern void repo_template_instantiated          PROTO((tree, int));
3844 extern void init_repo                           PROTO((const char *));
3845 extern void finish_repo                         PROTO((void));
3846
3847 /* in rtti.c */
3848 extern void init_rtti_processing                PROTO((void));
3849 extern tree get_tinfo_fn_dynamic                PROTO((tree));
3850 extern tree build_typeid                        PROTO((tree));
3851 extern tree build_x_typeid                      PROTO((tree));
3852 extern tree get_tinfo_fn                        PROTO((tree));
3853 extern tree get_tinfo_fn_unused                 PROTO((tree));
3854 extern tree get_typeid                          PROTO((tree));
3855 extern tree get_typeid_1                        PROTO((tree));
3856 extern tree build_dynamic_cast                  PROTO((tree, tree));
3857 extern void synthesize_tinfo_fn                 PROTO((tree));
3858
3859 /* in search.c */
3860 extern int types_overlap_p                      PROTO((tree, tree));
3861 extern tree get_vbase                           PROTO((tree, tree));
3862 extern tree get_binfo                           PROTO((tree, tree, int));
3863 extern int get_base_distance                    PROTO((tree, tree, int, tree *));
3864 extern tree get_dynamic_cast_base_type          PROTO((tree, tree));
3865 extern int accessible_p                         PROTO((tree, tree));
3866 extern tree lookup_field                        PROTO((tree, tree, int, int));
3867 extern int lookup_fnfields_1                    PROTO((tree, tree));
3868 extern tree lookup_fnfields                     PROTO((tree, tree, int));
3869 extern tree lookup_member                       PROTO((tree, tree, int, int));
3870 extern tree lookup_nested_tag                   PROTO((tree, tree));
3871 extern tree get_matching_virtual                PROTO((tree, tree, int));
3872 extern tree get_abstract_virtuals               PROTO((tree));
3873 extern tree init_vbase_pointers                 PROTO((tree, tree));
3874 extern void expand_indirect_vtbls_init          PROTO((tree, tree, tree));
3875 extern void clear_search_slots                  PROTO((tree));
3876 extern tree get_vbase_types                     PROTO((tree));
3877 extern void maybe_suppress_debug_info           PROTO((tree));
3878 extern void note_debug_info_needed              PROTO((tree));
3879 extern void push_class_decls                    PROTO((tree));
3880 extern void pop_class_decls                     PROTO((void));
3881 extern void unuse_fields                        PROTO((tree));
3882 extern void print_search_statistics             PROTO((void));
3883 extern void init_search_processing              PROTO((void));
3884 extern void reinit_search_statistics            PROTO((void));
3885 extern tree current_scope                       PROTO((void));
3886 extern int at_function_scope_p                  PROTO((void));
3887 extern tree lookup_conversions                  PROTO((tree));
3888 extern tree binfo_for_vtable                    PROTO((tree));
3889 extern int  binfo_from_vbase                    PROTO((tree));
3890 extern tree dfs_walk                            PROTO((tree, 
3891                                                        tree (*)(tree, void *),
3892                                                        tree (*) (tree, void *),
3893                                                        void *));
3894 extern tree dfs_unmark                          PROTO((tree, void *));
3895 extern tree markedp                             PROTO((tree, void *));
3896
3897 /* in semantics.c */
3898 extern void finish_expr_stmt                    PROTO((tree));
3899 extern tree begin_if_stmt                       PROTO((void));
3900 extern void finish_if_stmt_cond                 PROTO((tree, tree));
3901 extern tree finish_then_clause                  PROTO((tree));
3902 extern void begin_else_clause                   PROTO((void));
3903 extern void finish_else_clause                  PROTO((tree));
3904 extern void finish_if_stmt                      PROTO((void));
3905 extern tree begin_while_stmt                    PROTO((void));
3906 extern void finish_while_stmt_cond              PROTO((tree, tree));
3907 extern void finish_while_stmt                   PROTO((tree));
3908 extern tree begin_do_stmt                       PROTO((void));
3909 extern void finish_do_body                      PROTO((tree));
3910 extern void finish_do_stmt                      PROTO((tree, tree));
3911 extern void finish_return_stmt                  PROTO((tree));
3912 extern tree begin_for_stmt                      PROTO((void));
3913 extern void finish_for_init_stmt                PROTO((tree));
3914 extern void finish_for_cond                     PROTO((tree, tree));
3915 extern void finish_for_expr                     PROTO((tree, tree));
3916 extern void finish_for_stmt                     PROTO((tree, tree));
3917 extern void finish_break_stmt                   PROTO((void));
3918 extern void finish_continue_stmt                PROTO((void));
3919 extern tree begin_switch_stmt                   PROTO((void));
3920 extern void finish_switch_cond                  PROTO((tree, tree));
3921 extern void finish_switch_stmt                  PROTO((tree, tree));
3922 extern void finish_case_label                   PROTO((tree, tree));
3923 extern void finish_goto_stmt                    PROTO((tree));
3924 extern tree begin_try_block                     PROTO((void));
3925 extern void finish_try_block                    PROTO((tree));
3926 extern void finish_handler_sequence             PROTO((tree));
3927 extern tree begin_function_try_block            PROTO((void));
3928 extern void finish_function_try_block           PROTO((tree));
3929 extern void finish_function_handler_sequence    PROTO((tree));
3930 extern void finish_cleanup_try_block            PROTO((tree));
3931 extern tree begin_handler                       PROTO((void));
3932 extern tree finish_handler_parms                PROTO((tree, tree));
3933 extern void begin_catch_block                   PROTO((tree));
3934 extern void finish_handler                      PROTO((tree, tree));
3935 extern void finish_cleanup                      PROTO((tree, tree));
3936 extern tree begin_compound_stmt                 PROTO((int));
3937 extern tree finish_compound_stmt                PROTO((int, tree));
3938 extern void finish_asm_stmt                     PROTO((tree, tree, tree, tree, tree));
3939 extern void finish_label_stmt                   PROTO((tree));
3940 extern void finish_label_decl                   PROTO((tree));
3941 extern void finish_subobject                    PROTO((tree));
3942 extern tree finish_parenthesized_expr           PROTO((tree));
3943 extern tree begin_stmt_expr                     PROTO((void));
3944 extern tree finish_stmt_expr                    PROTO((tree));
3945 extern tree finish_call_expr                    PROTO((tree, tree, int));
3946 extern tree finish_increment_expr               PROTO((tree, enum tree_code));
3947 extern tree finish_this_expr                    PROTO((void));
3948 extern tree finish_object_call_expr             PROTO((tree, tree, tree));
3949 extern tree finish_qualified_object_call_expr   PROTO((tree, tree, tree));
3950 extern tree finish_pseudo_destructor_call_expr  PROTO((tree, tree, tree));
3951 extern tree finish_qualified_call_expr          PROTO ((tree, tree));
3952 extern tree finish_label_address_expr           PROTO((tree));
3953 extern tree finish_unary_op_expr                PROTO((enum tree_code, tree));
3954 extern tree finish_id_expr                      PROTO((tree));
3955 extern int begin_function_definition            PROTO((tree, tree));
3956 extern tree begin_constructor_declarator        PROTO((tree, tree));
3957 extern tree finish_declarator                   PROTO((tree, tree, tree, tree, int));
3958 extern void finish_translation_unit             PROTO((void));
3959 extern tree finish_template_type_parm           PROTO((tree, tree));
3960 extern tree finish_template_template_parm       PROTO((tree, tree));
3961 extern tree finish_parmlist                     PROTO((tree, int));
3962 extern tree begin_class_definition              PROTO((tree));
3963 extern tree finish_class_definition             PROTO((tree, tree, int, int));
3964 extern void finish_default_args                 PROTO((void));
3965 extern void begin_inline_definitions            PROTO((void));
3966 extern void finish_inline_definitions           PROTO((void));
3967 extern tree finish_member_class_template        PROTO((tree));
3968 extern void finish_template_decl                PROTO((tree));
3969 extern tree finish_template_type                PROTO((tree, tree, int));
3970 extern void enter_scope_of                      PROTO((tree));
3971 extern tree finish_base_specifier               PROTO((tree, tree));
3972 extern void finish_member_declaration           PROTO((tree));
3973 extern void check_multiple_declarators          PROTO((void));
3974 extern tree finish_typeof                       PROTO((tree));
3975 extern void add_decl_stmt                       PROTO((tree));
3976 extern void finish_decl_cleanup                 PROTO((tree, tree));
3977 extern void finish_named_return_value           PROTO((tree, tree));
3978 extern tree expand_stmt                         PROTO((tree));
3979 extern void expand_body                         PROTO((tree));
3980 extern void begin_stmt_tree                     PROTO((tree *));
3981 extern void finish_stmt_tree                    PROTO((tree *));
3982 extern void prep_stmt                           PROTO((tree));
3983 extern tree add_scope_stmt                      PROTO((int, int));
3984 extern void do_pushlevel                        PROTO((void));
3985 extern tree do_poplevel                         PROTO((void));
3986 /* Non-zero if we are presently building a statement tree, rather
3987    than expanding each statement as we encounter it.  */
3988 #define building_stmt_tree() (last_tree != NULL_TREE)
3989
3990 /* in spew.c */
3991 extern void init_spew                           PROTO((void));
3992 extern int peekyylex                            PROTO((void));
3993 extern int yylex                                PROTO((void));
3994 extern tree arbitrate_lookup                    PROTO((tree, tree, tree));
3995
3996 /* in tree.c */
3997 extern void init_tree                           PROTO((void));
3998 extern int pod_type_p                           PROTO((tree));
3999 extern void unshare_base_binfos                 PROTO((tree));
4000 extern int member_p                             PROTO((tree));
4001 extern cp_lvalue_kind real_lvalue_p             PROTO((tree));
4002 extern tree build_min                           PVPROTO((enum tree_code, tree, ...));
4003 extern tree build_min_nt                        PVPROTO((enum tree_code, ...));
4004 extern int lvalue_p                             PROTO((tree));
4005 extern int lvalue_or_else                       PROTO((tree, const char *));
4006 extern tree build_cplus_new                     PROTO((tree, tree));
4007 extern tree get_target_expr                     PROTO((tree));
4008 extern tree break_out_cleanups                  PROTO((tree));
4009 extern tree break_out_calls                     PROTO((tree));
4010 extern tree build_cplus_method_type             PROTO((tree, tree, tree));
4011 extern tree build_cplus_staticfn_type           PROTO((tree, tree, tree));
4012 extern tree build_cplus_array_type              PROTO((tree, tree));
4013 extern int layout_basetypes                     PROTO((tree, int));
4014 extern tree build_vbase_pointer_fields          PROTO((tree));
4015 extern tree build_base_fields                   PROTO((tree));
4016 extern tree hash_tree_cons                      PROTO((tree, tree, tree));
4017 extern tree hash_tree_chain                     PROTO((tree, tree));
4018 extern tree hash_chainon                        PROTO((tree, tree));
4019 extern tree make_binfo                          PROTO((tree, tree, tree, tree));
4020 extern tree binfo_value                         PROTO((tree, tree));
4021 extern tree reverse_path                        PROTO((tree));
4022 extern int count_functions                      PROTO((tree));
4023 extern int is_overloaded_fn                     PROTO((tree));
4024 extern tree get_first_fn                        PROTO((tree));
4025 extern int bound_pmf_p                          PROTO((tree));
4026 extern tree ovl_cons                            PROTO((tree, tree));
4027 extern int ovl_member                           PROTO((tree, tree));
4028 extern tree build_overload                      PROTO((tree, tree));
4029 extern tree fnaddr_from_vtable_entry            PROTO((tree));
4030 extern tree function_arg_chain                  PROTO((tree));
4031 extern int promotes_to_aggr_type                PROTO((tree, enum tree_code));
4032 extern int is_aggr_type_2                       PROTO((tree, tree));
4033 extern const char *lang_printable_name          PROTO((tree, int));
4034 extern tree build_exception_variant             PROTO((tree, tree));
4035 extern tree copy_template_template_parm         PROTO((tree));
4036 extern void print_lang_statistics               PROTO((void));
4037 extern void __eprintf
4038         PROTO((const char *, const char *, unsigned, const char *));
4039 extern tree array_type_nelts_total              PROTO((tree));
4040 extern tree array_type_nelts_top                PROTO((tree));
4041 extern tree break_out_target_exprs              PROTO((tree));
4042 extern tree get_type_decl                       PROTO((tree));
4043 extern tree vec_binfo_member                    PROTO((tree, tree));
4044 extern tree hack_decl_function_context          PROTO((tree));
4045 extern tree decl_namespace_context              PROTO((tree));
4046 extern tree lvalue_type                         PROTO((tree));
4047 extern tree error_type                          PROTO((tree));
4048 extern tree build_ptr_wrapper                   PROTO((void *));
4049 extern tree build_expr_ptr_wrapper              PROTO((void *));
4050 extern tree build_int_wrapper                   PROTO((int));
4051 extern tree build_srcloc_here                   PROTO((void));
4052 extern int varargs_function_p                   PROTO((tree));
4053 extern int really_overloaded_fn                 PROTO((tree));
4054 extern int cp_tree_equal                        PROTO((tree, tree));
4055 extern int can_free                             PROTO((struct obstack *, tree));
4056 extern tree no_linkage_check                    PROTO((tree));
4057 extern void debug_binfo                         PROTO((tree));
4058 extern tree build_dummy_object                  PROTO((tree));
4059 extern tree maybe_dummy_object                  PROTO((tree, tree *));
4060 extern int is_dummy_object                      PROTO((tree));
4061 typedef tree (*walk_tree_fn)                    PROTO((tree *, int *, void *));
4062 extern tree walk_tree                           PROTO((tree *, walk_tree_fn, void *));
4063 extern tree copy_tree_r                         PROTO((tree *, int *, void *));
4064 extern int cp_valid_lang_attribute              PROTO((tree, tree, tree, tree));
4065 extern tree make_ptrmem_cst                     PROTO((tree, tree));
4066 extern tree cp_build_qualified_type_real        PROTO((tree, int, int));
4067 extern void remap_save_expr                     PROTO((tree *, splay_tree, tree, int *));
4068 #define cp_build_qualified_type(TYPE, QUALS) \
4069   cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1)
4070
4071 #define scratchalloc expralloc
4072 #define build_scratch_list build_expr_list
4073
4074 /* in typeck.c */
4075 extern int string_conv_p                        PROTO((tree, tree, int));
4076 extern tree condition_conversion                PROTO((tree));
4077 extern tree target_type                         PROTO((tree));
4078 extern tree require_complete_type               PROTO((tree));
4079 extern tree complete_type                       PROTO((tree));
4080 extern tree complete_type_or_else               PROTO((tree, tree));
4081 extern int type_unknown_p                       PROTO((tree));
4082 extern int fntype_p                             PROTO((tree));
4083 extern tree commonparms                         PROTO((tree, tree));
4084 extern tree original_type                       PROTO((tree));
4085 extern tree common_type                         PROTO((tree, tree));
4086 extern int comp_except_specs                    PROTO((tree, tree, int));
4087 extern int comptypes                            PROTO((tree, tree, int));
4088 extern int comp_target_types                    PROTO((tree, tree, int));
4089 extern int compparms                            PROTO((tree, tree));
4090 extern int comp_target_types                    PROTO((tree, tree, int));
4091 extern int comp_cv_qualification                PROTO((tree, tree));
4092 extern int comp_cv_qual_signature               PROTO((tree, tree));
4093 extern tree unsigned_type                       PROTO((tree));
4094 extern tree signed_type                         PROTO((tree));
4095 extern tree signed_or_unsigned_type             PROTO((int, tree));
4096 extern tree expr_sizeof                         PROTO((tree));
4097 extern tree c_sizeof                            PROTO((tree));
4098 extern tree c_sizeof_nowarn                     PROTO((tree));
4099 extern tree c_alignof                           PROTO((tree));
4100 extern tree inline_conversion                   PROTO((tree));
4101 extern tree decay_conversion                    PROTO((tree));
4102 extern tree default_conversion                  PROTO((tree));
4103 extern tree build_object_ref                    PROTO((tree, tree, tree));
4104 extern tree build_component_ref_1               PROTO((tree, tree, int));
4105 extern tree build_component_ref                 PROTO((tree, tree, tree, int));
4106 extern tree build_x_component_ref               PROTO((tree, tree, tree, int));
4107 extern tree build_x_indirect_ref                PROTO((tree, const char *));
4108 extern tree build_indirect_ref                  PROTO((tree, const char *));
4109 extern tree build_array_ref                     PROTO((tree, tree));
4110 extern tree build_x_function_call               PROTO((tree, tree, tree));
4111 extern tree get_member_function_from_ptrfunc    PROTO((tree *, tree));
4112 extern tree build_function_call_real            PROTO((tree, tree, int, int));
4113 extern tree build_function_call                 PROTO((tree, tree));
4114 extern tree build_function_call_maybe           PROTO((tree, tree));
4115 extern tree convert_arguments                   PROTO((tree, tree, tree, int));
4116 extern tree build_x_binary_op                   PROTO((enum tree_code, tree, tree));
4117 extern tree build_binary_op                     PROTO((enum tree_code, tree, tree));
4118 extern tree build_binary_op_nodefault           PROTO((enum tree_code, tree, tree, enum tree_code));
4119 extern tree build_x_unary_op                    PROTO((enum tree_code, tree));
4120 extern tree build_unary_op                      PROTO((enum tree_code, tree, int));
4121 extern tree unary_complex_lvalue                PROTO((enum tree_code, tree));
4122 extern int mark_addressable                     PROTO((tree));
4123 extern tree build_x_conditional_expr            PROTO((tree, tree, tree));
4124 extern tree build_conditional_expr              PROTO((tree, tree, tree));
4125 extern tree build_x_compound_expr               PROTO((tree));
4126 extern tree build_compound_expr                 PROTO((tree));
4127 extern tree build_static_cast                   PROTO((tree, tree));
4128 extern tree build_reinterpret_cast              PROTO((tree, tree));
4129 extern tree build_const_cast                    PROTO((tree, tree));
4130 extern tree build_c_cast                        PROTO((tree, tree));
4131 extern tree build_x_modify_expr                 PROTO((tree, enum tree_code, tree));
4132 extern tree build_modify_expr                   PROTO((tree, enum tree_code, tree));
4133 extern tree convert_for_initialization          PROTO((tree, tree, tree, int, const char *, tree, int));
4134 extern void c_expand_asm_operands               PROTO((tree, tree, tree, tree, int, char *, int));
4135 extern void c_expand_return                     PROTO((tree));
4136 extern tree c_expand_start_case                 PROTO((tree));
4137 extern int comp_ptr_ttypes                      PROTO((tree, tree));
4138 extern int ptr_reasonably_similar               PROTO((tree, tree));
4139 extern tree build_ptrmemfunc                    PROTO((tree, tree, int));
4140 extern tree strip_array_types                   PROTO((tree));
4141 extern int cp_type_quals                        PROTO((tree));
4142 extern int cp_has_mutable_p                     PROTO((tree));
4143 extern int at_least_as_qualified_p              PROTO((tree, tree));
4144 extern int more_qualified_p                     PROTO((tree, tree));
4145 extern tree build_ptrmemfunc1                   PROTO((tree, tree, tree, tree, tree));
4146 extern void expand_ptrmemfunc_cst               PROTO((tree, tree *, tree *, tree *, tree *));
4147 extern tree delta2_from_ptrmemfunc              PROTO((tree));
4148 extern tree pfn_from_ptrmemfunc                 PROTO((tree));
4149 extern tree type_after_usual_arithmetic_conversions PROTO((tree, tree));
4150 extern tree composite_pointer_type              PROTO((tree, tree, tree, tree,
4151                                                        const char*));
4152 extern tree check_return_expr                   PROTO((tree));
4153
4154 /* in typeck2.c */
4155 extern tree error_not_base_type                 PROTO((tree, tree));
4156 extern tree binfo_or_else                       PROTO((tree, tree));
4157 extern void readonly_error                      PROTO((tree, const char *, int));
4158 extern int abstract_virtuals_error              PROTO((tree, tree));
4159 extern void incomplete_type_error               PROTO((tree, tree));
4160 extern void my_friendly_abort                   PROTO((int))
4161   ATTRIBUTE_NORETURN;
4162 extern void my_friendly_assert                  PROTO((int, int));
4163 extern tree store_init_value                    PROTO((tree, tree));
4164 extern tree digest_init                         PROTO((tree, tree, tree *));
4165 extern tree build_scoped_ref                    PROTO((tree, tree));
4166 extern tree build_x_arrow                       PROTO((tree));
4167 extern tree build_m_component_ref               PROTO((tree, tree));
4168 extern tree build_functional_cast               PROTO((tree, tree));
4169 extern char *enum_name_string                   PROTO((tree, tree));
4170 extern void report_case_error                   PROTO((int, tree, tree, tree));
4171 extern void check_for_new_type                  PROTO((const char *, flagged_type_tree));
4172 extern tree add_exception_specifier             PROTO((tree, tree, int));
4173
4174 /* in xref.c */
4175 extern void GNU_xref_begin                      PROTO((const char *));
4176 extern void GNU_xref_end                        PROTO((int));
4177 extern void GNU_xref_file                       PROTO((const char *));
4178 extern void GNU_xref_start_scope                PROTO((HOST_WIDE_INT));
4179 extern void GNU_xref_end_scope                  PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
4180 extern void GNU_xref_ref                        PROTO((tree, const char *));
4181 extern void GNU_xref_decl                       PROTO((tree, tree));
4182 extern void GNU_xref_call                       PROTO((tree, const char *));
4183 extern void GNU_xref_function                   PROTO((tree, tree));
4184 extern void GNU_xref_assign                     PROTO((tree));
4185 extern void GNU_xref_hier                       PROTO((tree, tree, int, int, int));
4186 extern void GNU_xref_member                     PROTO((tree, tree));
4187
4188 /* in dump.c */
4189 extern void dump_node_to_file                   PROTO ((tree, const char *));
4190
4191 /* -- end of C++ */
4192
4193 #endif /* not _CP_TREE_H */