OSDN Git Service

* cp-tree.h (specializations_of_same_template_p): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-tree.h
1 /* Definitions for C++ parsing and type checking.
2    Copyright (C) 1987, 93, 94, 95, 1996 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 #ifndef _CP_TREE_H
23 #define _CP_TREE_H
24
25 #include "gansidecl.h"
26
27 /* Usage of TREE_LANG_FLAG_?:
28    0: TREE_NONLOCAL_FLAG (in TREE_LIST or _TYPE).
29       BINFO_MARKED (BINFO nodes).
30       COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
31       NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
32       DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
33       LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
34       TREE_NEGATED_INT (in INTEGER_CST).
35       (TREE_MANGLED) (in IDENTIFIER_NODE) (commented-out).
36    1:  IDENTIFIER_VIRTUAL_P.
37       TI_PENDING_TEMPLATE_FLAG.
38       TEMPLATE_PARMS_FOR_INLINE.
39       DELETE_EXPR_USE_VEC (in DELETE_EXPR).
40       (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
41       TYPE_USES_COMPLEX_INHERITANCE (in _TYPE).
42       C_DECLARED_LABEL_FLAG.
43    2: IDENTIFIER_OPNAME_P.
44       BINFO_VBASE_MARKED.
45       BINFO_FIELDS_MARKED.
46       TYPE_VIRTUAL_P.
47       PARM_DECL_EXPR (in SAVE_EXPR).
48    3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
49       BINFO_VTABLE_PATH_MARKED.
50       BINFO_PUSHDECLS_MARKED.
51       (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
52    4: BINFO_NEW_VTABLE_MARKED.
53       TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
54           or FIELD_DECL).
55    5: Not used.
56    6: Not used.
57
58    Usage of TYPE_LANG_FLAG_?:
59    0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
60    1: TYPE_HAS_CONSTRUCTOR.
61    2: TYPE_HAS_DESTRUCTOR.
62    3: TYPE_FOR_JAVA.
63    4: TYPE_NEEDS_DESTRUCTOR.
64    5: IS_AGGR_TYPE.
65    6: TYPE_BUILT_IN.
66
67    Usage of DECL_LANG_FLAG_?:
68    0: DECL_ERROR_REPORTED (in VAR_DECL).
69    1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
70    2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
71    3: DECL_IN_AGGR_P.
72    4: DECL_MAYBE_TEMPLATE.
73    5: DECL_INTERFACE_KNOWN.
74    6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
75    7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
76 */
77
78 /* Language-dependent contents of an identifier.  */
79
80 struct lang_identifier
81 {
82   struct tree_identifier ignore;
83   tree namespace_bindings, local_value;
84   tree class_value;
85   tree class_template_info;
86   struct lang_id2 *x;
87 };
88
89 struct lang_id2
90 {
91   tree label_value, implicit_decl;
92   tree type_desc, as_list, error_locus;
93 };
94
95 typedef struct 
96 {
97   tree t;
98   int new_type_flag;
99 } flagged_type_tree;
100
101 typedef struct 
102 {
103   char common[sizeof (struct tree_common)];
104   struct rtx_def *rtl;  /* Unused, but required to match up with what
105                            the middle-end expects.  */
106   HOST_WIDE_INT index;
107   HOST_WIDE_INT level;
108   HOST_WIDE_INT orig_level;
109   tree decl;
110 } template_parm_index;
111
112 typedef struct ptrmem_cst
113 {
114   char common[sizeof (struct tree_common)];
115   tree member;
116 }* ptrmem_cst_t;
117
118 /* For a binding between a name and an entity, defines the scope
119    where the binding is declared. Currently always points to a
120    namespace declaration.  */
121 #define BINDING_SCOPE(NODE)    (((struct tree_binding*)NODE)->scope)
122 /* This is the declaration bound to the name. Possible values:
123    variable, overloaded function, namespace, template, enumerator.  */
124 #define BINDING_VALUE(NODE)    (((struct tree_binding*)NODE)->value)
125 /* If name is bound to a type, this is the type (struct, union, enum).  */
126 #define BINDING_TYPE(NODE)     TREE_TYPE(NODE)
127 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
128   namespace_binding (NODE, global_namespace)
129 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
130   set_namespace_binding (NODE, global_namespace, VAL)
131 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
132   namespace_binding (NODE, current_namespace)
133 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
134   set_namespace_binding (NODE, current_namespace, VAL)
135
136 struct tree_binding
137 {
138   char common[sizeof (struct tree_common)];
139   tree scope;
140   tree value;
141 };
142
143 /* The overloaded FUNCTION_DECL. */
144 #define OVL_FUNCTION(NODE)   (((struct tree_overload*)NODE)->function)
145 #define OVL_CHAIN(NODE)      TREE_CHAIN(NODE)
146 /* Polymorphic access to FUNCTION and CHAIN. */
147 #define OVL_CURRENT(NODE)     \
148   ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
149 #define OVL_NEXT(NODE)        \
150   ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
151 /* If set, this was imported in a using declaration.
152    This is not to confuse with being used somewhere, which
153    is not important for this node. */
154 #define OVL_USED(NODE)        TREE_USED(NODE)
155
156 struct tree_overload
157 {
158   char common[sizeof (struct tree_common)];
159   tree function;
160 };
161
162 #define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr)
163 #define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i)
164
165 struct tree_wrapper
166 {
167   char common[sizeof (struct tree_common)];
168   union {
169     void *ptr;
170     int i;
171   } u;
172 };
173
174 #define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename)
175 #define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum)
176 struct tree_srcloc
177 {
178   char common[sizeof (struct tree_common)];
179   char *filename;
180   int linenum;
181 };
182
183 /* To identify to the debug emitters if it should pay attention to the
184    flag `-Wtemplate-debugging'.  */
185 #define HAVE_TEMPLATES 1
186
187 /* Macros for access to language-specific slots in an identifier.  */
188
189 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE)     \
190   (((struct lang_identifier *)(NODE))->namespace_bindings)
191 #define IDENTIFIER_CLASS_VALUE(NODE)    \
192   (((struct lang_identifier *)(NODE))->class_value)
193 #define IDENTIFIER_LOCAL_VALUE(NODE)    \
194   (((struct lang_identifier *)(NODE))->local_value)
195 #define IDENTIFIER_TEMPLATE(NODE)       \
196   (((struct lang_identifier *)(NODE))->class_template_info)
197
198 /* TREE_TYPE only indicates on local and class scope the current
199    type. For namespace scope, the presence of a type in any namespace
200    is indicated with global_type_node, and the real type behind must
201    be found through lookup. */
202 #define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
203 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
204 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
205 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
206
207 #define LANG_ID_FIELD(NAME,NODE) \
208   (((struct lang_identifier *)(NODE))->x \
209    ? ((struct lang_identifier *)(NODE))->x->NAME : 0)
210 #define SET_LANG_ID(NODE,VALUE,NAME) \
211   (((struct lang_identifier *)(NODE))->x == 0                               \
212    ? ((struct lang_identifier *)(NODE))->x                                  \
213       = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0,   \
214    ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))
215
216 #define IDENTIFIER_LABEL_VALUE(NODE)        LANG_ID_FIELD(label_value, NODE)
217 #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE)   \
218         SET_LANG_ID(NODE, VALUE, label_value)
219
220 #define IDENTIFIER_IMPLICIT_DECL(NODE)      LANG_ID_FIELD(implicit_decl, NODE)
221 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
222         SET_LANG_ID(NODE, VALUE, implicit_decl)
223
224 #define IDENTIFIER_AS_DESC(NODE)            LANG_ID_FIELD(type_desc, NODE)
225 #define SET_IDENTIFIER_AS_DESC(NODE,DESC)       \
226         SET_LANG_ID(NODE, DESC, type_desc)
227
228 #define IDENTIFIER_AS_LIST(NODE)            LANG_ID_FIELD(as_list, NODE)
229 #define SET_IDENTIFIER_AS_LIST(NODE,LIST)       \
230         SET_LANG_ID(NODE, LIST, as_list)
231
232 #define IDENTIFIER_ERROR_LOCUS(NODE)        LANG_ID_FIELD(error_locus, NODE)
233 #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE)  \
234         SET_LANG_ID(NODE, VALUE, error_locus)
235
236
237 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
238
239 /* Nonzero if this identifier is the prefix for a mangled C++ operator name.  */
240 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
241
242 #define IDENTIFIER_TYPENAME_P(NODE)     \
243   (! strncmp (IDENTIFIER_POINTER (NODE),                        \
244               IDENTIFIER_POINTER (ansi_opname[(int) TYPE_EXPR]),        \
245               IDENTIFIER_LENGTH (ansi_opname[(int) TYPE_EXPR])))
246
247 /* Nonzero means reject anything that ANSI standard C forbids.  */
248 extern int pedantic;
249
250 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
251 #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
252
253 /* Record in each node resulting from a binary operator
254    what operator was specified for it.  */
255 #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
256
257 /* Store a value in that field.  */
258 #define C_SET_EXP_ORIGINAL_CODE(exp, code) \
259   (TREE_COMPLEXITY (exp) = (int)(code))
260 \f
261 /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
262    next exception handler.  */
263 extern tree exception_throw_decl;
264
265 extern tree double_type_node, long_double_type_node, float_type_node;
266 extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
267 extern tree ptrdiff_type_node;
268
269 extern tree short_integer_type_node, short_unsigned_type_node;
270 extern tree long_integer_type_node, long_unsigned_type_node;
271 extern tree long_long_integer_type_node, long_long_unsigned_type_node;
272 extern tree unsigned_type_node;
273 extern tree string_type_node, char_array_type_node, int_array_type_node;
274 extern tree wchar_array_type_node;
275 extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
276
277 extern tree complex_integer_type_node;
278 extern tree complex_float_type_node;
279 extern tree complex_double_type_node;
280 extern tree complex_long_double_type_node;
281
282 extern tree intQI_type_node, unsigned_intQI_type_node;
283 extern tree intHI_type_node, unsigned_intHI_type_node;
284 extern tree intSI_type_node, unsigned_intSI_type_node;
285 extern tree intDI_type_node, unsigned_intDI_type_node;
286 #if HOST_BITS_PER_WIDE_INT >= 64
287 extern tree intTI_type_node, unsigned_intTI_type_node;
288 #endif
289
290 extern tree java_byte_type_node;
291 extern tree java_short_type_node;
292 extern tree java_int_type_node;
293 extern tree java_long_type_node;
294 extern tree java_float_type_node;
295 extern tree java_double_type_node;
296 extern tree java_char_type_node;
297 extern tree java_boolean_type_node;
298
299 extern int current_function_returns_value;
300 extern int current_function_returns_null;
301 extern tree current_function_return_value;
302
303 extern tree current_namespace;
304 extern tree global_namespace;
305
306 extern tree ridpointers[];
307 extern tree ansi_opname[];
308 extern tree ansi_assopname[];
309
310 /* Nonzero means `$' can be in an identifier.  */
311
312 extern int dollars_in_ident;
313
314 /* Nonzero means allow type mismatches in conditional expressions;
315    just make their values `void'.   */
316
317 extern int flag_cond_mismatch;
318
319 /* Nonzero means don't recognize the keyword `asm'.  */
320
321 extern int flag_no_asm;
322
323 /* For cross referencing.  */
324
325 extern int flag_gnu_xref;
326
327 /* For environments where you can use GNU binutils (as, ld in particular).  */
328
329 extern int flag_gnu_binutils;
330
331 /* Nonzero means ignore `#ident' directives.  */
332
333 extern int flag_no_ident;
334
335 /* Nonzero means warn about implicit declarations.  */
336
337 extern int warn_implicit;
338
339 /* Nonzero means warn about usage of long long when `-pedantic'.  */
340
341 extern int warn_long_long;
342
343 /* Nonzero means warn when all ctors or dtors are private, and the class
344    has no friends.  */
345
346 extern int warn_ctor_dtor_privacy;
347
348 /* Nonzero means warn about function definitions that default the return type
349    or that use a null return and have a return-type other than void.  */
350
351 extern int warn_return_type;
352
353 /* Nonzero means give string constants the type `const char *', as mandated
354    by the standard.  */
355
356 extern int flag_const_strings;
357
358 /* Nonzero means warn about deprecated conversion from string constant to
359    `char *'.  */
360
361 extern int warn_write_strings;
362
363 /* Nonzero means warn about sizeof(function) or addition/subtraction
364    of function pointers.  */
365
366 extern int warn_pointer_arith;
367
368 /* Nonzero means warn about suggesting putting in ()'s.  */
369
370 extern int warn_parentheses;
371
372 /* Nonzero means warn about multiple (redundant) decls for the same single
373    variable or function.  */
374
375 extern int warn_redundant_decls;
376
377 /* Warn if initializer is not completely bracketed.  */
378
379 extern int warn_missing_braces;
380
381 /* Warn about comparison of signed and unsigned values.  */
382
383 extern int warn_sign_compare;
384
385 /* Warn about a subscript that has type char.  */
386
387 extern int warn_char_subscripts;
388
389 /* Nonzero means warn about pointer casts that can drop a type qualifier
390    from the pointer target type.  */
391
392 extern int warn_cast_qual;
393
394 /* Warn about *printf or *scanf format/argument anomalies.  */
395
396 extern int warn_format;
397
398 /* Nonzero means warn about non virtual destructors in classes that have
399    virtual functions.  */
400
401 extern int warn_nonvdtor;
402
403 /* Non-zero means warn when we convert a pointer to member function
404    into a pointer to (void or function).  */
405
406 extern int warn_pmf2ptr;
407
408 /* Nonzero means warn about violation of some Effective C++ style rules.  */
409
410 extern int warn_ecpp;
411
412 /* Nonzero means warn where overload resolution chooses a promotion from
413    unsigned to signed over a conversion to an unsigned of the same size.  */
414
415 extern int warn_sign_promo;
416
417 /* Non-zero means warn when a function is declared extern and later inline.  */
418
419 extern int warn_extern_inline;
420
421 /* Non-zero means warn when an old-style cast is used.  */
422
423 extern int warn_old_style_cast;
424
425 /* Nonzero means to treat bitfields as unsigned unless they say `signed'.  */
426
427 extern int flag_signed_bitfields;
428
429 /* 3 means write out only virtuals function tables `defined'
430    in this implementation file.
431    2 means write out only specific virtual function tables
432    and give them (C) public access.
433    1 means write out virtual function tables and give them
434    (C) public access.
435    0 means write out virtual function tables and give them
436    (C) static access (default).
437    -1 means declare virtual function tables extern.  */
438
439 extern int write_virtuals;
440
441 /* True for more efficient but incompatible (not fully tested)
442    vtable implementation (using thunks).
443    0 is old behavior; 1 is new behavior.  */
444 extern int flag_vtable_thunks;
445
446 /* INTERFACE_ONLY nonzero means that we are in an "interface"
447    section of the compiler.  INTERFACE_UNKNOWN nonzero means
448    we cannot trust the value of INTERFACE_ONLY.  If INTERFACE_UNKNOWN
449    is zero and INTERFACE_ONLY is zero, it means that we are responsible
450    for exporting definitions that others might need.  */
451 extern int interface_only, interface_unknown;
452
453 /* Nonzero means we should attempt to elide constructors when possible.  */
454
455 extern int flag_elide_constructors;
456
457 /* Nonzero means enable obscure ANSI features and disable GNU extensions
458    that might cause ANSI-compliant code to be miscompiled.  */
459
460 extern int flag_ansi;
461
462 /* Nonzero means recognize and handle signature language constructs.  */
463
464 extern int flag_handle_signatures;
465
466 /* Nonzero means that member functions defined in class scope are
467    inline by default.  */
468
469 extern int flag_default_inline;
470
471 /* The name-mangling scheme to use.  Versions of gcc before 2.8 use
472    version 0.  */
473 extern int name_mangling_version;
474
475 /* Nonzero means that guiding declarations are allowed.  */
476 extern int flag_guiding_decls;
477
478 /* Nonzero if squashed mangling is to be performed. 
479    This uses the B and K codes to reference previously seen class types 
480    and class qualifiers.       */
481 extern int flag_do_squangling;
482
483 /* Nonzero if we want to issue diagnostics that the standard says are not
484    required.  */
485 extern int flag_optional_diags;
486
487 /* Nonzero means do not consider empty argument prototype to mean function
488    takes no arguments.  */
489
490 extern int flag_strict_prototype;
491
492 /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc.  */
493 extern int flag_vtable_gc;
494 \f
495 /* C++ language-specific tree codes.  */
496 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
497 enum cplus_tree_code {
498   __DUMMY = LAST_AND_UNUSED_TREE_CODE,
499 #include "cp-tree.def"
500   LAST_CPLUS_TREE_CODE
501 };
502 #undef DEFTREECODE
503
504 enum languages { lang_c, lang_cplusplus, lang_java };
505
506 /* Macros to make error reporting functions' lives easier.  */
507 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
508 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
509 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
510
511 #define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME  (NODE))))
512 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
513
514 /* The _DECL for this _TYPE.  */
515 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
516
517 /* Nonzero if T is a class (or struct or union) type.  Also nonzero
518    for template type parameters and typename types.  Despite its name,
519    this macro has nothing to do with the definition of aggregate given
520    in the standard.  Think of this macro as MAYBE_CLASS_TYPE_P.  */
521 #define IS_AGGR_TYPE(t)         (TYPE_LANG_FLAG_5 (t))
522
523 /* Nonzero if T is a class type.  Zero for template type parameters,
524    typename types, and so forth.  */
525 #define CLASS_TYPE_P(t) \
526   (IS_AGGR_TYPE (t) && IS_AGGR_TYPE_CODE (TREE_CODE (t)))
527
528 #define IS_AGGR_TYPE_CODE(t)    (t == RECORD_TYPE || t == UNION_TYPE)
529 #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
530   (TREE_CODE (TYPE1) == TREE_CODE (TYPE2)       \
531    && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
532 #define IS_OVERLOAD_TYPE(t) \
533   (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
534
535 /* In a *_TYPE, nonzero means a built-in type.  */
536 #define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
537
538 /* True if this a "Java" type, defined in 'extern "Java"'. */
539 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
540
541 #define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
542   (!flag_vtable_thunks ? \
543      TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
544    : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
545    : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
546
547 /* Virtual function addresses can be gotten from a virtual function
548    table entry using this macro.  */
549 #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
550   (!flag_vtable_thunks ? \
551      TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
552    : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
553    : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
554 #define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
555   (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
556 #define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
557 #define PROMOTES_TO_AGGR_TYPE(NODE,CODE)        \
558   (((CODE) == TREE_CODE (NODE)                  \
559        && IS_AGGR_TYPE (TREE_TYPE (NODE)))      \
560    || IS_AGGR_TYPE (NODE))
561
562 /* Nonzero iff TYPE is uniquely derived from PARENT.  Under MI, PARENT can
563    be an ambiguous base class of TYPE, and this macro will be false.  */
564 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
565 #define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
566 #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
567 #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
568 \f
569 /* Statistics show that while the GNU C++ compiler may generate
570    thousands of different types during a compilation run, it
571    generates relatively few (tens) of classtypes.  Because of this,
572    it is not costly to store a generous amount of information
573    in classtype nodes.  This struct must fill out to a multiple of 4 bytes.  */
574 struct lang_type
575 {
576   struct
577     {
578       unsigned has_type_conversion : 1;
579       unsigned has_init_ref : 1;
580       unsigned has_assignment : 1;
581       unsigned has_default_ctor : 1;
582       unsigned uses_multiple_inheritance : 1;
583       unsigned const_needs_init : 1;
584       unsigned ref_needs_init : 1;
585       unsigned has_const_assign_ref : 1;
586
587       unsigned has_nonpublic_ctor : 2;
588       unsigned has_nonpublic_assign_ref : 2;
589       unsigned vtable_needs_writing : 1;
590       unsigned has_assign_ref : 1;
591       unsigned gets_new : 2;
592
593       unsigned gets_delete : 2;
594       unsigned has_call_overloaded : 1;
595       unsigned has_array_ref_overloaded : 1;
596       unsigned has_arrow_overloaded : 1;
597       unsigned interface_only : 1;
598       unsigned interface_unknown : 1;
599
600       unsigned needs_virtual_reinit : 1;
601       unsigned vec_delete_takes_size : 1;
602       unsigned declared_class : 1;
603       unsigned being_defined : 1;
604       unsigned redefined : 1;
605       unsigned marked : 1;
606       unsigned marked2 : 1;
607       unsigned marked3 : 1;
608
609       unsigned marked4 : 1;
610       unsigned marked5 : 1;
611       unsigned marked6 : 1;
612       unsigned debug_requested : 1;
613       unsigned use_template : 2;
614       unsigned got_semicolon : 1;
615       unsigned ptrmemfunc_flag : 1;
616
617       unsigned is_signature : 1;
618       unsigned is_signature_pointer : 1;
619       unsigned is_signature_reference : 1;
620       unsigned has_opaque_typedecls : 1;
621       unsigned sigtable_has_been_generated : 1;
622       unsigned was_anonymous : 1;
623       unsigned has_real_assignment : 1;
624       unsigned has_real_assign_ref : 1;
625
626       unsigned has_const_init_ref : 1;
627       unsigned has_complex_init_ref : 1;
628       unsigned has_complex_assign_ref : 1;
629       unsigned has_abstract_assign_ref : 1;
630       unsigned non_aggregate : 1;
631
632       /* The MIPS compiler gets it wrong if this struct also
633          does not fill out to a multiple of 4 bytes.  Add a
634          member `dummy' with new bits if you go over the edge.  */
635       unsigned dummy : 12;
636     } type_flags;
637
638   int n_ancestors;
639   int n_vancestors;
640   int vsize;
641   int max_depth;
642   int vfield_parent;
643
644   union tree_node *baselink_vec;
645   union tree_node *vfields;
646   union tree_node *vbases;
647
648   union tree_node *tags;
649
650   union tree_node *search_slot;
651
652   unsigned char align;
653   /* Room for another three unsigned chars.  */
654
655   union tree_node *size;
656
657   union tree_node *base_init_list;
658   union tree_node *abstract_virtuals;
659   union tree_node *as_list;
660   union tree_node *id_as_list;
661   union tree_node *binfo_as_list;
662   union tree_node *friend_classes;
663
664   union tree_node *rtti;
665
666   union tree_node *methods;
667
668   union tree_node *signature;
669   union tree_node *signature_pointer_to;
670   union tree_node *signature_reference_to;
671
672   union tree_node *template_info;
673
674   int linenum;
675 };
676
677 #define CLASSTYPE_SOURCE_LINE(NODE) (TYPE_LANG_SPECIFIC(NODE)->linenum)
678
679 /* Indicates whether or not (and how) a template was expanded for this class.
680      0=no information yet/non-template class
681      1=implicit template instantiation
682      2=explicit template specialization
683      3=explicit template instantiation  */
684 #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
685
686 /* Fields used for storing information before the class is defined.
687    After the class is defined, these fields hold other information.  */
688
689 /* List of friends which were defined inline in this class definition.  */
690 #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
691
692 /* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
693    a special meaning for the assignment operator ("operator="),
694    or one of its fields (or base members) has a special meaning
695    defined.  */
696 #define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
697 #define TYPE_HAS_REAL_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assignment)
698
699 /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
700    respectively.  */
701 #define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
702 #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
703 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
704
705 /* Nonzero for _CLASSTYPE means that operator vec delete is defined and
706    takes the optional size_t argument.  */
707 #define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
708   (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size)
709 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
710   (TYPE_NEEDS_DESTRUCTOR (NODE) \
711    || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
712
713 /* Nonzero for TREE_LIST or _TYPE node means that this node is class-local.  */
714 #define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
715
716 /* Nonzero means that this _CLASSTYPE node defines ways of converting
717    itself to other types.  */
718 #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
719
720 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
721 #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
722 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
723
724 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor.  */
725 #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
726 #define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
727
728 /* Nonzero means that this type is being defined.  I.e., the left brace
729    starting the definition of this type has been seen.  */
730 #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
731 /* Nonzero means that this type has been redefined.  In this case, if
732    convenient, don't reprocess any methods that appear in its redefinition.  */
733 #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
734
735 /* Nonzero means that this type is a signature.  */
736 # define IS_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)?TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature:0)
737 # define SET_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=1)
738 # define CLEAR_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=0)
739
740 /* Nonzero means that this type is a signature pointer type.  */
741 # define IS_SIGNATURE_POINTER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_pointer)
742
743 /* Nonzero means that this type is a signature reference type.  */
744 # define IS_SIGNATURE_REFERENCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_reference)
745
746 /* Nonzero means that this signature contains opaque type declarations.  */
747 #define SIGNATURE_HAS_OPAQUE_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_opaque_typedecls)
748
749 /* Nonzero means that a signature table has been generated
750    for this signature.  */
751 #define SIGTABLE_HAS_BEEN_GENERATED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.sigtable_has_been_generated)
752
753 /* If NODE is a class, this is the signature type that contains NODE's
754    signature after it has been computed using sigof().  */
755 #define CLASSTYPE_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
756
757 /* If NODE is a signature pointer or signature reference, this is the
758    signature type the pointer/reference points to.  */
759 #define SIGNATURE_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
760
761 /* If NODE is a signature, this is a vector of all methods defined
762    in the signature or in its base types together with their default
763    implementations.  */
764 #define SIGNATURE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
765
766 /* If NODE is a signature, this is the _TYPE node that contains NODE's
767    signature pointer type.  */
768 #define SIGNATURE_POINTER_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_pointer_to)
769
770 /* If NODE is a signature, this is the _TYPE node that contains NODE's
771    signature reference type.  */
772 #define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to)
773
774 /* The is the VAR_DECL that contains NODE's rtti.  */
775 #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
776
777 /* Nonzero means that this _CLASSTYPE node overloads operator().  */
778 #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
779
780 /* Nonzero means that this _CLASSTYPE node overloads operator[].  */
781 #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
782
783 /* Nonzero means that this _CLASSTYPE node overloads operator->.  */
784 #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
785
786 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
787    multiple inheritance.  If this is 0 for the root of a type
788    hierarchy, then we can use more efficient search techniques.  */
789 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
790
791 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
792    virtual base classes.  If this is 0 for the root of a type
793    hierarchy, then we can use more efficient search techniques.  */
794 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
795
796 /* Vector member functions defined in this class.  Each element is
797    either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD.  The first
798    two elements are for constructors, and destructors, respectively.
799    Any user-defined conversion operators follow these.  These are
800    followed by ordinary member functions.  There may be empty entries
801    at the end of the vector.  */
802 #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
803
804 /* The first type conversion operator in the class (the others can be
805    searched with TREE_CHAIN), or the first non-constructor function if
806    there are no type conversion operators.  */
807 #define CLASSTYPE_FIRST_CONVERSION(NODE) \
808   TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
809     ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
810     : NULL_TREE;
811
812 /* Pointer from any member function to the head of the list of
813    member functions of the type that member function belongs to.  */
814 #define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
815
816 /* Mark bits for depth-first and breath-first searches.  */
817 #define CLASSTYPE_MARKED(NODE)  (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
818 #define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
819 #define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
820 #define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
821 #define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
822 #define CLASSTYPE_MARKED6(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
823 /* Macros to modify the above flags */
824 #define SET_CLASSTYPE_MARKED(NODE)      (CLASSTYPE_MARKED(NODE) = 1)
825 #define CLEAR_CLASSTYPE_MARKED(NODE)    (CLASSTYPE_MARKED(NODE) = 0)
826 #define SET_CLASSTYPE_MARKED2(NODE)     (CLASSTYPE_MARKED2(NODE) = 1)
827 #define CLEAR_CLASSTYPE_MARKED2(NODE)   (CLASSTYPE_MARKED2(NODE) = 0)
828 #define SET_CLASSTYPE_MARKED3(NODE)     (CLASSTYPE_MARKED3(NODE) = 1)
829 #define CLEAR_CLASSTYPE_MARKED3(NODE)   (CLASSTYPE_MARKED3(NODE) = 0)
830 #define SET_CLASSTYPE_MARKED4(NODE)     (CLASSTYPE_MARKED4(NODE) = 1)
831 #define CLEAR_CLASSTYPE_MARKED4(NODE)   (CLASSTYPE_MARKED4(NODE) = 0)
832 #define SET_CLASSTYPE_MARKED5(NODE)     (CLASSTYPE_MARKED5(NODE) = 1)
833 #define CLEAR_CLASSTYPE_MARKED5(NODE)   (CLASSTYPE_MARKED5(NODE) = 0)
834 #define SET_CLASSTYPE_MARKED6(NODE)     (CLASSTYPE_MARKED6(NODE) = 1)
835 #define CLEAR_CLASSTYPE_MARKED6(NODE)   (CLASSTYPE_MARKED6(NODE) = 0)
836
837 /* A list of the nested tag-types (class, struct, union, or enum)
838    found within this class.  The TREE_PURPOSE of each node is the name
839    of the type; the TREE_VALUE is the type itself.  This list includes
840    nested member class templates.  */
841 #define CLASSTYPE_TAGS(NODE)            (TYPE_LANG_SPECIFIC(NODE)->tags)
842
843 /* If this class has any bases, this is the number of the base class from
844    which our VFIELD is based, -1 otherwise.  If this class has no base
845    classes, this is not used.
846    In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
847    1, if D's vtable came from B2.  */
848 #define CLASSTYPE_VFIELD_PARENT(NODE)   (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
849
850 /* Remove when done merging.  */
851 #define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
852
853 /* The number of virtual functions defined for this
854    _CLASSTYPE node.  */
855 #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
856 /* The virtual base classes that this type uses.  */
857 #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
858 /* The virtual function pointer fields that this type contains.  */
859 #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
860
861 /* Number of baseclasses defined for this type.
862    0 means no base classes.  */
863 #define CLASSTYPE_N_BASECLASSES(NODE) \
864   (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
865
866 /* Memoize the number of super classes (base classes) that this node
867    has.  That way we can know immediately (albeit conservatively how
868    large a multiple-inheritance matrix we need to build to find
869    derivation information.  */
870 #define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
871 #define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_vancestors)
872
873 /* Record how deep the inheritance is for this class so `void*' conversions
874    are less favorable than a conversion to the most base type.  */
875 #define CLASSTYPE_MAX_DEPTH(NODE) (TYPE_LANG_SPECIFIC(NODE)->max_depth)
876
877 /* Used for keeping search-specific information.  Any search routine
878    which uses this must define what exactly this slot is used for.  */
879 #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
880
881 /* These are the size, mode and alignment of the type without its
882    virtual base classes, for when we use this type as a base itself.  */
883 #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
884 #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
885
886 /* A cons list of structure elements which either have constructors
887    to be called, or virtual function table pointers which
888    need initializing.  Depending on what is being initialized,
889    the TREE_PURPOSE and TREE_VALUE fields have different meanings:
890
891    Member initialization: <FIELD_DECL, TYPE>
892    Base class construction: <NULL_TREE, BASETYPE>
893    Base class initialization: <BASE_INITIALIZATION, THESE_INITIALIZATIONS>
894    Whole type: <MEMBER_INIT, BASE_INIT>.  */
895 #define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
896
897 /* A cons list of virtual functions which cannot be inherited by
898    derived classes.  When deriving from this type, the derived
899    class must provide its own definition for each of these functions.  */
900 #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
901
902 /* Nonzero means that this aggr type has been `closed' by a semicolon.  */
903 #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
904
905 /* Nonzero means that the main virtual function table pointer needs to be
906    set because base constructors have placed the wrong value there.
907    If this is zero, it means that they placed the right value there,
908    and there is no need to change it.  */
909 #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
910
911 /* Nonzero means that if this type has virtual functions, that
912    the virtual function table will be written out.  */
913 #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
914
915 /* Nonzero means that this type has an X() constructor.  */
916 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
917
918 /* Nonzero means the type declared a ctor as private or protected.  We
919    use this to make sure we don't try to generate a copy ctor for a 
920    class that has a member of type NODE.  */
921 #define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor)
922
923 /* Ditto, for operator=.  */
924 #define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref)
925
926 /* Many routines need to cons up a list of basetypes for access
927    checking.  This field contains a TREE_LIST node whose TREE_VALUE
928    is the main variant of the type, and whose TREE_VIA_PUBLIC
929    and TREE_VIA_VIRTUAL bits are correctly set.  */
930 #define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
931 /* Same, but cache a list whose value is the name of this type.  */
932 #define CLASSTYPE_ID_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->id_as_list)
933 /* Same, but cache a list whose value is the binfo of this type.  */
934 #define CLASSTYPE_BINFO_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->binfo_as_list)
935
936 /* A list of class types with which this type is a friend.  The
937    TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
938    case of a template friend.  */
939 #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
940
941 /* Say whether this node was declared as a "class" or a "struct".  */
942 #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
943
944 /* Nonzero if this class has const members which have no specified initialization.  */
945 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
946
947 /* Nonzero if this class has ref members which have no specified initialization.  */
948 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
949
950 /* Nonzero if this class is included from a header file which employs
951    `#pragma interface', and it is not included in its implementation file.  */
952 #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
953
954 /* Same as above, but for classes whose purpose we do not know.  */
955 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
956 #define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0)
957 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X))
958 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1)
959 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0)
960
961 /* Nonzero if a _DECL node requires us to output debug info for this class.  */
962 #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
963 \f
964 /* Additional macros for inheritance information.  */
965
966 /* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
967    gcc/tree.h.  In particular if D is derived from B then the BINFO
968    for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
969    D.  In tree.h, this pointer is described as pointing in other
970    direction.  
971
972    After a call to get_vbase_types, the vbases are chained together in
973    depth-first order via TREE_CHAIN.  Other than that, TREE_CHAIN is
974    unused.  */
975
976 /* Nonzero means marked by DFS or BFS search, including searches
977    by `get_binfo' and `get_base_distance'.  */
978 #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
979 /* Macros needed because of C compilers that don't allow conditional
980    expressions to be lvalues.  Grr!  */
981 #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
982 #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
983
984 /* Nonzero means marked in search through virtual inheritance hierarchy.  */
985 #define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
986 /* Modifier macros */
987 #define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
988 #define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
989
990 /* Nonzero means marked in search for members or member functions.  */
991 #define BINFO_FIELDS_MARKED(NODE) \
992   (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
993 #define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
994 #define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
995
996 /* Nonzero means that this class is on a path leading to a new vtable.  */
997 #define BINFO_VTABLE_PATH_MARKED(NODE) \
998   (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
999 #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
1000 #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
1001
1002 /* Nonzero means that this class has a new vtable.  */
1003 #define BINFO_NEW_VTABLE_MARKED(NODE) \
1004   (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
1005 #define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
1006 #define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
1007
1008 /* Nonzero means this class has done dfs_pushdecls.  */
1009 #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
1010 #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
1011 #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
1012 \f
1013 /* Accessor macros for the vfield slots in structures.  */
1014
1015 /* Get the assoc info that caused this vfield to exist.  */
1016 #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1017
1018 /* Get that same information as a _TYPE.  */
1019 #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1020
1021 /* Get the value of the top-most type dominating the non-`normal' vfields.  */
1022 #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
1023
1024 /* Get the value of the top-most type that's `normal' for the vfield.  */
1025 #define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
1026 \f
1027 /* Nonzero for TREE_LIST node means that this list of things
1028    is a list of parameters, as opposed to a list of expressions.  */
1029 #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
1030
1031 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1032    this type can raise.  */
1033 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
1034
1035 /* The binding level associated with the namespace.  */
1036 #define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
1037 \f
1038 struct lang_decl_flags
1039 {
1040 #ifdef ONLY_INT_FIELDS
1041   int language : 8;
1042 #else
1043   enum languages language : 8;
1044 #endif
1045
1046   unsigned operator_attr : 1;
1047   unsigned constructor_attr : 1;
1048   unsigned returns_first_arg : 1;
1049   unsigned preserves_first_arg : 1;
1050   unsigned friend_attr : 1;
1051   unsigned static_function : 1;
1052   unsigned const_memfunc : 1;
1053   unsigned volatile_memfunc : 1;
1054
1055   unsigned abstract_virtual : 1;
1056   unsigned permanent_attr : 1 ;
1057   unsigned constructor_for_vbase_attr : 1;
1058   unsigned mutable_flag : 1;
1059   unsigned is_default_implementation : 1;
1060   unsigned saved_inline : 1;
1061   unsigned use_template : 2;
1062
1063   unsigned nonconverting : 1;
1064   unsigned declared_inline : 1;
1065   unsigned not_really_extern : 1;
1066   unsigned comdat : 1;
1067   unsigned needs_final_overrider : 1;
1068   unsigned dummy : 3;
1069
1070   tree access;
1071   tree context;
1072   tree memfunc_pointer_to;
1073   tree template_info;
1074   struct binding_level *level;
1075 };
1076
1077 struct lang_decl
1078 {
1079   struct lang_decl_flags decl_flags;
1080
1081   tree main_decl_variant;
1082   struct pending_inline *pending_inline_info;
1083 };
1084
1085 /* Non-zero if NODE is a _DECL with TREE_READONLY set.  */
1086 #define TREE_READONLY_DECL_P(NODE) \
1087   (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
1088
1089 /* Non-zero iff DECL is memory-based.  The DECL_RTL of
1090    certain const variables might be a CONST_INT, or a REG
1091    in some cases.  We cannot use `memory_operand' as a test
1092    here because on most RISC machines, a variable's address
1093    is not, by itself, a legitimate address.  */
1094 #define DECL_IN_MEMORY_P(NODE) \
1095   (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
1096
1097 /* For FUNCTION_DECLs: return the language in which this decl
1098    was declared.  */
1099 #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
1100
1101 /* For FUNCTION_DECLs: nonzero means that this function is a constructor.  */
1102 #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
1103 #define DECL_DESTRUCTOR_P(NODE) (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME(NODE)))
1104
1105 /* For FUNCTION_DECLs: nonzero means that this function is a constructor
1106    for an object with virtual baseclasses.  */
1107 #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
1108
1109 /* For FUNCTION_DECLs: nonzero means that this function is a default
1110    implementation of a signature method.  */
1111 #define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation)
1112
1113 /* For FUNCTION_DECLs: nonzero means that the constructor
1114    is known to return a non-zero `this' unchanged.  */
1115 #define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
1116
1117 /* Nonzero for FUNCTION_DECL means that this constructor is known to
1118    not make any assignment to `this', and therefore can be trusted
1119    to return it unchanged.  Otherwise, we must re-assign `current_class_ptr'
1120    after performing base initializations.  */
1121 #define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
1122
1123 /* Nonzero for _DECL means that this decl appears in (or will appear
1124    in) as a member in a RECORD_TYPE or UNION_TYPE node.  It is also for
1125    detecting circularity in case members are multiply defined.  In the
1126    case of a VAR_DECL, it is also used to determine how program storage
1127    should be allocated.  */
1128 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
1129
1130 /* Nonzero for FUNCTION_DECL means that this decl is just a
1131    friend declaration, and should not be added to the list of
1132    member functions for this class.  */
1133 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
1134
1135 /* Nonzero for FUNCTION_DECL means that this decl is a static
1136    member function.  */
1137 #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
1138
1139 /* Nonzero for a class member means that it is shared between all objects
1140    of that class.  */
1141 #define SHARED_MEMBER_P(NODE) \
1142   (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
1143    || TREE_CODE (NODE) == CONST_DECL)
1144                                 
1145 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
1146    member function.  */
1147 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
1148   (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
1149
1150 /* Nonzero for FUNCTION_DECL means that this decl is a member function
1151    (static or non-static).  */
1152 #define DECL_FUNCTION_MEMBER_P(NODE) \
1153  (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
1154
1155 /* Nonzero for FUNCTION_DECL means that this member function
1156    has `this' as const X *const.  */
1157 #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
1158
1159 /* Nonzero for FUNCTION_DECL means that this member function
1160    has `this' as volatile X *const.  */
1161 #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
1162
1163 /* Nonzero for _DECL means that this member object type
1164    is mutable.  */
1165 #define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1166
1167 /* Nonzero for _DECL means that this constructor is a non-converting
1168    constructor.  */
1169 #define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
1170
1171 /* Nonzero for FUNCTION_DECL means that this member function
1172    exists as part of an abstract class's interface.  */
1173 #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
1174
1175 /* Nonzero for FUNCTION_DECL means that this member function
1176    must be overridden by derived classes.  */
1177 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
1178
1179 /* Nonzero if allocated on permanent_obstack.  */
1180 #define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
1181
1182 /* The _TYPE context in which this _DECL appears.  This field holds the
1183    class where a virtual function instance is actually defined, and the
1184    lexical scope of a friend function defined in a class body. */
1185 #define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
1186 #define DECL_REAL_CONTEXT(NODE) \
1187   ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
1188    ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE))
1189
1190 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
1191 #define CP_DECL_CONTEXT(NODE) \
1192   (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
1193 #define FROB_CONTEXT(NODE)   ((NODE) == global_namespace ? NULL_TREE : (NODE))
1194
1195 /* 1 iff NODE has namespace scope, including the global namespace.  */
1196 #define DECL_NAMESPACE_SCOPE_P(NODE) \
1197   (DECL_CONTEXT (NODE) == NULL_TREE \
1198    || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
1199
1200 /* 1 iff NODE is a class member.  */
1201 #define DECL_CLASS_SCOPE_P(NODE) \
1202   (DECL_CONTEXT (NODE) \
1203    && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
1204
1205 /* For a NAMESPACE_DECL: the list of using namespace directives
1206    The PURPOSE is the used namespace, the value is the namespace
1207    that is the common ancestor. */
1208 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX(NODE)
1209
1210 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
1211    of a namespace, to record the transitive closure of using namespace. */
1212 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NODE)
1213
1214 /* In a NAMESPACE_DECL, points to the original namespace if this is
1215    a namespace alias.  */
1216 #define DECL_NAMESPACE_ALIAS(NODE) DECL_ABSTRACT_ORIGIN (NODE)
1217 #define ORIGINAL_NAMESPACE(NODE)  \
1218   (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
1219
1220 /* In a TREE_LIST concatenating using directives, indicate indirekt
1221    directives  */
1222 #define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0)
1223
1224 /* In a VAR_DECL for a variable declared in a for statement,
1225    this is the shadowed (local) variable.  */
1226 #define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
1227
1228 /* Points back to the decl which caused this lang_decl to be allocated.  */
1229 #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
1230
1231 /* For a FUNCTION_DECL: if this function was declared inline inside of
1232    a class declaration, this is where the text for the function is
1233    squirreled away.  */
1234 #define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
1235
1236 /* True if on the saved_inlines (see decl2.c) list.  */
1237 #define DECL_SAVED_INLINE(DECL) \
1238   (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
1239
1240 /* For a FUNCTION_DECL: if this function was declared inside a signature
1241    declaration, this is the corresponding member function pointer that was
1242    created for it.  */
1243 #define DECL_MEMFUNC_POINTER_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
1244
1245 /* For a FIELD_DECL: this points to the signature member function from
1246    which this signature member function pointer was created.  */
1247 #define DECL_MEMFUNC_POINTING_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
1248
1249 /* For a VAR_DECL or FUNCTION_DECL: template-specific information.  */
1250 #define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.template_info)
1251
1252 /* Template information for a RECORD_TYPE or UNION_TYPE.  */
1253 #define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info)
1254
1255 /* Template information for an ENUMERAL_TYPE.  Although an enumeration may
1256    not be a primary template, it may be declared within the scope of a
1257    primary template and the enumeration constants may depend on
1258    non-type template parameters.  */
1259 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1260
1261 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
1262 #define TYPE_TEMPLATE_INFO(NODE)                                        \
1263   (TREE_CODE (NODE) == ENUMERAL_TYPE                                    \
1264    ? ENUM_TEMPLATE_INFO (NODE) : CLASSTYPE_TEMPLATE_INFO (NODE))
1265
1266 /* Set the template information for an ENUMERAL_, RECORD_, or
1267    UNION_TYPE to VAL.  */
1268 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL)       \
1269   (TREE_CODE (NODE) == ENUMERAL_TYPE            \
1270    ? (ENUM_TEMPLATE_INFO (NODE) = VAL)          \
1271    : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
1272
1273 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
1274 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
1275 #define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE))
1276 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
1277
1278 /* The TEMPLATE_DECL instantiated or specialized by NODE.  This
1279    TEMPLATE_DECL will be the immediate parent, not the most general
1280    template.  For example, in:
1281
1282       template <class T> struct S { template <class U> void f(U); }
1283
1284    the FUNCTION_DECL for S<int>::f<double> will have, as its
1285    DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'. 
1286
1287    As a special case, for a member friend template of a template
1288    class, this value will not be a TEMPLATE_DECL, but rather a
1289    LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
1290    and any explicit template arguments provided.  For example, in:
1291
1292      template <class T> struct S { friend void f<int>(int, double); }
1293
1294    the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
1295    DECL_TI_ARGS will be {int}.  */ 
1296 #define DECL_TI_TEMPLATE(NODE)      TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
1297
1298 /* The template arguments used to obtain this decl from the most
1299    general form of DECL_TI_TEMPLATE.  For the example given for
1300    DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}.  These
1301    are always the full set of arguments required to instantiate this
1302    declaration from the most general template specialized here.  */
1303 #define DECL_TI_ARGS(NODE)          TI_ARGS (DECL_TEMPLATE_INFO (NODE))
1304 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
1305 #define CLASSTYPE_TI_ARGS(NODE)     TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
1306 #define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE))
1307 #define ENUM_TI_TEMPLATE(NODE)                  \
1308   TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
1309 #define ENUM_TI_ARGS(NODE)                      \
1310   TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
1311
1312 /* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
1313 #define TYPE_TI_TEMPLATE(NODE)                  \
1314   (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
1315
1316 /* Like DECL_TI_ARGS, , but for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
1317 #define TYPE_TI_ARGS(NODE)                      \
1318   (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
1319
1320 #define INNERMOST_TEMPLATE_PARMS(NODE)  TREE_VALUE(NODE)
1321
1322 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
1323
1324 #define DECL_SAVED_TREE(NODE)           DECL_MEMFUNC_POINTER_TO (NODE)
1325 #define COMPOUND_STMT_NO_SCOPE(NODE)    TREE_LANG_FLAG_0 (NODE)
1326 #define NEW_EXPR_USE_GLOBAL(NODE)       TREE_LANG_FLAG_0 (NODE)
1327 #define DELETE_EXPR_USE_GLOBAL(NODE)    TREE_LANG_FLAG_0 (NODE)
1328 #define DELETE_EXPR_USE_VEC(NODE)       TREE_LANG_FLAG_1 (NODE)
1329 #define LOOKUP_EXPR_GLOBAL(NODE)        TREE_LANG_FLAG_0 (NODE)
1330
1331 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
1332    TEMPLATE_DECL.  This macro determines whether or not a given class
1333    type is really a template type, as opposed to an instantiation or
1334    specialization of one.  */
1335 #define CLASSTYPE_IS_TEMPLATE(NODE)  \
1336   (CLASSTYPE_TEMPLATE_INFO (NODE)    \
1337    && !CLASSTYPE_USE_TEMPLATE (NODE) \
1338    && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
1339
1340 #define TYPENAME_TYPE_FULLNAME(NODE)    CLASSTYPE_SIZE (NODE)
1341
1342 /* Nonzero in INTEGER_CST means that this int is negative by dint of
1343    using a twos-complement negated operand.  */
1344 #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
1345
1346 #if 0                           /* UNUSED */
1347 /* Nonzero in any kind of _EXPR or _REF node means that it is a call
1348    to a storage allocation routine.  If, later, alternate storage
1349    is found to hold the object, this call can be ignored.  */
1350 #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
1351 #endif
1352
1353 /* Nonzero in any kind of _TYPE that uses multiple inheritance
1354    or virtual baseclasses.  */
1355 #define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
1356
1357 #if 0                           /* UNUSED */
1358 /* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
1359    gave; it's a DECL_NESTED_TYPENAME.  Someone may want to set this on
1360    mangled function names, too, but it isn't currently.  */
1361 #define TREE_MANGLED(NODE) (TREE_LANG_FLAG_0 (NODE))
1362 #endif
1363
1364 #if 0                           /* UNUSED */
1365 /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
1366    should be looked up in a non-standard way.  */
1367 #define DECL_OVERLOADED(NODE) (FOO)
1368 #endif
1369
1370 /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
1371    For a FUNCTION_DECL, this is when the function is a virtual function.
1372    For a VAR_DECL, this is when the variable is a virtual function table.
1373    For a FIELD_DECL, when the field is the field for the virtual function table.
1374    For an IDENTIFIER_NODE, nonzero if any function with this name
1375    has been declared virtual.
1376
1377    For a _TYPE if it uses virtual functions (or is derived from
1378    one that does).  */
1379 #define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
1380
1381 extern int flag_new_for_scope;
1382
1383 /* This flag is true of a local VAR_DECL if it was declared in a for
1384    statement, but we are no longer in the scope of the for.  */
1385 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
1386
1387 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
1388    if we already emitted a warning about using it.  */
1389 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE)
1390
1391 /* This _DECL represents a compiler-generated entity.  */
1392 #define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
1393
1394 /* Record whether a typedef for type `int' was actually `signed int'.  */
1395 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
1396
1397 /* Nonzero if the type T promotes to itself.
1398    ANSI C states explicitly the list of types that promote;
1399    in particular, short promotes to int even if they have the same width.  */
1400 #define C_PROMOTING_INTEGER_TYPE_P(t)                           \
1401   (TREE_CODE ((t)) == INTEGER_TYPE                              \
1402    && (TYPE_MAIN_VARIANT (t) == char_type_node                  \
1403        || TYPE_MAIN_VARIANT (t) == signed_char_type_node        \
1404        || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node      \
1405        || TYPE_MAIN_VARIANT (t) == short_integer_type_node      \
1406        || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
1407
1408 #define INTEGRAL_CODE_P(CODE) \
1409   (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
1410 #define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE))
1411
1412 /* Mark which labels are explicitly declared.
1413    These may be shadowed, and may be referenced from nested functions.  */
1414 #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
1415
1416 /* Nonzero for _TYPE means that the _TYPE defines
1417    at least one constructor.  */
1418 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
1419
1420 /* When appearing in an INDIRECT_REF, it means that the tree structure
1421    underneath is actually a call to a constructor.  This is needed
1422    when the constructor must initialize local storage (which can
1423    be automatically destroyed), rather than allowing it to allocate
1424    space from the heap.
1425
1426    When appearing in a SAVE_EXPR, it means that underneath
1427    is a call to a constructor.
1428
1429    When appearing in a CONSTRUCTOR, it means that it was
1430    a GNU C constructor expression.
1431
1432    When appearing in a FIELD_DECL, it means that this field
1433    has been duly initialized in its constructor.  */
1434 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
1435
1436 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
1437                                    && CONSTRUCTOR_ELTS (NODE) == NULL_TREE)
1438
1439 #if 0
1440 /* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
1441    Used to generate more helpful error message in case somebody
1442    tries to take its address.  */
1443 #define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
1444 #endif
1445
1446 /* Nonzero for _TYPE means that the _TYPE defines a destructor.  */
1447 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
1448
1449 #if 0
1450 /* Nonzero for _TYPE node means that creating an object of this type
1451    will involve a call to a constructor.  This can apply to objects
1452    of ARRAY_TYPE if the type of the elements needs a constructor.  */
1453 #define TYPE_NEEDS_CONSTRUCTING(NODE) ... defined in ../tree.h ...
1454 #endif
1455
1456 /* Nonzero means that an object of this type can not be initialized using
1457    an initializer list.  */
1458 #define CLASSTYPE_NON_AGGREGATE(NODE) \
1459   (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate)
1460 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
1461   (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
1462
1463 /* Nonzero if there is a user-defined X::op=(x&) for this class.  */
1464 #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
1465 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
1466 #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref)
1467 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref)
1468
1469 /* Nonzero for _TYPE node means that destroying an object of this type
1470    will involve a call to a destructor.  This can apply to objects
1471    of ARRAY_TYPE is the type of the elements needs a destructor.  */
1472 #define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
1473
1474 /* Nonzero for class type means that initialization of this type can use
1475    a bitwise copy.  */
1476 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
1477   (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
1478
1479 /* Nonzero for class type means that assignment of this type can use
1480    a bitwise copy.  */
1481 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
1482   (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
1483
1484 #define TYPE_PTRMEM_P(NODE)                                     \
1485   (TREE_CODE (NODE) == POINTER_TYPE                             \
1486    && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
1487 #define TYPE_PTR_P(NODE)                                \
1488   (TREE_CODE (NODE) == POINTER_TYPE                     \
1489    && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
1490 #define TYPE_PTROB_P(NODE)                                              \
1491   (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE   \
1492    && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
1493 #define TYPE_PTROBV_P(NODE)                                             \
1494   (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
1495 #define TYPE_PTRFN_P(NODE)                              \
1496   (TREE_CODE (NODE) == POINTER_TYPE                     \
1497    && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
1498
1499 /* Nonzero for _TYPE node means that this type is a pointer to member
1500    function type.  */
1501 #define TYPE_PTRMEMFUNC_P(NODE) (TREE_CODE(NODE) == RECORD_TYPE && TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
1502 #define TYPE_PTRMEMFUNC_FLAG(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
1503 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
1504    pointer to member function.  TYPE_PTRMEMFUNC_P _must_ be true,
1505    before using this macro.  */
1506 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
1507
1508 /* Returns `A' for a type like `int (A::*)(double)' */
1509 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
1510   TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
1511
1512 /* These are use to manipulate the canonical RECORD_TYPE from the
1513    hashed POINTER_TYPE, and can only be used on the POINTER_TYPE.  */
1514 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
1515 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
1516 /* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P.  */
1517 #define DELTA2_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), delta2_identifier, NULL_TREE, 0))
1518 #define PFN_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), pfn_identifier, NULL_TREE, 0))
1519
1520 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
1521    `X'.  */
1522 #define PTRMEM_CST_CLASS(NODE)                          \
1523    (TYPE_PTRMEM_P (TREE_TYPE (NODE))                    \
1524     ? TYPE_OFFSET_BASETYPE (TREE_TYPE (NODE))           \
1525     : TYPE_PTRMEMFUNC_OBJECT_TYPE (TREE_TYPE (NODE)))
1526
1527 /* For a pointer-to-member constant `X::Y' this is the _DECL for 
1528    `Y'.  */
1529 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t) NODE)->member)
1530
1531 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
1532    specified in its declaration.  */
1533 #define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE))
1534
1535 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
1536    specified in its declaration.  */
1537 #define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE))
1538
1539 /* Nonzero for SAVE_EXPR if used to initialize a PARM_DECL.  */
1540 #define PARM_DECL_EXPR(NODE) (TREE_LANG_FLAG_2(NODE))
1541
1542 /* Nonzero in FUNCTION_DECL means it is really an operator.
1543    Just used to communicate formatting information to dbxout.c.  */
1544 #define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
1545
1546 #define ANON_UNION_P(NODE) (DECL_NAME (NODE) == 0)
1547
1548 /* Nonzero if TYPE is an anonymous union type.  */
1549 #define ANON_UNION_TYPE_P(TYPE) \
1550   (TREE_CODE (TYPE) == UNION_TYPE \
1551    && ANON_AGGRNAME_P (TYPE_IDENTIFIER (TYPE)))
1552
1553 #define UNKNOWN_TYPE LANG_TYPE
1554
1555 /* Define fields and accessors for nodes representing declared names.  */
1556
1557 #if 0
1558 /* C++: A derived class may be able to directly use the virtual
1559    function table of a base class.  When it does so, it may
1560    still have a decl node used to access the virtual function
1561    table (so that variables of this type can initialize their
1562    virtual function table pointers by name).  When such thievery
1563    is committed, know exactly which base class's virtual function
1564    table is the one being stolen.  This effectively computes the
1565    transitive closure.  */
1566 #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
1567 #endif
1568
1569 #define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous)
1570
1571 /* C++: all of these are overloaded!  These apply only to TYPE_DECLs.  */
1572
1573 /* The format of each node in the DECL_FRIENDLIST is as follows:
1574
1575    The TREE_PURPOSE will be the name of a function, i.e., an
1576    IDENTIFIER_NODE.  The TREE_VALUE will be itself a TREE_LIST, the
1577    list of functions with that name which are friends.  The
1578    TREE_PURPOSE of each node in this sublist will be error_mark_node,
1579    if the function was declared a friend individually, in which case
1580    the TREE_VALUE will be the function_decl.  If, however, all
1581    functions with a given name in a class were declared to be friends,
1582    the TREE_PUROSE will be the class type, and the TREE_VALUE will be
1583    NULL_TREE.  */
1584 #define DECL_FRIENDLIST(NODE)           (DECL_INITIAL (NODE))
1585
1586 /* The DECL_ACCESS is used to record under which context
1587    special access rules apply.  */
1588 #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access)
1589
1590 /* C++: all of these are overloaded!
1591    These apply to PARM_DECLs and VAR_DECLs.  */
1592 #define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
1593 #define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
1594
1595 /* Accessor macros for C++ template decl nodes.  */
1596
1597 /* The DECL_TEMPLATE_PARMS are a list.  The TREE_PURPOSE of each node
1598    is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
1599    template parameters, with 1 being the outermost set of template
1600    parameters.  The TREE_VALUE is a vector, whose elements are the
1601    template parameters at each level.  Each element in the vector is a
1602    TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
1603    non-type parameter), or a TYPE_DECL (if the parameter is a type
1604    parameter).  The TREE_PURPOSE is the default value, if any.  The
1605    TEMPLATE_PARM_INDEX for the parameter is avilable as the
1606    DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
1607    TYPE_DECL).  */
1608 #define DECL_TEMPLATE_PARMS(NODE)       DECL_ARGUMENTS(NODE)
1609 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
1610    INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
1611 #define DECL_NTPARMS(NODE) \
1612    TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
1613 /* For function, method, class-data templates.  */
1614 #define DECL_TEMPLATE_RESULT(NODE)      DECL_RESULT(NODE)
1615 /* For a static member variable template, the
1616    DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
1617    implicitly generated instantiations of the variable.  There are no
1618    partial instantiations of static member variables, so all of these
1619    will be full instantiations.
1620
1621    For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
1622    all instantiations and specializations of the class type, including
1623    partial instantiations and partial specializations.
1624
1625    In both cases, the TREE_PURPOSE of each node contains the arguments
1626    used; the TREE_VALUE contains the generated variable.  The template
1627    arguments are always complete.  For example, given:
1628
1629       template <class T> struct S1 {
1630         template <class U> struct S2 {};
1631         template <class U> struct S2<U*> {};
1632       };
1633
1634    the record for the partial specialization will contain, as its
1635    argument list, { {T}, {U*} }, and will be on the
1636    DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
1637    <class U> struct S1<T>::S2'.
1638
1639    This list is not used for function templates.  */
1640 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
1641 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
1642    contains all instantiations and specializations of the function,
1643    including partial instantiations.  For a partial instantiation
1644    which is a specialization, this list holds only full
1645    specializations of the template that are instantiations of the
1646    partial instantiation.  For example, given:
1647
1648       template <class T> struct S {
1649         template <class U> void f(U);
1650         template <> void f(T); 
1651       };
1652
1653    the `S<int>::f<int>(int)' function will appear on the
1654    DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
1655    template <class U> void S<T>::f(U)' and `template <class T> void
1656    S<int>::f(T)'.  In the latter case, however, it will have only the
1657    innermost set of arguments (T, in this case).  The DECL_TI_TEMPLATE
1658    for the function declaration will point at the specialization, not
1659    the fully general template.
1660
1661    For a class template, this list contains the partial
1662    specializations of this template.  (Full specializations are not
1663    recorded on this list.)  The TREE_PURPOSE holds the innermost
1664    arguments used in the partial specialization (e.g., for `template
1665    <class T> struct S<T*, int>' this will be `T*'.)  The TREE_VALUE
1666    holds the innermost template parameters for the specialization
1667    (e.g., `T' in the example above.)  The TREE_TYPE is the _TYPE node
1668    for the partial specialization.
1669
1670    This list is not used for static variable templates.  */
1671 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE)     DECL_SIZE(NODE)
1672 #define DECL_TEMPLATE_INJECT(NODE)      DECL_INITIAL(NODE)
1673
1674 /* Nonzero for TEMPLATE_DECL nodes that represents template template
1675    parameters */
1676 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
1677   (TREE_CODE (NODE) == TEMPLATE_DECL && TREE_TYPE (NODE) \
1678    && TREE_CODE (TREE_TYPE (NODE)) == TEMPLATE_TEMPLATE_PARM)
1679
1680 #define DECL_FUNCTION_TEMPLATE_P(NODE)  \
1681   (TREE_CODE (NODE) == TEMPLATE_DECL \
1682    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
1683
1684 /* Nonzero for a DECL that represents a template class.  */
1685 #define DECL_CLASS_TEMPLATE_P(NODE) \
1686   (TREE_CODE (NODE) == TEMPLATE_DECL \
1687    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
1688    && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
1689
1690 /* Nonzero if NODE which declares a type.  */
1691 #define DECL_DECLARES_TYPE_P(NODE) \
1692   (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
1693
1694 /* A `primary' template is one that has its own template header.  A
1695    member function of a class template is a template, but not primary.
1696    A member template is primary.  Friend templates are primary, too.  */
1697
1698 /* Returns the primary template corresponding to these parameters.  */
1699 #define DECL_PRIMARY_TEMPLATE(NODE) \
1700   (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
1701
1702 /* Returns non-zero if NODE is a primary template.  */
1703 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
1704
1705 #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
1706   (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
1707
1708 /* Indicates whether or not (and how) a template was expanded for this
1709    FUNCTION_DECL or VAR_DECL.
1710      0=normal declaration, e.g. int min (int, int);
1711      1=implicit template instantiation
1712      2=explicit template specialization, e.g. int min<int> (int, int);
1713      3=explicit template instantiation, e.g. template int min<int> (int, int);  */
1714 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
1715
1716 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
1717 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
1718   (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
1719
1720 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
1721 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
1722 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
1723   (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
1724 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
1725   (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
1726
1727 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
1728 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
1729 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
1730   (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
1731 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
1732   (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
1733
1734 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
1735 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
1736 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
1737   (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
1738 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
1739   (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
1740
1741 /* Non-zero if DECL is a friend function which is an instantiation
1742    from the point of view of the compiler, but not from the point of
1743    view of the language.  For example given:
1744       template <class T> struct S { friend void f(T) {}; };
1745    the declaration of `void f(int)' generated when S<int> is
1746    instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
1747    a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION.  */
1748 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
1749   (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
1750
1751 /* Non-zero iff we are currently processing a declaration for an
1752    entity with its own template parameter list, and which is not a
1753    full specialization.  */
1754 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
1755   (processing_template_decl > template_class_depth (current_class_type))
1756
1757 /* This function may be a guiding decl for a template.  */
1758 #define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
1759 /* We know what we're doing with this decl now.  */
1760 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
1761
1762 /* This function was declared inline.  This flag controls the linkage
1763    semantics of 'inline'; whether or not the function is inlined is
1764    controlled by DECL_INLINE.  */
1765 #define DECL_THIS_INLINE(NODE) \
1766   (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
1767
1768 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
1769    so that assemble_external will work properly.  So we have this flag to
1770    tell us whether the decl is really not external.  */
1771 #define DECL_NOT_REALLY_EXTERN(NODE) \
1772   (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
1773
1774 #define DECL_REALLY_EXTERN(NODE) \
1775   (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
1776
1777 /* Used to tell cp_finish_decl that it should approximate comdat linkage
1778    as best it can for this decl.  */
1779 #define DECL_COMDAT(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.comdat)
1780
1781 #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
1782
1783 /* ...and for unexpanded-parameterized-type nodes.  */
1784 #define UPT_TEMPLATE(NODE)      TREE_PURPOSE(TYPE_VALUES(NODE))
1785 #define UPT_PARMS(NODE)         TREE_VALUE(TYPE_VALUES(NODE))
1786
1787 /* An un-parsed default argument looks like an identifier.  */
1788 #define DEFARG_NODE_CHECK(t)    TREE_CHECK(t, DEFAULT_ARG) 
1789 #define DEFARG_LENGTH(NODE)     (DEFARG_NODE_CHECK(NODE)->identifier.length)
1790 #define DEFARG_POINTER(NODE)    (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
1791
1792 #define builtin_function(NAME, TYPE, CODE, LIBNAME) \
1793   define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME)
1794
1795 /* These macros provide convenient access to the various _STMT nodes
1796    created when parsing template declarations.  */
1797 #define IF_COND(NODE)           TREE_OPERAND (NODE, 0)
1798 #define THEN_CLAUSE(NODE)       TREE_OPERAND (NODE, 1)
1799 #define ELSE_CLAUSE(NODE)       TREE_OPERAND (NODE, 2)
1800 #define WHILE_COND(NODE)        TREE_OPERAND (NODE, 0)
1801 #define WHILE_BODY(NODE)        TREE_OPERAND (NODE, 1)
1802 #define DO_COND(NODE)           TREE_OPERAND (NODE, 0)
1803 #define DO_BODY(NODE)           TREE_OPERAND (NODE, 1)
1804 #define RETURN_EXPR(NODE)       TREE_OPERAND (NODE, 0)
1805 #define EXPR_STMT_EXPR(NODE)    TREE_OPERAND (NODE, 0)
1806 #define FOR_INIT_STMT(NODE)     TREE_OPERAND (NODE, 0)
1807 #define FOR_COND(NODE)          TREE_OPERAND (NODE, 1)
1808 #define FOR_EXPR(NODE)          TREE_OPERAND (NODE, 2)
1809 #define FOR_BODY(NODE)          TREE_OPERAND (NODE, 3)
1810 #define SWITCH_COND(NODE)       TREE_OPERAND (NODE, 0)
1811 #define SWITCH_BODY(NODE)       TREE_OPERAND (NODE, 1)
1812 #define CASE_LOW(NODE)          TREE_OPERAND (NODE, 0)
1813 #define CASE_HIGH(NODE)         TREE_OPERAND (NODE, 1)
1814 #define GOTO_DESTINATION(NODE)  TREE_OPERAND (NODE, 0)
1815 #define TRY_STMTS(NODE)         TREE_OPERAND (NODE, 0)
1816 #define TRY_HANDLERS(NODE)      TREE_OPERAND (NODE, 1)
1817 #define HANDLER_PARMS(NODE)     TREE_OPERAND (NODE, 0)
1818 #define HANDLER_BODY(NODE)      TREE_OPERAND (NODE, 1)
1819 #define COMPOUND_BODY(NODE)     TREE_OPERAND (NODE, 0)
1820 #define ASM_CV_QUAL(NODE)       TREE_OPERAND (NODE, 0)
1821 #define ASM_STRING(NODE)        TREE_OPERAND (NODE, 1)
1822 #define ASM_OUTPUTS(NODE)       TREE_OPERAND (NODE, 2)
1823 #define ASM_INPUTS(NODE)        TREE_OPERAND (NODE, 3)
1824 #define ASM_CLOBBERS(NODE)      TREE_OPERAND (NODE, 4)
1825
1826 /* An enumeration of the kind of tags that C++ accepts.  */
1827 enum tag_types { record_type, class_type, union_type, enum_type,
1828                    signature_type };
1829
1830 /* Zero means prototype weakly, as in ANSI C (no args means nothing).
1831    Each language context defines how this variable should be set.  */
1832 extern int strict_prototype;
1833 extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
1834
1835 /* Non-zero means that if a label exists, and no other identifier
1836    applies, use the value of the label.  */
1837 extern int flag_labels_ok;
1838
1839 /* Non-zero means to collect statistics which might be expensive
1840    and to print them when we are done.  */
1841 extern int flag_detailed_statistics;
1842
1843 /* Non-zero means warn in function declared in derived class has the
1844    same name as a virtual in the base class, but fails to match the
1845    type signature of any virtual function in the base class.  */
1846 extern int warn_overloaded_virtual;
1847
1848 /* Nonzero means warn about use of multicharacter literals.  */
1849 extern int warn_multichar;
1850
1851 /* Non-zero means warn if a non-templatized friend function is
1852    declared in a templatized class. This behavior is warned about with
1853    flag_guiding_decls in do_friend. */
1854 extern int warn_nontemplate_friend;
1855
1856 /* in c-common.c */
1857 extern void declare_function_name               PROTO((void));
1858 extern void decl_attributes                     PROTO((tree, tree, tree));
1859 extern void init_function_format_info           PROTO((void));
1860 extern void record_function_format              PROTO((tree, tree, int, int, int));
1861 extern void check_function_format               PROTO((tree, tree, tree));
1862 /* Print an error message for invalid operands to arith operation CODE.
1863    NOP_EXPR is used as a special case (see truthvalue_conversion).  */
1864 extern void binary_op_error                     PROTO((enum tree_code));
1865 extern tree cp_build_type_variant                PROTO((tree, int, int));
1866 extern tree canonical_type_variant              PROTO((tree));
1867 extern void c_expand_expr_stmt                  PROTO((tree));
1868 /* Validate the expression after `case' and apply default promotions.  */
1869 extern tree check_case_value                    PROTO((tree));
1870 /* Concatenate a list of STRING_CST nodes into one STRING_CST.  */
1871 extern tree combine_strings                     PROTO((tree));
1872 extern void constant_expression_warning         PROTO((tree));
1873 extern tree convert_and_check                   PROTO((tree, tree));
1874 extern void overflow_warning                    PROTO((tree));
1875 extern void unsigned_conversion_warning         PROTO((tree, tree));
1876
1877 /* Read the rest of the current #-directive line.  */
1878 #if USE_CPPLIB
1879 extern char *get_directive_line                 PROTO((void));
1880 #define GET_DIRECTIVE_LINE() get_directive_line ()
1881 #else
1882 extern char *get_directive_line                 PROTO((FILE *));
1883 #define GET_DIRECTIVE_LINE() get_directive_line (finput)
1884 #endif
1885 /* Subroutine of build_binary_op, used for comparison operations.
1886    See if the operands have both been converted from subword integer types
1887    and, if so, perhaps change them both back to their original type.  */
1888 extern tree shorten_compare                     PROTO((tree *, tree *, tree *, enum tree_code *));
1889 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
1890    or validate its data type for an `if' or `while' statement or ?..: exp.  */
1891 extern tree truthvalue_conversion               PROTO((tree));
1892 extern tree type_for_mode                       PROTO((enum machine_mode, int));
1893 extern tree type_for_size                       PROTO((unsigned, int));
1894 extern int c_get_alias_set                      PROTO((tree));
1895
1896 /* in decl{2}.c */
1897 extern tree void_list_node;
1898 extern tree void_zero_node;
1899 extern tree default_function_type;
1900 extern tree vtable_entry_type;
1901 extern tree sigtable_entry_type;
1902 extern tree __t_desc_type_node;
1903 #if 0
1904 extern tree __tp_desc_type_node;
1905 #endif
1906 extern tree __access_mode_type_node;
1907 extern tree __bltn_desc_type_node, __user_desc_type_node;
1908 extern tree __class_desc_type_node, __attr_desc_type_node;
1909 extern tree __ptr_desc_type_node, __func_desc_type_node;
1910 extern tree __ptmf_desc_type_node, __ptmd_desc_type_node;
1911 extern tree type_info_type_node;
1912 extern tree class_star_type_node;
1913 extern tree this_identifier;
1914 extern tree ctor_identifier, dtor_identifier;
1915 extern tree pfn_identifier;
1916 extern tree index_identifier;
1917 extern tree delta_identifier;
1918 extern tree delta2_identifier;
1919 extern tree pfn_or_delta2_identifier;
1920 extern tree tag_identifier;
1921 extern tree vt_off_identifier;
1922
1923 /* A node that is a list (length 1) of error_mark_nodes.  */
1924 extern tree error_mark_list;
1925
1926 extern tree ptr_type_node;
1927 extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
1928 extern tree unknown_type_node;
1929 extern tree opaque_type_node, signature_type_node;
1930
1931 /* Node for "pointer to (virtual) function".
1932    This may be distinct from ptr_type_node so gdb can distinguish them.  */
1933 #define vfunc_ptr_type_node \
1934   (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
1935
1936 /* The type of a vtbl, i.e., an array of vtable entries.  */
1937 extern tree vtbl_type_node;
1938 /* The type of a class vtbl pointer, i.e., a pointer to a vtable entry.  */
1939 extern tree vtbl_ptr_type_node;
1940 extern tree delta_type_node;
1941 extern tree std_node;
1942
1943 extern tree long_long_integer_type_node, long_long_unsigned_type_node;
1944 /* For building calls to `delete'.  */
1945 extern tree integer_two_node, integer_three_node;
1946 extern tree boolean_type_node, boolean_true_node, boolean_false_node;
1947
1948 extern tree null_node;
1949
1950 extern tree anonymous_namespace_name;
1951
1952 /* in pt.c  */
1953
1954 /* These values are used for the `STRICT' parameter to type_unfication and
1955    fn_type_unification.  Their meanings are described with the
1956    documentation for fn_type_unification.  */
1957
1958 typedef enum unification_kind_t {
1959   DEDUCE_CALL,
1960   DEDUCE_CONV,
1961   DEDUCE_EXACT
1962 } unification_kind_t;
1963
1964 extern tree current_template_parms;
1965 extern HOST_WIDE_INT processing_template_decl;
1966 extern tree last_tree;
1967
1968 /* The template currently being instantiated, and where the instantiation
1969    was triggered.  */
1970 struct tinst_level
1971 {
1972   tree decl;
1973   int line;
1974   char *file;
1975   struct tinst_level *next;
1976 };
1977
1978 extern int minimal_parse_mode;
1979
1980 extern void maybe_print_template_context        PROTO ((void));
1981
1982 /* in class.c */
1983
1984 /* When parsing a class definition, the access specifier most recently
1985    given by the user, or, if no access specifier was given, the
1986    default value appropriate for the kind of class (i.e., struct,
1987    class, or union).  */
1988 extern tree current_access_specifier;
1989
1990 extern tree current_class_name;
1991 extern tree current_class_type;
1992 extern tree current_class_ptr;
1993 extern tree previous_class_type;
1994 extern tree current_class_ref;
1995 extern int current_class_depth;
1996
1997 extern tree current_lang_name;
1998 extern tree lang_name_cplusplus, lang_name_c, lang_name_java;
1999
2000 /* Points to the name of that function. May not be the DECL_NAME
2001    of CURRENT_FUNCTION_DECL due to overloading */
2002 extern tree original_function_name;
2003
2004 /* in init.c  */
2005 extern tree global_base_init_list;
2006 extern tree current_base_init_list, current_member_init_list;
2007
2008 extern int current_function_just_assigned_this;
2009 extern int current_function_parms_stored;
2010 \f
2011 /* Here's where we control how name mangling takes place.  */
2012
2013 #define OPERATOR_ASSIGN_FORMAT "__a%s"
2014 #define OPERATOR_FORMAT "__%s"
2015 #define OPERATOR_TYPENAME_FORMAT "__op"
2016 #define OPERATOR_TYPENAME_P(ID_NODE) \
2017   (IDENTIFIER_POINTER (ID_NODE)[0] == '_'       \
2018    && IDENTIFIER_POINTER (ID_NODE)[1] == '_'    \
2019    && IDENTIFIER_POINTER (ID_NODE)[2] == 'o'    \
2020    && IDENTIFIER_POINTER (ID_NODE)[3] == 'p')
2021
2022
2023 /* Cannot use '$' up front, because this confuses gdb
2024    (names beginning with '$' are gdb-local identifiers).
2025
2026    Note that all forms in which the '$' is significant are long enough
2027    for direct indexing (meaning that if we know there is a '$'
2028    at a particular location, we can index into the string at
2029    any other location that provides distinguishing characters).  */
2030
2031 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
2032    doesn't allow '$' in symbol names.  */
2033 #ifndef NO_DOLLAR_IN_LABEL
2034
2035 #define JOINER '$'
2036
2037 #define VPTR_NAME "$v"
2038 #define THROW_NAME "$eh_throw"
2039 #define DESTRUCTOR_DECL_PREFIX "_$_"
2040 #define AUTO_VTABLE_NAME "__vtbl$me__"
2041 #define AUTO_TEMP_NAME "_$tmp_"
2042 #define AUTO_TEMP_FORMAT "_$tmp_%d"
2043 #define VTABLE_BASE "$vb"
2044 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
2045 #define VFIELD_BASE "$vf"
2046 #define VFIELD_NAME "_vptr$"
2047 #define VFIELD_NAME_FORMAT "_vptr$%s"
2048 #define VBASE_NAME "_vb$"
2049 #define VBASE_NAME_FORMAT "_vb$%s"
2050 #define STATIC_NAME_FORMAT "_%s$%s"
2051 #define ANON_AGGRNAME_FORMAT "$_%d"
2052
2053 #else /* NO_DOLLAR_IN_LABEL */
2054
2055 #ifndef NO_DOT_IN_LABEL
2056
2057 #define JOINER '.'
2058
2059 #define VPTR_NAME ".v"
2060 #define THROW_NAME ".eh_throw"
2061 #define DESTRUCTOR_DECL_PREFIX "_._"
2062 #define AUTO_VTABLE_NAME "__vtbl.me__"
2063 #define AUTO_TEMP_NAME "_.tmp_"
2064 #define AUTO_TEMP_FORMAT "_.tmp_%d"
2065 #define VTABLE_BASE ".vb"
2066 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s")
2067 #define VFIELD_BASE ".vf"
2068 #define VFIELD_NAME "_vptr."
2069 #define VFIELD_NAME_FORMAT "_vptr.%s"
2070 #define VBASE_NAME "_vb."
2071 #define VBASE_NAME_FORMAT "_vb.%s"
2072 #define STATIC_NAME_FORMAT "_%s.%s"
2073
2074 #define ANON_AGGRNAME_FORMAT "._%d"
2075
2076 #else /* NO_DOT_IN_LABEL */
2077
2078 #define VPTR_NAME "__vptr"
2079 #define VPTR_NAME_P(ID_NODE) \
2080   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
2081 #define THROW_NAME "__eh_throw"
2082 #define DESTRUCTOR_DECL_PREFIX "__destr_"
2083 #define DESTRUCTOR_NAME_P(ID_NODE) \
2084   (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
2085              sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
2086 #define IN_CHARGE_NAME "__in_chrg"
2087 #define AUTO_VTABLE_NAME "__vtbl_me__"
2088 #define AUTO_TEMP_NAME "__tmp_"
2089 #define TEMP_NAME_P(ID_NODE) \
2090   (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
2091              sizeof (AUTO_TEMP_NAME) - 1))
2092 #define AUTO_TEMP_FORMAT "__tmp_%d"
2093 #define VTABLE_BASE "__vtb"
2094 #define VTABLE_NAME "__vt_"
2095 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s")
2096 #define VTABLE_NAME_P(ID_NODE) \
2097   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
2098              sizeof (VTABLE_NAME) - 1))
2099 #define VFIELD_BASE "__vfb"
2100 #define VFIELD_NAME "__vptr_"
2101 #define VFIELD_NAME_P(ID_NODE) \
2102   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
2103             sizeof (VFIELD_NAME) - 1))
2104 #define VFIELD_NAME_FORMAT "_vptr_%s"
2105 #define VBASE_NAME "__vb_"
2106 #define VBASE_NAME_P(ID_NODE) \
2107   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
2108              sizeof (VBASE_NAME) - 1))
2109 #define VBASE_NAME_FORMAT "__vb_%s"
2110 #define STATIC_NAME_FORMAT "__static_%s_%s"
2111
2112 #define ANON_AGGRNAME_PREFIX "__anon_"
2113 #define ANON_AGGRNAME_P(ID_NODE) \
2114   (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
2115              sizeof (ANON_AGGRNAME_PREFIX) - 1))
2116 #define ANON_AGGRNAME_FORMAT "__anon_%d"
2117 #define ANON_PARMNAME_FORMAT "__%d"
2118 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2119                                   && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
2120                                   && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
2121
2122 #endif  /* NO_DOT_IN_LABEL */
2123 #endif  /* NO_DOLLAR_IN_LABEL */
2124
2125 #define THIS_NAME "this"
2126 #define DESTRUCTOR_NAME_FORMAT "~%s"
2127 #define FILE_FUNCTION_PREFIX_LEN 9
2128 #define CTOR_NAME "__ct"
2129 #define DTOR_NAME "__dt"
2130
2131 #define IN_CHARGE_NAME "__in_chrg"
2132
2133 #define VTBL_PTR_TYPE           "__vtbl_ptr_type"
2134 #define VTABLE_DELTA_NAME       "__delta"
2135 #define VTABLE_INDEX_NAME       "__index"
2136 #define VTABLE_PFN_NAME         "__pfn"
2137 #define VTABLE_DELTA2_NAME      "__delta2"
2138
2139 #define SIGNATURE_FIELD_NAME    "__s_"
2140 #define SIGNATURE_FIELD_NAME_FORMAT "__s_%s"
2141 #define SIGNATURE_OPTR_NAME     "__optr"
2142 #define SIGNATURE_SPTR_NAME     "__sptr"
2143 #define SIGNATURE_POINTER_NAME  "__sp_"
2144 #define SIGNATURE_POINTER_NAME_FORMAT "__%s%ssp_%s"
2145 #define SIGNATURE_REFERENCE_NAME "__sr_"
2146 #define SIGNATURE_REFERENCE_NAME_FORMAT "__%s%ssr_%s"
2147
2148 #define SIGTABLE_PTR_TYPE       "__sigtbl_ptr_type"
2149 #define SIGTABLE_NAME_FORMAT    "__st_%s_%s"
2150 #define SIGTABLE_NAME_FORMAT_LONG "__st_%s_%s_%d"
2151 #define SIGTABLE_TAG_NAME       "__tag"
2152 #define SIGTABLE_VB_OFF_NAME    "__vb_off"
2153 #define SIGTABLE_VT_OFF_NAME    "__vt_off"
2154 #define EXCEPTION_CLEANUP_NAME  "exception cleanup"
2155
2156 #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
2157
2158 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
2159
2160 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2161                               && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
2162 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
2163                                     && IDENTIFIER_POINTER (ID_NODE)[2] == '_') 
2164
2165 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2166   && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
2167   && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2168
2169 #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2170   && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
2171   && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2172
2173 /* Store the vbase pointer field name for type TYPE into pointer BUF.  */
2174 #define FORMAT_VBASE_NAME(BUF,TYPE) do {                                \
2175   BUF = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE)              \
2176                          + sizeof (VBASE_NAME) + 1);                    \
2177   sprintf (BUF, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE));  \
2178 } while (0)
2179
2180 #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
2181 #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
2182
2183 /* For anonymous aggregate types, we need some sort of name to
2184    hold on to.  In practice, this should not appear, but it should
2185    not be harmful if it does.  */
2186 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2187                                   && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
2188 #define ANON_PARMNAME_FORMAT "_%d"
2189 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2190                                   && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
2191 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
2192
2193 /* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
2194    `main'.  */
2195 #define MAIN_NAME_P(ID_NODE) \
2196    (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
2197
2198 /* Returns non-zero iff NODE is a declaration for the global function
2199    `main'.  */
2200 #define DECL_MAIN_P(NODE)                               \
2201    (TREE_CODE (NODE) == FUNCTION_DECL                   \
2202     && DECL_CONTEXT (NODE) == NULL_TREE                 \
2203     && DECL_NAME (NODE) != NULL_TREE                    \
2204     && MAIN_NAME_P (DECL_NAME (NODE)))
2205
2206 \f
2207 /* Define the sets of attributes that member functions and baseclasses
2208    can have.  These are sensible combinations of {public,private,protected}
2209    cross {virtual,non-virtual}.  */
2210
2211 /* in class.c.  */
2212 extern tree access_default_node; /* 0 */
2213 extern tree access_public_node; /* 1 */
2214 extern tree access_protected_node; /* 2 */
2215 extern tree access_private_node; /* 3 */
2216 extern tree access_default_virtual_node; /* 4 */
2217 extern tree access_public_virtual_node; /* 5 */
2218 extern tree access_protected_virtual_node; /* 6 */
2219 extern tree access_private_virtual_node; /* 7 */
2220
2221 /* Things for handling inline functions.  */
2222
2223 struct pending_inline
2224 {
2225   struct pending_inline *next;  /* pointer to next in chain */
2226   int lineno;                   /* line number we got the text from */
2227   char *filename;               /* name of file we were processing */
2228   tree fndecl;                  /* FUNCTION_DECL that brought us here */
2229   int token;                    /* token we were scanning */
2230   int token_value;              /* value of token we were scanning (YYSTYPE) */
2231
2232   char *buf;                    /* pointer to character stream */
2233   int len;                      /* length of stream */
2234   unsigned int can_free : 1;    /* free this after we're done with it? */
2235   unsigned int deja_vu : 1;     /* set iff we don't want to see it again.  */
2236   unsigned int interface : 2;   /* 0=interface 1=unknown 2=implementation */
2237 };
2238
2239 /* in method.c */
2240 extern struct pending_inline *pending_inlines;
2241
2242 /* Positive values means that we cannot make optimizing assumptions about
2243    `this'.  Negative values means we know `this' to be of static type.  */
2244
2245 extern int flag_this_is_variable;
2246
2247 /* Nonzero means generate 'rtti' that give run-time type information.  */
2248
2249 extern int flag_rtti;
2250
2251 /* Nonzero means do emit exported implementations of functions even if
2252    they can be inlined.  */
2253
2254 extern int flag_implement_inlines;
2255
2256 /* Nonzero means templates obey #pragma interface and implementation.  */
2257
2258 extern int flag_external_templates;
2259
2260 /* Nonzero means templates are emitted where they are instantiated.  */
2261
2262 extern int flag_alt_external_templates;
2263
2264 /* Nonzero means implicit template instantiations are emitted.  */
2265
2266 extern int flag_implicit_templates;
2267
2268 /* Nonzero if we want to emit defined symbols with common-like linkage as
2269    weak symbols where possible, in order to conform to C++ semantics.
2270    Otherwise, emit them as local symbols.  */
2271
2272 extern int flag_weak;
2273
2274 /* Nonzero to enable experimental ABI changes.  */
2275
2276 extern int flag_new_abi;
2277
2278 /* Nonzero to not ignore namespace std. */
2279
2280 extern int flag_honor_std;
2281
2282 /* Nonzero if we're done parsing and into end-of-file activities.  */
2283
2284 extern int at_eof;
2285
2286 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
2287
2288 /* The following two can be derived from the previous one */
2289 extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
2290
2291 /* Some macros for char-based bitfields.  */
2292 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
2293 #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
2294 #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
2295
2296 /* These are uses as bits in flags passed to build_method_call
2297    to control its error reporting behavior.
2298
2299    LOOKUP_PROTECT means flag access violations.
2300    LOOKUP_COMPLAIN mean complain if no suitable member function
2301      matching the arguments is found.
2302    LOOKUP_NORMAL is just a combination of these two.
2303    LOOKUP_NONVIRTUAL means make a direct call to the member function found
2304    LOOKUP_GLOBAL means search through the space of overloaded functions,
2305      as well as the space of member functions.
2306    LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
2307      in the parameter list.
2308    LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
2309    DIRECT_BIND means that if a temporary is created, it should be created so
2310      that it lives as long as the current variable bindings; otherwise it
2311      only lives until the end of the complete-expression.
2312    LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
2313      after.  Note, LOOKUP_COMPLAIN is checked and error messages printed
2314      before LOOKUP_SPECULATIVELY is checked.
2315    LOOKUP_NO_CONVERSION means that user-defined conversions are not
2316      permitted.  Built-in conversions are permitted.
2317    LOOKUP_DESTRUCTOR means explicit call to destructor.
2318    LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references.
2319
2320    These are used in global lookup to support elaborated types and
2321    qualifiers.
2322    
2323    LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
2324    LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
2325    LOOKUP_PREFER_BOTH means class-or-namespace-name.
2326    LOOKUP_TEMPLATES_EXPECTED means that class templates also count
2327      as types.  */
2328
2329 #define LOOKUP_PROTECT (1)
2330 #define LOOKUP_COMPLAIN (2)
2331 #define LOOKUP_NORMAL (3)
2332 /* #define LOOKUP_UNUSED (4) */
2333 #define LOOKUP_NONVIRTUAL (8)
2334 #define LOOKUP_GLOBAL (16)
2335 #define LOOKUP_HAS_IN_CHARGE (32)
2336 #define LOOKUP_SPECULATIVELY (64)
2337 #define LOOKUP_ONLYCONVERTING (128)
2338 #define DIRECT_BIND (256)
2339 #define LOOKUP_NO_CONVERSION (512)
2340 #define LOOKUP_DESTRUCTOR (512)
2341 #define LOOKUP_NO_TEMP_BIND (1024)
2342 #define LOOKUP_PREFER_TYPES (2048)
2343 #define LOOKUP_PREFER_NAMESPACES (4096)
2344 #define LOOKUP_PREFER_BOTH (6144)
2345 #define LOOKUP_TEMPLATES_EXPECTED (8192)
2346
2347 #define LOOKUP_NAMESPACES_ONLY(f)  \
2348   (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES))
2349 #define LOOKUP_TYPES_ONLY(f)  \
2350   (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
2351 #define LOOKUP_QUALIFIERS_ONLY(f)     ((f) & LOOKUP_PREFER_BOTH)
2352      
2353
2354 /* These flags are used by the conversion code.
2355    CONV_IMPLICIT   :  Perform implicit conversions (standard and user-defined).
2356    CONV_STATIC     :  Perform the explicit conversions for static_cast.
2357    CONV_CONST      :  Perform the explicit conversions for const_cast.
2358    CONV_REINTERPRET:  Perform the explicit conversions for reinterpret_cast.
2359    CONV_PRIVATE    :  Perform upcasts to private bases.
2360    CONV_FORCE_TEMP :  Require a new temporary when converting to the same
2361                       aggregate type.  */
2362
2363 #define CONV_IMPLICIT    1
2364 #define CONV_STATIC      2
2365 #define CONV_CONST       4
2366 #define CONV_REINTERPRET 8
2367 #define CONV_PRIVATE     16
2368 /* #define CONV_NONCONVERTING 32 */
2369 #define CONV_FORCE_TEMP  64
2370 #define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
2371 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2372                           | CONV_REINTERPRET)
2373 #define CONV_C_CAST      (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2374                           | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
2375
2376 /* Used by build_expr_type_conversion to indicate which types are
2377    acceptable as arguments to the expression under consideration.  */
2378
2379 #define WANT_INT        1 /* integer types, including bool */
2380 #define WANT_FLOAT      2 /* floating point types */
2381 #define WANT_ENUM       4 /* enumerated types */
2382 #define WANT_POINTER    8 /* pointer types */
2383 #define WANT_NULL      16 /* null pointer constant */
2384
2385 #define WANT_ARITH      (WANT_INT | WANT_FLOAT)
2386
2387 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
2388 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
2389
2390 /* These macros are used to access a TEMPLATE_PARM_INDEX.  */
2391 #define TEMPLATE_PARM_IDX(NODE) (((template_parm_index*) NODE)->index)
2392 #define TEMPLATE_PARM_LEVEL(NODE) (((template_parm_index*) NODE)->level)
2393 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
2394 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (((template_parm_index*) NODE)->orig_level)
2395 #define TEMPLATE_PARM_DECL(NODE) (((template_parm_index*) NODE)->decl)
2396
2397 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM 
2398    and TEMPLATE_TEMPLATE_PARM nodes.  */
2399 #define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
2400 #define TEMPLATE_TYPE_IDX(NODE) \
2401   (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2402 #define TEMPLATE_TYPE_LEVEL(NODE) \
2403   (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2404 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
2405   (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2406 #define TEMPLATE_TYPE_DECL(NODE) \
2407   (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2408
2409 /* in lex.c  */
2410 /* Indexed by TREE_CODE, these tables give C-looking names to
2411    operators represented by TREE_CODES.  For example,
2412    opname_tab[(int) MINUS_EXPR] == "-".  */
2413 extern char **opname_tab, **assignop_tab;
2414 \f
2415 /* in call.c */
2416 extern int check_dtor_name                      PROTO((tree, tree));
2417 extern int get_arglist_len_in_bytes             PROTO((tree));
2418
2419 extern tree build_vfield_ref                    PROTO((tree, tree));
2420 extern tree resolve_scope_to_name               PROTO((tree, tree));
2421 extern tree build_scoped_method_call            PROTO((tree, tree, tree, tree));
2422 extern tree build_addr_func                     PROTO((tree));
2423 extern tree build_call                          PROTO((tree, tree, tree));
2424 extern tree build_method_call                   PROTO((tree, tree, tree, tree, int));
2425 extern int null_ptr_cst_p                       PROTO((tree));
2426 extern tree type_decays_to                      PROTO((tree));
2427 extern tree build_user_type_conversion          PROTO((tree, tree, int));
2428 extern tree build_new_function_call             PROTO((tree, tree));
2429 extern tree build_new_op                        PROTO((enum tree_code, int, tree, tree, tree));
2430 extern tree build_op_new_call                   PROTO((enum tree_code, tree, tree, int));
2431 extern tree build_op_delete_call                PROTO((enum tree_code, tree, tree, int, tree));
2432 extern int can_convert                          PROTO((tree, tree));
2433 extern int can_convert_arg                      PROTO((tree, tree, tree));
2434 extern void enforce_access                      PROTO((tree, tree));
2435 extern tree convert_default_arg                 PROTO((tree, tree));
2436 extern tree convert_arg_to_ellipsis             PROTO((tree));
2437
2438 /* in class.c */
2439 extern tree build_vbase_path                    PROTO((enum tree_code, tree, tree, tree, int));
2440 extern tree build_vtbl_ref                      PROTO((tree, tree));
2441 extern tree build_vfn_ref                       PROTO((tree *, tree, tree));
2442 extern void add_method                          PROTO((tree, tree *, tree));
2443 extern int currently_open_class                 PROTO((tree));
2444 extern tree get_vfield_offset                   PROTO((tree));
2445 extern void duplicate_tag_error                 PROTO((tree));
2446 extern tree finish_struct                       PROTO((tree, tree, int));
2447 extern tree finish_struct_1                     PROTO((tree, int));
2448 extern int resolves_to_fixed_type_p             PROTO((tree, int *));
2449 extern void init_class_processing               PROTO((void));
2450 extern int is_empty_class                       PROTO((tree));
2451 extern void pushclass                           PROTO((tree, int));
2452 extern void popclass                            PROTO((int));
2453 extern void push_nested_class                   PROTO((tree, int));
2454 extern void pop_nested_class                    PROTO((int));
2455 extern void push_lang_context                   PROTO((tree));
2456 extern void pop_lang_context                    PROTO((void));
2457 extern tree instantiate_type                    PROTO((tree, tree, int));
2458 extern void print_class_statistics              PROTO((void));
2459 extern void maybe_push_cache_obstack            PROTO((void));
2460 extern unsigned HOST_WIDE_INT skip_rtti_stuff   PROTO((tree *));
2461 extern tree build_self_reference                PROTO((void));
2462 extern void warn_hidden                         PROTO((tree));
2463 extern tree get_enclosing_class                 PROTO((tree));
2464 int is_base_of_enclosing_class                  PROTO((tree, tree));
2465 extern void unreverse_member_declarations       PROTO((tree));
2466
2467 /* in cvt.c */
2468 extern tree convert_to_reference                PROTO((tree, tree, int, int, tree));
2469 extern tree convert_from_reference              PROTO((tree));
2470 extern tree convert_pointer_to_real             PROTO((tree, tree));
2471 extern tree convert_pointer_to                  PROTO((tree, tree));
2472 extern tree ocp_convert                         PROTO((tree, tree, int, int));
2473 extern tree cp_convert                          PROTO((tree, tree));
2474 extern tree convert                             PROTO((tree, tree));
2475 extern tree convert_force                       PROTO((tree, tree, int));
2476 extern tree build_type_conversion               PROTO((enum tree_code, tree, tree, int));
2477 extern tree build_expr_type_conversion          PROTO((int, tree, int));
2478 extern tree type_promotes_to                    PROTO((tree));
2479 extern tree perform_qualification_conversions   PROTO((tree, tree));
2480
2481 /* decl.c */
2482 /* resume_binding_level */
2483 extern void set_identifier_local_value          PROTO((tree, tree));
2484 extern int global_bindings_p                    PROTO((void));
2485 extern int toplevel_bindings_p                  PROTO((void));
2486 extern void keep_next_level                     PROTO((void));
2487 extern int kept_level_p                         PROTO((void));
2488 extern void declare_parm_level                  PROTO((void));
2489 extern void declare_pseudo_global_level         PROTO((void));
2490 extern int pseudo_global_level_p                PROTO((void));
2491 extern void set_class_shadows                   PROTO((tree));
2492 extern void pushlevel                           PROTO((int));
2493 extern void note_level_for_for                  PROTO((void));
2494 extern void pushlevel_temporary                 PROTO((int));
2495 extern tree poplevel                            PROTO((int, int, int));
2496 extern void resume_level                        PROTO((struct binding_level *));
2497 extern void delete_block                        PROTO((tree));
2498 extern void insert_block                        PROTO((tree));
2499 extern void add_block_current_level             PROTO((tree));
2500 extern void set_block                           PROTO((tree));
2501 extern void pushlevel_class                     PROTO((void));
2502 extern tree poplevel_class                      PROTO((int));
2503 extern void print_binding_stack                 PROTO((void));
2504 extern void print_binding_level                 PROTO((struct binding_level *));
2505 extern void push_namespace                      PROTO((tree));
2506 extern void pop_namespace                       PROTO((void));
2507 extern void maybe_push_to_top_level             PROTO((int));
2508 extern void push_to_top_level                   PROTO((void));
2509 extern void pop_from_top_level                  PROTO((void));
2510 extern tree identifier_type_value               PROTO((tree));
2511 extern void set_identifier_type_value           PROTO((tree, tree));
2512 extern void set_identifier_local_value          PROTO((tree, tree));
2513 extern void pop_everything                      PROTO((void));
2514 extern void pushtag                             PROTO((tree, tree, int));
2515 extern tree make_anon_name                      PROTO((void));
2516 extern void clear_anon_tags                     PROTO((void));
2517 extern int decls_match                          PROTO((tree, tree));
2518 extern int duplicate_decls                      PROTO((tree, tree));
2519 extern tree pushdecl                            PROTO((tree));
2520 extern tree pushdecl_top_level                  PROTO((tree));
2521 extern void pushdecl_class_level                PROTO((tree));
2522 #if 0
2523 extern void pushdecl_nonclass_level             PROTO((tree));
2524 #endif
2525 extern tree pushdecl_namespace_level            PROTO((tree));
2526 extern tree push_using_decl                     PROTO((tree, tree));
2527 extern tree push_using_directive                PROTO((tree));
2528 extern void push_class_level_binding            PROTO((tree, tree));
2529 extern tree push_using_decl                     PROTO((tree, tree));
2530 extern tree implicitly_declare                  PROTO((tree));
2531 extern tree lookup_label                        PROTO((tree));
2532 extern tree shadow_label                        PROTO((tree));
2533 extern tree define_label                        PROTO((char *, int, tree));
2534 extern void push_switch                         PROTO((void));
2535 extern void pop_switch                          PROTO((void));
2536 extern void define_case_label                   PROTO((void));
2537 extern tree getdecls                            PROTO((void));
2538 extern tree gettags                             PROTO((void));
2539 #if 0
2540 extern void set_current_level_tags_transparency PROTO((int));
2541 #endif
2542 extern tree binding_for_name                    PROTO((tree, tree));
2543 extern tree namespace_binding                   PROTO((tree, tree));
2544 extern void set_namespace_binding               PROTO((tree, tree, tree));
2545 extern tree lookup_namespace_name               PROTO((tree, tree));
2546 extern tree make_typename_type                  PROTO((tree, tree));
2547 extern tree lookup_name_nonclass                PROTO((tree));
2548 extern tree lookup_function_nonclass            PROTO((tree, tree));
2549 extern tree lookup_name                         PROTO((tree, int));
2550 extern tree lookup_name_current_level           PROTO((tree));
2551 extern tree lookup_type_current_level           PROTO((tree));
2552 extern tree lookup_name_namespace_only          PROTO((tree));
2553 extern void begin_only_namespace_names          PROTO((void));
2554 extern void end_only_namespace_names            PROTO((void));
2555 extern tree namespace_ancestor                  PROTO((tree, tree));
2556 extern int  lookup_using_namespace              PROTO((tree,tree,tree,tree,int));
2557 extern int  qualified_lookup_using_namespace    PROTO((tree,tree,tree,int));
2558 extern tree auto_function                       PROTO((tree, tree, enum built_in_function));
2559 extern void init_decl_processing                PROTO((void));
2560 extern int init_type_desc                       PROTO((void));
2561 extern tree define_function
2562         PROTO((char *, tree, enum built_in_function,
2563                void (*) (tree), char *));
2564 extern void shadow_tag                          PROTO((tree));
2565 extern tree groktypename                        PROTO((tree));
2566 extern tree start_decl                          PROTO((tree, tree, int, tree, tree));
2567 extern void start_decl_1                        PROTO((tree));
2568 extern void cp_finish_decl                      PROTO((tree, tree, tree, int, int));
2569 extern void finish_decl                         PROTO((tree, tree, tree));
2570 extern void expand_static_init                  PROTO((tree, tree));
2571 extern int complete_array_type                  PROTO((tree, tree, int));
2572 extern tree build_ptrmemfunc_type               PROTO((tree));
2573 /* the grokdeclarator prototype is in decl.h */
2574 extern int parmlist_is_exprlist                 PROTO((tree));
2575 extern int copy_args_p                          PROTO((tree));
2576 extern int grok_ctor_properties                 PROTO((tree, tree));
2577 extern void grok_op_properties                  PROTO((tree, int, int));
2578 extern tree xref_tag                            PROTO((tree, tree, int));
2579 extern tree xref_tag_from_type                  PROTO((tree, tree, int));
2580 extern void xref_basetypes                      PROTO((tree, tree, tree, tree));
2581 extern tree start_enum                          PROTO((tree));
2582 extern tree finish_enum                         PROTO((tree));
2583 extern tree build_enumerator                    PROTO((tree, tree, tree));
2584 extern int start_function                       PROTO((tree, tree, tree, int));
2585 extern void expand_start_early_try_stmts        PROTO((void));
2586 extern void store_parm_decls                    PROTO((void));
2587 extern void store_return_init                   PROTO((tree, tree));
2588 extern void finish_function                     PROTO((int, int, int));
2589 extern tree start_method                        PROTO((tree, tree, tree));
2590 extern tree finish_method                       PROTO((tree));
2591 extern void hack_incomplete_structures          PROTO((tree));
2592 extern tree maybe_build_cleanup_and_delete      PROTO((tree));
2593 extern tree maybe_build_cleanup                 PROTO((tree));
2594 extern void cplus_expand_expr_stmt              PROTO((tree));
2595 extern void finish_stmt                         PROTO((void));
2596 extern int id_in_current_class                  PROTO((tree));
2597 extern void push_cp_function_context            PROTO((tree));
2598 extern void pop_cp_function_context             PROTO((tree));
2599 extern int in_function_p                        PROTO((void));
2600 extern void replace_defarg                      PROTO((tree, tree));
2601 extern void print_other_binding_stack           PROTO((struct binding_level *));
2602 extern void revert_static_member_fn             PROTO((tree*, tree*, tree*));
2603 extern void cat_namespace_levels                PROTO((void));
2604 extern void fixup_anonymous_union               PROTO((tree));
2605
2606 /* in decl2.c */
2607 extern int check_java_method                    PROTO((tree));
2608 extern int lang_decode_option                   PROTO((int, char **));
2609 extern tree grok_method_quals                   PROTO((tree, tree, tree));
2610 extern void warn_if_unknown_interface           PROTO((tree));
2611 extern void grok_x_components                   PROTO((tree));
2612 extern void maybe_retrofit_in_chrg              PROTO((tree));
2613 extern void maybe_make_one_only                 PROTO((tree));
2614 extern void grokclassfn                         PROTO((tree, tree, enum overload_flags, tree));
2615 extern tree grok_alignof                        PROTO((tree));
2616 extern tree grok_array_decl                     PROTO((tree, tree));
2617 extern tree delete_sanity                       PROTO((tree, tree, int, int));
2618 extern tree check_classfn                       PROTO((tree, tree));
2619 extern void check_member_template               PROTO((tree));
2620 extern tree grokfield                           PROTO((tree, tree, tree, tree, tree));
2621 extern tree grokbitfield                        PROTO((tree, tree, tree));
2622 extern tree groktypefield                       PROTO((tree, tree));
2623 extern tree grokoptypename                      PROTO((tree, tree));
2624 extern int copy_assignment_arg_p                PROTO((tree, int));
2625 extern void cplus_decl_attributes               PROTO((tree, tree, tree)); 
2626 extern tree constructor_name_full               PROTO((tree));
2627 extern tree constructor_name                    PROTO((tree));
2628 extern void setup_vtbl_ptr                      PROTO((void));
2629 extern void mark_inline_for_output              PROTO((tree));
2630 extern void clear_temp_name                     PROTO((void));
2631 extern tree get_temp_name                       PROTO((tree, int));
2632 extern tree get_temp_regvar                     PROTO((tree, tree));
2633 extern void finish_anon_union                   PROTO((tree));
2634 extern tree finish_table                        PROTO((tree, tree, tree, int));
2635 extern void finish_builtin_type                 PROTO((tree, char *, tree *, int, tree));
2636 extern tree coerce_new_type                     PROTO((tree));
2637 extern tree coerce_delete_type                  PROTO((tree));
2638 extern void comdat_linkage                      PROTO((tree));
2639 extern void import_export_class                 PROTO((tree));
2640 extern void import_export_vtable                PROTO((tree, tree, int));
2641 extern int finish_prevtable_vardecl             PROTO((tree, tree));
2642 extern int walk_vtables                         PROTO((void (*)(tree, tree),
2643                                                        int (*)(tree, tree)));
2644 extern void walk_sigtables                      PROTO((void (*)(tree, tree),
2645                                                        void (*)(tree, tree)));
2646 extern void import_export_decl                  PROTO((tree));
2647 extern tree build_cleanup                       PROTO((tree));
2648 extern void finish_file                         PROTO((void));
2649 extern tree reparse_absdcl_as_expr              PROTO((tree, tree));
2650 extern tree reparse_absdcl_as_casts             PROTO((tree, tree));
2651 extern tree build_expr_from_tree                PROTO((tree));
2652 extern tree reparse_decl_as_expr                PROTO((tree, tree));
2653 extern tree finish_decl_parsing                 PROTO((tree));
2654 extern tree check_cp_case_value                 PROTO((tree));
2655 extern void set_decl_namespace                  PROTO((tree, tree));
2656 extern tree current_decl_namespace              PROTO((void));
2657 extern void push_decl_namespace                 PROTO((tree));
2658 extern void pop_decl_namespace                  PROTO((void));
2659 extern void do_namespace_alias                  PROTO((tree, tree));
2660 extern void do_toplevel_using_decl              PROTO((tree));
2661 extern void do_local_using_decl                 PROTO((tree));
2662 extern tree do_class_using_decl                 PROTO((tree));
2663 extern void do_using_directive                  PROTO((tree));
2664 extern void check_default_args                  PROTO((tree));
2665 extern void mark_used                           PROTO((tree));
2666 extern tree handle_class_head                   PROTO((tree, tree, tree));
2667 extern tree lookup_arg_dependent                PROTO((tree, tree, tree));
2668
2669 /* in errfn.c */
2670 extern void cp_error                            ();
2671 extern void cp_error_at                         ();
2672 extern void cp_warning                          ();
2673 extern void cp_warning_at                       ();
2674 extern void cp_pedwarn                          ();
2675 extern void cp_pedwarn_at                       ();
2676 extern void cp_compiler_error                   ();
2677 extern void cp_sprintf                          ();
2678
2679 /* in error.c */
2680 extern void init_error                          PROTO((void));
2681 extern char *fndecl_as_string                   PROTO((tree, int));
2682 extern char *type_as_string                     PROTO((tree, int));
2683 extern char *type_as_string_real                PROTO((tree, int, int));
2684 extern char *args_as_string                     PROTO((tree, int));
2685 extern char *decl_as_string                     PROTO((tree, int));
2686 extern char *expr_as_string                     PROTO((tree, int));
2687 extern char *code_as_string                     PROTO((enum tree_code, int));
2688 extern char *language_as_string                 PROTO((enum languages, int));
2689 extern char *parm_as_string                     PROTO((int, int));
2690 extern char *op_as_string                       PROTO((enum tree_code, int));
2691 extern char *assop_as_string                    PROTO((enum tree_code, int));
2692 extern char *cv_as_string                       PROTO((tree, int));
2693 extern char *lang_decl_name                     PROTO((tree, int));
2694 extern char *cp_file_of                         PROTO((tree));
2695 extern int cp_line_of                           PROTO((tree));
2696
2697 /* in except.c */
2698 extern void init_exception_processing           PROTO((void));
2699 extern void expand_start_catch_block            PROTO((tree, tree));
2700 extern void expand_end_catch_block              PROTO((void));
2701 extern void expand_builtin_throw                PROTO((void));
2702 extern void expand_start_eh_spec                PROTO((void));
2703 extern void expand_exception_blocks             PROTO((void));
2704 extern tree start_anon_func                     PROTO((void));
2705 extern void end_anon_func                       PROTO((void));
2706 extern void expand_throw                        PROTO((tree));
2707 extern tree build_throw                         PROTO((tree));
2708 extern void mark_all_runtime_matches            PROTO((void));
2709
2710 /* in expr.c */
2711 extern void init_cplus_expand                   PROTO((void));
2712 extern void fixup_result_decl                   PROTO((tree, struct rtx_def *));
2713 extern int extract_init                         PROTO((tree, tree));
2714 extern void do_case                             PROTO((tree, tree));
2715
2716 /* friend.c */
2717 extern int is_friend                            PROTO((tree, tree));
2718 extern void make_friend_class                   PROTO((tree, tree));
2719 extern tree do_friend                           PROTO((tree, tree, tree, tree, enum overload_flags, tree, int));
2720
2721 /* in init.c */
2722 extern void init_init_processing                PROTO((void));
2723 extern void expand_direct_vtbls_init            PROTO((tree, tree, int, int, tree));
2724 extern void emit_base_init                      PROTO((tree, int));
2725 extern void check_base_init                     PROTO((tree));
2726 extern void expand_member_init                  PROTO((tree, tree, tree));
2727 extern void expand_aggr_init                    PROTO((tree, tree, int));
2728 extern int is_aggr_typedef                      PROTO((tree, int));
2729 extern int is_aggr_type                         PROTO((tree, int));
2730 extern tree get_aggr_from_typedef               PROTO((tree, int));
2731 extern tree get_type_value                      PROTO((tree));
2732 extern tree build_member_call                   PROTO((tree, tree, tree));
2733 extern tree build_offset_ref                    PROTO((tree, tree));
2734 extern tree resolve_offset_ref                  PROTO((tree));
2735 extern tree decl_constant_value                 PROTO((tree));
2736 extern tree build_new                           PROTO((tree, tree, tree, int));
2737 extern tree build_new_1                         PROTO((tree));
2738 extern tree expand_vec_init                     PROTO((tree, tree, tree, tree, int));
2739 extern tree build_x_delete                      PROTO((tree, int, tree));
2740 extern tree build_delete                        PROTO((tree, tree, tree, int, int));
2741 extern tree build_vbase_delete                  PROTO((tree, tree));
2742 extern tree build_vec_delete                    PROTO((tree, tree, tree, tree, int));
2743
2744 /* in input.c */
2745
2746 /* in lex.c */
2747 extern char *file_name_nondirectory             PROTO((char *));
2748 extern tree make_pointer_declarator             PROTO((tree, tree));
2749 extern tree make_reference_declarator           PROTO((tree, tree));
2750 extern tree make_call_declarator                PROTO((tree, tree, tree, tree));
2751 extern void set_quals_and_spec                  PROTO((tree, tree, tree));
2752 extern char *operator_name_string               PROTO((tree));
2753 extern void lang_init                           PROTO((void));
2754 extern void lang_finish                         PROTO((void));
2755 extern void init_filename_times                 PROTO((void));
2756 #if 0
2757 extern void reinit_lang_specific                PROTO((void));
2758 #endif
2759 extern void reinit_parse_for_function           PROTO((void));
2760 extern void print_parse_statistics              PROTO((void));
2761 extern void extract_interface_info              PROTO((void));
2762 extern void do_pending_inlines                  PROTO((void));
2763 extern void process_next_inline                 PROTO((tree));
2764 extern struct pending_input *save_pending_input PROTO((void));
2765 extern void restore_pending_input               PROTO((struct pending_input *));
2766 extern void yyungetc                            PROTO((int, int));
2767 extern void reinit_parse_for_method             PROTO((int, tree));
2768 extern void reinit_parse_for_block              PROTO((int, struct obstack *));
2769 extern tree cons_up_default_function            PROTO((tree, tree, int));
2770 extern void check_for_missing_semicolon         PROTO((tree));
2771 extern void note_got_semicolon                  PROTO((tree));
2772 extern void note_list_got_semicolon             PROTO((tree));
2773 extern void do_pending_lang_change              PROTO((void));
2774 extern int identifier_type                      PROTO((tree));
2775 extern void see_typename                        PROTO((void));
2776 extern tree do_identifier                       PROTO((tree, int, tree));
2777 extern tree do_scoped_id                        PROTO((tree, int));
2778 extern tree identifier_typedecl_value           PROTO((tree));
2779 extern int real_yylex                           PROTO((void));
2780 extern int is_rid                               PROTO((tree));
2781 extern tree build_lang_decl                     PROTO((enum tree_code, tree, tree));
2782 extern tree build_lang_field_decl               PROTO((enum tree_code, tree, tree));
2783 extern void copy_lang_decl                      PROTO((tree));
2784 extern tree make_lang_type                      PROTO((enum tree_code));
2785 extern void dump_time_statistics                PROTO((void));
2786 /* extern void compiler_error                   PROTO((char *, HOST_WIDE_INT, HOST_WIDE_INT)); */
2787 extern void yyerror                             PROTO((char *));
2788 extern void clear_inline_text_obstack           PROTO((void));
2789 extern void maybe_snarf_defarg                  PROTO((void));
2790 extern tree snarf_defarg                        PROTO((void));
2791 extern void add_defarg_fn                       PROTO((tree));
2792 extern void do_pending_defargs                  PROTO((void));
2793 extern int identifier_type                      PROTO((tree));
2794 extern void yyhook                              PROTO((int));
2795
2796 /* in method.c */
2797 extern void init_method                         PROTO((void));
2798 extern void do_inline_function_hair             PROTO((tree, tree));
2799 extern char *build_overload_name                PROTO((tree, int, int));
2800 extern tree build_static_name                   PROTO((tree, tree));
2801 extern tree build_decl_overload                 PROTO((tree, tree, int));
2802 extern tree build_decl_overload_real            PROTO((tree, tree, tree, tree,
2803                                                        tree, int)); 
2804 extern void set_mangled_name_for_decl           PROTO((tree));
2805 extern tree build_typename_overload             PROTO((tree));
2806 extern tree build_overload_with_type            PROTO((tree, tree));
2807 extern tree build_destructor_name               PROTO((tree));
2808 extern tree build_opfncall                      PROTO((enum tree_code, int, tree, tree, tree));
2809 extern tree hack_identifier                     PROTO((tree, tree));
2810 extern tree make_thunk                          PROTO((tree, int));
2811 extern void emit_thunk                          PROTO((tree));
2812 extern void synthesize_method                   PROTO((tree));
2813 extern tree get_id_2                            PROTO((char *, tree));
2814
2815 /* in pt.c */
2816 extern tree innermost_args                      PROTO ((tree));
2817 extern tree tsubst                              PROTO ((tree, tree, tree));
2818 extern tree tsubst_expr                         PROTO ((tree, tree, tree));
2819 extern tree tsubst_copy                         PROTO ((tree, tree, tree));
2820 extern void maybe_begin_member_template_processing PROTO((tree));
2821 extern void maybe_end_member_template_processing PROTO((void));
2822 extern tree finish_member_template_decl         PROTO((tree));
2823 extern void begin_template_parm_list            PROTO((void));
2824 extern void begin_specialization                PROTO((void));
2825 extern void reset_specialization                PROTO((void));
2826 extern void end_specialization                  PROTO((void));
2827 extern void begin_explicit_instantiation        PROTO((void));
2828 extern void end_explicit_instantiation          PROTO((void));
2829 extern tree determine_specialization            PROTO((tree, tree, tree *, int, int));
2830 extern tree check_explicit_specialization       PROTO((tree, tree, int, int));
2831 extern tree process_template_parm               PROTO((tree, tree));
2832 extern tree end_template_parm_list              PROTO((tree));
2833 extern void end_template_decl                   PROTO((void));
2834 extern tree current_template_args               PROTO((void));
2835 extern tree push_template_decl                  PROTO((tree));
2836 extern tree push_template_decl_real             PROTO((tree, int));
2837 extern void redeclare_class_template            PROTO((tree, tree));
2838 extern tree lookup_template_class               PROTO((tree, tree, tree, tree, int));
2839 extern tree lookup_template_function            PROTO((tree, tree));
2840 extern int uses_template_parms                  PROTO((tree));
2841 extern tree instantiate_class_template          PROTO((tree));
2842 extern tree instantiate_template                PROTO((tree, tree));
2843 extern void overload_template_name              PROTO((tree));
2844 extern int fn_type_unification                  PROTO((tree, tree, tree, tree, tree, unification_kind_t, tree));
2845 extern int type_unification                     PROTO((tree, tree, tree, tree, tree, unification_kind_t, int));
2846 struct tinst_level *tinst_for_decl              PROTO((void));
2847 extern void mark_decl_instantiated              PROTO((tree, int));
2848 extern int more_specialized                     PROTO((tree, tree, tree));
2849 extern void mark_class_instantiated             PROTO((tree, int));
2850 extern void do_decl_instantiation               PROTO((tree, tree, tree));
2851 extern void do_type_instantiation               PROTO((tree, tree));
2852 extern tree instantiate_decl                    PROTO((tree));
2853 extern tree do_poplevel                         PROTO((void));
2854 extern tree get_bindings                        PROTO((tree, tree, tree));
2855 /* CONT ... */
2856 extern void add_tree                            PROTO((tree));
2857 extern void begin_tree                          PROTO((void));
2858 extern void end_tree                            PROTO((void));
2859 extern void add_maybe_template                  PROTO((tree, tree));
2860 extern void pop_tinst_level                     PROTO((void));
2861 extern int more_specialized_class               PROTO((tree, tree));
2862 extern void do_pushlevel                        PROTO((void));
2863 extern int is_member_template                   PROTO((tree));
2864 extern int template_parms_equal                 PROTO((tree, tree));
2865 extern int comp_template_parms                  PROTO((tree, tree));
2866 extern int decl_template_parm_p                 PROTO((tree));
2867 extern int template_class_depth                 PROTO((tree));
2868 extern int is_specialization_of                 PROTO((tree, tree));
2869 extern int comp_template_args                   PROTO((tree, tree));
2870 extern void maybe_process_partial_specialization PROTO((tree));
2871 extern void maybe_check_template_type           PROTO((tree));
2872
2873 extern int processing_specialization;
2874 extern int processing_explicit_instantiation;
2875 extern int processing_template_parmlist;
2876
2877 /* in repo.c */
2878 extern void repo_template_used                  PROTO((tree));
2879 extern void repo_template_instantiated          PROTO((tree, int));
2880 extern void init_repo                           PROTO((char*));
2881 extern void finish_repo                         PROTO((void));
2882
2883 /* in rtti.c */
2884 extern void init_rtti_processing                PROTO((void));
2885 extern tree get_tinfo_fn_dynamic                PROTO((tree));
2886 extern tree build_typeid                        PROTO((tree));
2887 extern tree build_x_typeid                      PROTO((tree));
2888 extern tree get_tinfo_fn                        PROTO((tree));
2889 extern tree get_typeid                          PROTO((tree));
2890 extern tree build_dynamic_cast                  PROTO((tree, tree));
2891 extern void synthesize_tinfo_fn                 PROTO((tree));
2892
2893 /* in search.c */
2894 extern int types_overlap_p                      PROTO((tree, tree));
2895 extern tree get_vbase                           PROTO((tree, tree));
2896 extern tree get_binfo                           PROTO((tree, tree, int));
2897 extern int get_base_distance                    PROTO((tree, tree, int, tree *));
2898 extern tree compute_access                      PROTO((tree, tree));
2899 extern tree lookup_field                        PROTO((tree, tree, int, int));
2900 extern tree lookup_nested_field                 PROTO((tree, int));
2901 extern tree lookup_fnfields                     PROTO((tree, tree, int));
2902 extern tree lookup_member                       PROTO((tree, tree, int, int));
2903 extern tree lookup_nested_tag                   PROTO((tree, tree));
2904 extern tree get_matching_virtual                PROTO((tree, tree, int));
2905 extern tree get_abstract_virtuals               PROTO((tree));
2906 extern tree get_baselinks                       PROTO((tree, tree, tree));
2907 extern tree next_baselink                       PROTO((tree));
2908 extern tree init_vbase_pointers                 PROTO((tree, tree));
2909 extern void expand_indirect_vtbls_init          PROTO((tree, tree, tree));
2910 extern void clear_search_slots                  PROTO((tree));
2911 extern tree get_vbase_types                     PROTO((tree));
2912 extern void note_debug_info_needed              PROTO((tree));
2913 extern void push_class_decls                    PROTO((tree));
2914 extern void pop_class_decls                     PROTO((void));
2915 extern void unuse_fields                        PROTO((tree));
2916 extern void print_search_statistics             PROTO((void));
2917 extern void init_search_processing              PROTO((void));
2918 extern void reinit_search_statistics            PROTO((void));
2919 extern tree current_scope                       PROTO((void));
2920 extern tree lookup_conversions                  PROTO((tree));
2921 extern tree get_template_base                   PROTO((tree, tree));
2922 extern tree binfo_for_vtable                    PROTO((tree));
2923
2924 /* in semantics.c */
2925 extern void finish_expr_stmt                    PROTO((tree));
2926 extern tree begin_if_stmt                       PROTO((void));
2927 extern void finish_if_stmt_cond                 PROTO((tree, tree));
2928 extern tree finish_then_clause                  PROTO((tree));
2929 extern void begin_else_clause                   PROTO((void));
2930 extern void finish_else_clause                  PROTO((tree));
2931 extern void finish_if_stmt                      PROTO((void));
2932 extern tree begin_while_stmt                    PROTO((void));
2933 extern void finish_while_stmt_cond              PROTO((tree, tree));
2934 extern void finish_while_stmt                   PROTO((tree));
2935 extern tree begin_do_stmt                       PROTO((void));
2936 extern void finish_do_body                      PROTO((tree));
2937 extern void finish_do_stmt                      PROTO((tree, tree));
2938 extern void finish_return_stmt                  PROTO((tree));
2939 extern tree begin_for_stmt                      PROTO((void));
2940 extern void finish_for_init_stmt                PROTO((tree));
2941 extern void finish_for_cond                     PROTO((tree, tree));
2942 extern void finish_for_expr                     PROTO((tree, tree));
2943 extern void finish_for_stmt                     PROTO((tree, tree));
2944 extern void finish_break_stmt                   PROTO((void));
2945 extern void finish_continue_stmt                PROTO((void));
2946 extern void begin_switch_stmt                   PROTO((void));
2947 extern tree finish_switch_cond                  PROTO((tree));
2948 extern void finish_switch_stmt                  PROTO((tree, tree));
2949 extern void finish_case_label                   PROTO((tree, tree));
2950 extern void finish_goto_stmt                    PROTO((tree));
2951 extern tree begin_try_block                     PROTO((void));
2952 extern void finish_try_block                    PROTO((tree));
2953 extern void finish_handler_sequence             PROTO((tree));
2954 extern tree begin_handler                       PROTO((void));
2955 extern void finish_handler_parms                PROTO((tree));
2956 extern void finish_handler                      PROTO((tree));
2957 extern tree begin_compound_stmt                 PROTO((int));
2958 extern tree finish_compound_stmt                PROTO((int, tree));
2959 extern void finish_asm_stmt                     PROTO((tree, tree, tree, tree, tree));
2960 extern tree finish_parenthesized_expr           PROTO((tree));
2961 extern tree begin_stmt_expr                     PROTO((void));
2962 extern tree finish_stmt_expr                    PROTO((tree, tree));
2963 extern tree finish_call_expr                    PROTO((tree, tree, int));
2964 extern tree finish_increment_expr               PROTO((tree, enum tree_code));
2965 extern tree finish_this_expr                    PROTO((void));
2966 extern tree finish_object_call_expr             PROTO((tree, tree, tree));
2967 extern tree finish_qualified_object_call_expr   PROTO((tree, tree, tree));
2968 extern tree finish_pseudo_destructor_call_expr  PROTO((tree, tree, tree));
2969 extern tree finish_qualified_call_expr          PROTO ((tree, tree));
2970 extern tree finish_label_address_expr           PROTO((tree));
2971 extern tree finish_unary_op_expr                PROTO((enum tree_code, tree));
2972 extern tree finish_id_expr                      PROTO((tree));
2973 extern int  begin_new_placement                 PROTO((void));
2974 extern tree finish_new_placement                PROTO((tree, int));
2975 extern int begin_function_definition            PROTO((tree, tree));
2976 extern tree begin_constructor_declarator        PROTO((tree, tree));
2977 extern tree finish_declarator                   PROTO((tree, tree, tree, tree, int));
2978 extern void finish_translation_unit             PROTO((void));
2979 extern tree finish_template_type_parm           PROTO((tree, tree));
2980 extern tree finish_template_template_parm       PROTO((tree, tree));
2981 extern tree finish_parmlist                     PROTO((tree, int));
2982 extern tree begin_class_definition              PROTO((tree));
2983 extern tree finish_class_definition             PROTO((tree, tree, int));
2984 extern void finish_default_args                 PROTO((void));
2985 extern void begin_inline_definitions            PROTO((void));
2986 extern tree finish_member_class_template        PROTO((tree));
2987 extern void finish_template_decl                PROTO((tree));
2988 extern tree finish_template_type                PROTO((tree, tree, int));
2989 extern void enter_scope_of                      PROTO((tree));
2990 extern tree finish_base_specifier               PROTO((tree, tree, int));
2991 extern void finish_member_declaration           PROTO((tree));
2992 extern void check_multiple_declarators          PROTO((void));
2993
2994 /* in sig.c */
2995 extern tree build_signature_pointer_type        PROTO((tree));
2996 extern tree build_signature_reference_type      PROTO((tree));
2997 extern tree build_signature_pointer_constructor PROTO((tree, tree));
2998 extern tree build_signature_method_call         PROTO((tree, tree));
2999 extern tree build_optr_ref                      PROTO((tree));
3000 extern void append_signature_fields             PROTO((tree));
3001
3002 /* in spew.c */
3003 extern void init_spew                           PROTO((void));
3004 extern int peekyylex                            PROTO((void));
3005 extern int yylex                                PROTO((void));
3006 extern tree arbitrate_lookup                    PROTO((tree, tree, tree));
3007
3008 /* in tree.c */
3009 extern void unshare_base_binfos                 PROTO((tree));
3010 extern int member_p                             PROTO((tree));
3011 extern int real_lvalue_p                        PROTO((tree));
3012 extern tree build_min                           PVPROTO((enum tree_code, tree, ...));
3013 extern tree build_min_nt                        PVPROTO((enum tree_code, ...));
3014 extern tree min_tree_cons                       PROTO((tree, tree, tree));
3015 extern int lvalue_p                             PROTO((tree));
3016 extern int lvalue_or_else                       PROTO((tree, char *));
3017 extern tree build_cplus_new                     PROTO((tree, tree));
3018 extern tree get_target_expr                     PROTO((tree));
3019 extern tree break_out_cleanups                  PROTO((tree));
3020 extern tree break_out_calls                     PROTO((tree));
3021 extern tree build_cplus_method_type             PROTO((tree, tree, tree));
3022 extern tree build_cplus_staticfn_type           PROTO((tree, tree, tree));
3023 extern tree build_cplus_array_type              PROTO((tree, tree));
3024 extern int layout_basetypes                     PROTO((tree, int));
3025 extern tree build_vbase_pointer_fields          PROTO((tree));
3026 extern tree build_base_fields                   PROTO((tree));
3027 extern tree hash_tree_cons                      PROTO((int, int, int, tree, tree, tree));
3028 extern tree hash_tree_chain                     PROTO((tree, tree));
3029 extern tree hash_chainon                        PROTO((tree, tree));
3030 extern tree get_decl_list                       PROTO((tree));
3031 extern tree make_binfo                          PROTO((tree, tree, tree, tree));
3032 extern tree binfo_value                         PROTO((tree, tree));
3033 extern tree reverse_path                        PROTO((tree));
3034 extern int count_functions                      PROTO((tree));
3035 extern int is_overloaded_fn                     PROTO((tree));
3036 extern tree get_first_fn                        PROTO((tree));
3037 extern tree binding_init                        PROTO((struct tree_binding*));
3038 extern tree ovl_cons                            PROTO((tree, tree));
3039 extern tree scratch_ovl_cons                    PROTO((tree, tree));
3040 extern int ovl_member                           PROTO((tree, tree));
3041 extern tree build_overload                      PROTO((tree, tree));
3042 extern tree fnaddr_from_vtable_entry            PROTO((tree));
3043 extern tree function_arg_chain                  PROTO((tree));
3044 extern int promotes_to_aggr_type                PROTO((tree, enum tree_code));
3045 extern int is_aggr_type_2                       PROTO((tree, tree));
3046 extern char *lang_printable_name                PROTO((tree, int));
3047 extern tree build_exception_variant             PROTO((tree, tree));
3048 extern tree copy_template_template_parm         PROTO((tree));
3049 extern tree copy_to_permanent                   PROTO((tree));
3050 extern void print_lang_statistics               PROTO((void));
3051 extern void __eprintf
3052         PROTO((const char *, const char *, unsigned, const char *));
3053 extern tree array_type_nelts_total              PROTO((tree));
3054 extern tree array_type_nelts_top                PROTO((tree));
3055 extern tree break_out_target_exprs              PROTO((tree));
3056 extern tree get_type_decl                       PROTO((tree));
3057 extern tree vec_binfo_member                    PROTO((tree, tree));
3058 extern tree hack_decl_function_context          PROTO((tree));
3059 extern tree lvalue_type                         PROTO((tree));
3060 extern tree error_type                          PROTO((tree));
3061 extern tree make_temp_vec                       PROTO((int));
3062 extern tree build_ptr_wrapper                   PROTO((void *));
3063 extern tree build_expr_ptr_wrapper              PROTO((void *));
3064 extern tree build_int_wrapper                   PROTO((int));
3065 extern tree build_srcloc                        PROTO((char *, int));
3066 extern tree build_srcloc_here                   PROTO((void));
3067 extern int varargs_function_p                   PROTO((tree));
3068 extern int really_overloaded_fn                 PROTO((tree));
3069 extern int cp_tree_equal                        PROTO((tree, tree));
3070 extern int can_free                             PROTO((struct obstack *, tree));
3071 extern tree mapcar                              PROTO((tree, tree (*) (tree)));
3072 extern tree no_linkage_check                    PROTO((tree));
3073 extern void debug_binfo                         PROTO((tree));
3074 extern void push_expression_obstack             PROTO((void));
3075 #define scratchalloc expralloc
3076 #define scratch_tree_cons expr_tree_cons
3077 #define build_scratch_list build_expr_list
3078 #define make_scratch_vec make_temp_vec
3079 #define push_scratch_obstack push_expression_obstack
3080 #define hash_tree_cons_simple(PURPOSE, VALUE, CHAIN) \
3081   hash_tree_cons (0, 0, 0, (PURPOSE), (VALUE), (CHAIN))
3082
3083 /* in typeck.c */
3084 extern int string_conv_p                        PROTO((tree, tree, int));
3085 extern tree condition_conversion                PROTO((tree));
3086 extern tree target_type                         PROTO((tree));
3087 extern tree require_complete_type               PROTO((tree));
3088 extern tree complete_type                       PROTO((tree));
3089 extern tree complete_type_or_else               PROTO((tree));
3090 extern int type_unknown_p                       PROTO((tree));
3091 extern int fntype_p                             PROTO((tree));
3092 extern tree require_instantiated_type           PROTO((tree, tree, tree));
3093 extern tree commonparms                         PROTO((tree, tree));
3094 extern tree original_type                       PROTO((tree));
3095 extern tree common_type                         PROTO((tree, tree));
3096 extern int compexcepttypes                      PROTO((tree, tree));
3097 extern int comptypes                            PROTO((tree, tree, int));
3098 extern int comp_target_types                    PROTO((tree, tree, int));
3099 extern int compparms                            PROTO((tree, tree, int));
3100 extern int comp_target_types                    PROTO((tree, tree, int));
3101 extern int comp_cv_qualification                PROTO((tree, tree));
3102 extern int comp_cv_qual_signature               PROTO((tree, tree));
3103 extern int self_promoting_args_p                PROTO((tree));
3104 extern tree unsigned_type                       PROTO((tree));
3105 extern tree signed_type                         PROTO((tree));
3106 extern tree signed_or_unsigned_type             PROTO((int, tree));
3107 extern tree expr_sizeof                         PROTO((tree));
3108 extern tree c_sizeof                            PROTO((tree));
3109 extern tree c_sizeof_nowarn                     PROTO((tree));
3110 extern tree c_alignof                           PROTO((tree));
3111 extern tree inline_conversion                   PROTO((tree));
3112 extern tree decay_conversion                    PROTO((tree));
3113 extern tree default_conversion                  PROTO((tree));
3114 extern tree build_object_ref                    PROTO((tree, tree, tree));
3115 extern tree build_component_ref_1               PROTO((tree, tree, int));
3116 extern tree build_component_ref                 PROTO((tree, tree, tree, int));
3117 extern tree build_x_component_ref               PROTO((tree, tree, tree, int));
3118 extern tree build_x_indirect_ref                PROTO((tree, char *));
3119 extern tree build_indirect_ref                  PROTO((tree, char *));
3120 extern tree build_array_ref                     PROTO((tree, tree));
3121 extern tree build_x_function_call               PROTO((tree, tree, tree));
3122 extern tree get_member_function_from_ptrfunc    PROTO((tree *, tree));
3123 extern tree build_function_call_real            PROTO((tree, tree, int, int));
3124 extern tree build_function_call                 PROTO((tree, tree));
3125 extern tree build_function_call_maybe           PROTO((tree, tree));
3126 extern tree convert_arguments                   PROTO((tree, tree, tree, int));
3127 extern tree build_x_binary_op                   PROTO((enum tree_code, tree, tree));
3128 extern tree build_binary_op                     PROTO((enum tree_code, tree, tree, int));
3129 extern tree build_binary_op_nodefault           PROTO((enum tree_code, tree, tree, enum tree_code));
3130 extern tree build_component_addr                PROTO((tree, tree, char *));
3131 extern tree build_x_unary_op                    PROTO((enum tree_code, tree));
3132 extern tree build_unary_op                      PROTO((enum tree_code, tree, int));
3133 extern tree unary_complex_lvalue                PROTO((enum tree_code, tree));
3134 extern int mark_addressable                     PROTO((tree));
3135 extern tree build_x_conditional_expr            PROTO((tree, tree, tree));
3136 extern tree build_conditional_expr              PROTO((tree, tree, tree));
3137 extern tree build_x_compound_expr               PROTO((tree));
3138 extern tree build_compound_expr                 PROTO((tree));
3139 extern tree build_static_cast                   PROTO((tree, tree));
3140 extern tree build_reinterpret_cast              PROTO((tree, tree));
3141 extern tree build_const_cast                    PROTO((tree, tree));
3142 extern tree build_c_cast                        PROTO((tree, tree));
3143 extern tree build_x_modify_expr                 PROTO((tree, enum tree_code, tree));
3144 extern tree build_modify_expr                   PROTO((tree, enum tree_code, tree));
3145 extern void warn_for_assignment                 PROTO((char *, char *, char *, tree, int, int));
3146 extern tree convert_for_initialization          PROTO((tree, tree, tree, int, char *, tree, int));
3147 extern void c_expand_asm_operands               PROTO((tree, tree, tree, tree, int, char *, int));
3148 extern void c_expand_return                     PROTO((tree));
3149 extern tree c_expand_start_case                 PROTO((tree));
3150 extern int comp_ptr_ttypes                      PROTO((tree, tree));
3151 extern int ptr_reasonably_similar               PROTO((tree, tree));
3152 extern tree build_ptrmemfunc                    PROTO((tree, tree, int));
3153
3154 /* in typeck2.c */
3155 extern tree error_not_base_type                 PROTO((tree, tree));
3156 extern tree binfo_or_else                       PROTO((tree, tree));
3157 extern void readonly_error                      PROTO((tree, char *, int));
3158 extern void abstract_virtuals_error             PROTO((tree, tree));
3159 extern void signature_error                     PROTO((tree, tree));
3160 extern void incomplete_type_error               PROTO((tree, tree));
3161 extern void my_friendly_abort                   PROTO((int))
3162   ATTRIBUTE_NORETURN;
3163 extern void my_friendly_assert                  PROTO((int, int));
3164 extern tree store_init_value                    PROTO((tree, tree));
3165 extern tree digest_init                         PROTO((tree, tree, tree *));
3166 extern tree build_scoped_ref                    PROTO((tree, tree));
3167 extern tree build_x_arrow                       PROTO((tree));
3168 extern tree build_m_component_ref               PROTO((tree, tree));
3169 extern tree build_functional_cast               PROTO((tree, tree));
3170 extern char *enum_name_string                   PROTO((tree, tree));
3171 extern void report_case_error                   PROTO((int, tree, tree, tree));
3172 extern void check_for_new_type                  PROTO((char *,flagged_type_tree));
3173 extern tree initializer_constant_valid_p        PROTO((tree, tree));
3174
3175 /* in xref.c */
3176 extern void GNU_xref_begin                      PROTO((char *));
3177 extern void GNU_xref_end                        PROTO((int));
3178 extern void GNU_xref_file                       PROTO((char *));
3179 extern void GNU_xref_start_scope                PROTO((HOST_WIDE_INT));
3180 extern void GNU_xref_end_scope                  PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
3181 extern void GNU_xref_ref                        PROTO((tree, char *));
3182 extern void GNU_xref_decl                       PROTO((tree, tree));
3183 extern void GNU_xref_call                       PROTO((tree, char *));
3184 extern void GNU_xref_function                   PROTO((tree, tree));
3185 extern void GNU_xref_assign                     PROTO((tree));
3186 extern void GNU_xref_hier                       PROTO((tree, tree, int, int, int));
3187 extern void GNU_xref_member                     PROTO((tree, tree));
3188
3189 /* -- end of C++ */
3190
3191 #endif /* not _CP_TREE_H */