OSDN Git Service

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