Deleted Added
full compact
2c2
< Copyright (C) 1987, 88, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
---
> Copyright (C) 1987, 88, 92-98, 1999 Free Software Foundation, Inc.
31,39d30
< #ifdef __STDC__
< #include <stdarg.h>
< #else
< #include <varargs.h>
< #endif
<
< extern void compiler_error ();
<
< static tree get_identifier_list PROTO((tree));
45,46c36
< static tree list_hash_lookup PROTO((int, int, int, int, tree, tree,
< tree));
---
> static tree list_hash_lookup PROTO((int, tree, tree, tree));
48d37
< static void unshare_base_binfos PROTO((tree));
49a39
> static int lvalue_p_1 PROTO((tree, int));
50a41,42
> static tree no_linkage_helper PROTO((tree));
> static tree build_srcloc PROTO((char *, int));
54,56c46,48
< /* Return nonzero if REF is an lvalue valid for this language.
< Lvalues can be assigned, unless they have TREE_READONLY.
< Lvalues can have their address taken, unless they have DECL_REGISTER. */
---
> /* Returns non-zero if REF is an lvalue. If
> TREAT_CLASS_RVALUES_AS_LVALUES is non-zero, rvalues of class type
> are considered lvalues. */
58,59c50,51
< int
< real_lvalue_p (ref)
---
> static int
> lvalue_p_1 (ref, treat_class_rvalues_as_lvalues)
60a53
> int treat_class_rvalues_as_lvalues;
62,64d54
< if (! language_lvalue_valid (ref))
< return 0;
<
82c72,76
< return real_lvalue_p (TREE_OPERAND (ref, 0));
---
> case REALPART_EXPR:
> case IMAGPART_EXPR:
> case NOP_EXPR:
> return lvalue_p_1 (TREE_OPERAND (ref, 0),
> treat_class_rvalues_as_lvalues);
96,98c90
< case ERROR_MARK:
< if (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE
< && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
---
> if (TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
108,109c100,103
< return real_lvalue_p (TREE_OPERAND (ref, 0))
< && real_lvalue_p (TREE_OPERAND (ref, 1));
---
> return (lvalue_p_1 (TREE_OPERAND (ref, 0),
> treat_class_rvalues_as_lvalues)
> && lvalue_p_1 (TREE_OPERAND (ref, 1),
> treat_class_rvalues_as_lvalues));
113,114c107,110
< return (real_lvalue_p (TREE_OPERAND (ref, 1))
< && real_lvalue_p (TREE_OPERAND (ref, 2)));
---
> return (lvalue_p_1 (TREE_OPERAND (ref, 1),
> treat_class_rvalues_as_lvalues)
> && lvalue_p_1 (TREE_OPERAND (ref, 2),
> treat_class_rvalues_as_lvalues));
120c116,117
< return real_lvalue_p (TREE_OPERAND (ref, 1));
---
> return lvalue_p_1 (TREE_OPERAND (ref, 1),
> treat_class_rvalues_as_lvalues);
124,125c121,124
< return (real_lvalue_p (TREE_OPERAND (ref, 0))
< && real_lvalue_p (TREE_OPERAND (ref, 1)));
---
> return (lvalue_p_1 (TREE_OPERAND (ref, 0),
> treat_class_rvalues_as_lvalues)
> && lvalue_p_1 (TREE_OPERAND (ref, 1),
> treat_class_rvalues_as_lvalues));
126a126,137
> case TARGET_EXPR:
> return treat_class_rvalues_as_lvalues;
>
> case CALL_EXPR:
> return (treat_class_rvalues_as_lvalues
> && IS_AGGR_TYPE (TREE_TYPE (ref)));
>
> case FUNCTION_DECL:
> /* All functions (except non-static-member functions) are
> lvalues. */
> return !DECL_NONSTATIC_MEMBER_FUNCTION_P (ref);
>
133a145,156
> /* Return nonzero if REF is an lvalue valid for this language.
> Lvalues can be assigned, unless they have TREE_READONLY, or unless
> they are FUNCTION_DECLs. Lvalues can have their address taken,
> unless they have DECL_REGISTER. */
>
> int
> real_lvalue_p (ref)
> tree ref;
> {
> return lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/0);
> }
>
135a159
>
140,219c164
< if (! language_lvalue_valid (ref))
< return 0;
<
< if (TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
< return 1;
<
< if (ref == current_class_ptr && flag_this_is_variable <= 0)
< return 0;
<
< switch (TREE_CODE (ref))
< {
< /* preincrements and predecrements are valid lvals, provided
< what they refer to are valid lvals. */
< case PREINCREMENT_EXPR:
< case PREDECREMENT_EXPR:
< case REALPART_EXPR:
< case IMAGPART_EXPR:
< case COMPONENT_REF:
< case SAVE_EXPR:
< case UNSAVE_EXPR:
< case TRY_CATCH_EXPR:
< case WITH_CLEANUP_EXPR:
< return lvalue_p (TREE_OPERAND (ref, 0));
<
< case STRING_CST:
< return 1;
<
< case VAR_DECL:
< if (TREE_READONLY (ref) && ! TREE_STATIC (ref)
< && DECL_LANG_SPECIFIC (ref)
< && DECL_IN_AGGR_P (ref))
< return 0;
< case INDIRECT_REF:
< case ARRAY_REF:
< case PARM_DECL:
< case RESULT_DECL:
< case ERROR_MARK:
< if (TREE_CODE (TREE_TYPE (ref)) != FUNCTION_TYPE
< && TREE_CODE (TREE_TYPE (ref)) != METHOD_TYPE)
< return 1;
< break;
<
< case TARGET_EXPR:
< return 1;
<
< case CALL_EXPR:
< if (IS_AGGR_TYPE (TREE_TYPE (ref)))
< return 1;
< break;
<
< /* A currently unresolved scope ref. */
< case SCOPE_REF:
< my_friendly_abort (103);
< case OFFSET_REF:
< if (TREE_CODE (TREE_OPERAND (ref, 1)) == FUNCTION_DECL)
< return 1;
< return lvalue_p (TREE_OPERAND (ref, 0))
< && lvalue_p (TREE_OPERAND (ref, 1));
< break;
<
< case COND_EXPR:
< return (lvalue_p (TREE_OPERAND (ref, 1))
< && lvalue_p (TREE_OPERAND (ref, 2)));
<
< case MODIFY_EXPR:
< return 1;
<
< case COMPOUND_EXPR:
< return lvalue_p (TREE_OPERAND (ref, 1));
<
< case MAX_EXPR:
< case MIN_EXPR:
< return (lvalue_p (TREE_OPERAND (ref, 0))
< && lvalue_p (TREE_OPERAND (ref, 1)));
<
< default:
< break;
< }
<
< return 0;
---
> return lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/1);
228c173
< char *string;
---
> const char *string;
252c197
< return init;
---
> return convert (type, init);
434,436c379
< ptype = build_signature_pointer_type (TYPE_MAIN_VARIANT (basetype),
< TYPE_READONLY (basetype),
< TYPE_VOLATILE (basetype));
---
> ptype = build_signature_pointer_type (basetype);
476c419,420
< if (processing_template_decl
---
> if (processing_template_decl
> || uses_template_parms (elt_type)
501,502c445,446
< int constp = TYPE_READONLY (elt_type);
< int volatilep = TYPE_VOLATILE (elt_type);
---
> int type_quals = CP_TYPE_QUALS (elt_type);
>
507,508c451,452
< if (constp || volatilep)
< t = cp_build_type_variant (t, constp, volatilep);
---
> if (type_quals != TYPE_UNQUALIFIED)
> t = cp_build_qualified_type (t, type_quals);
517c461
< cp_build_type_variant (type, constp, volatilep)
---
> cp_build_qualified_type (type, type_quals)
519c463
< int constp, volatilep;
---
> int type_quals;
523a468,478
> /* A restrict-qualified pointer type must be a pointer (or reference)
> to object or incomplete type. */
> if ((type_quals & TYPE_QUAL_RESTRICT)
> && (!POINTER_TYPE_P (type)
> || TYPE_PTRMEM_P (type)
> || TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE))
> {
> cp_error ("`%T' cannot be `restrict'-qualified", type);
> type_quals &= ~TYPE_QUAL_RESTRICT;
> }
>
530,531c485,486
< type = build_cplus_array_type_1 (cp_build_type_variant
< (TREE_TYPE (type), constp, volatilep),
---
> type = build_cplus_array_type_1 (cp_build_qualified_type
> (TREE_TYPE (type), type_quals),
548c503
< return build_type_variant (type, constp, volatilep);
---
> return build_qualified_type (type, type_quals);
560,571c515
< int constp, volatilep;
< if (TREE_CODE (t) == ARRAY_TYPE)
< {
< constp = TYPE_READONLY (TREE_TYPE (t));
< volatilep = TYPE_VOLATILE (TREE_TYPE (t));
< }
< else
< {
< constp = TYPE_READONLY (t);
< volatilep = TYPE_VOLATILE (t);
< }
< return cp_build_type_variant (TYPE_MAIN_VARIANT (t), constp, volatilep);
---
> return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), CP_TYPE_QUALS (t));
621c565
< unshare_base_binfos (base_binfo);
---
> propagate_binfo_offsets (base_binfo, offset);
631c575
< /* Makes new binfos for the indirect bases under BASE_BINFO, and updates
---
> /* Makes new binfos for the indirect bases under BINFO, and updates
634,636c578,580
< static void
< unshare_base_binfos (base_binfo)
< tree base_binfo;
---
> void
> unshare_base_binfos (binfo)
> tree binfo;
638,642c582,584
< if (BINFO_BASETYPES (base_binfo))
< {
< tree base_binfos = BINFO_BASETYPES (base_binfo);
< tree chain = NULL_TREE;
< int j;
---
> tree binfos = BINFO_BASETYPES (binfo);
> tree new_binfo;
> int j;
644,660c586,587
< /* Now unshare the structure beneath BASE_BINFO. */
< for (j = TREE_VEC_LENGTH (base_binfos)-1;
< j >= 0; j--)
< {
< tree base_base_binfo = TREE_VEC_ELT (base_binfos, j);
< if (! TREE_VIA_VIRTUAL (base_base_binfo))
< TREE_VEC_ELT (base_binfos, j)
< = make_binfo (BINFO_OFFSET (base_base_binfo),
< base_base_binfo,
< BINFO_VTABLE (base_base_binfo),
< BINFO_VIRTUALS (base_base_binfo),
< chain);
< chain = TREE_VEC_ELT (base_binfos, j);
< TREE_VIA_PUBLIC (chain) = TREE_VIA_PUBLIC (base_base_binfo);
< TREE_VIA_PROTECTED (chain) = TREE_VIA_PROTECTED (base_base_binfo);
< BINFO_INHERITANCE_CHAIN (chain) = base_binfo;
< }
---
> if (binfos == NULL_TREE)
> return;
662,664c589,603
< /* Completely unshare potentially shared data, and
< update what is ours. */
< propagate_binfo_offsets (base_binfo, BINFO_OFFSET (base_binfo));
---
> /* Now unshare the structure beneath BINFO. */
> for (j = TREE_VEC_LENGTH (binfos)-1;
> j >= 0; j--)
> {
> tree base_binfo = TREE_VEC_ELT (binfos, j);
> new_binfo = TREE_VEC_ELT (binfos, j)
> = make_binfo (BINFO_OFFSET (base_binfo),
> base_binfo,
> BINFO_VTABLE (base_binfo),
> BINFO_VIRTUALS (base_binfo));
> TREE_VIA_PUBLIC (new_binfo) = TREE_VIA_PUBLIC (base_binfo);
> TREE_VIA_PROTECTED (new_binfo) = TREE_VIA_PROTECTED (base_binfo);
> TREE_VIA_VIRTUAL (new_binfo) = TREE_VIA_VIRTUAL (base_binfo);
> BINFO_INHERITANCE_CHAIN (new_binfo) = binfo;
> unshare_base_binfos (new_binfo);
684,686c623
< /* Get all the virtual base types that this type uses.
< The TREE_VALUE slot holds the virtual baseclass type. */
< tree vbase_types = get_vbase_types (rec);
---
> tree vbase_types;
701c638,642
< CLASSTYPE_VBASECLASSES (rec) = vbase_types;
---
> /* Get all the virtual base types that this type uses. The
> TREE_VALUE slot holds the virtual baseclass type. Note that
> get_vbase_types makes copies of the virtual base BINFOs, so that
> the vbase_types are unshared. */
> vbase_types = CLASSTYPE_VBASECLASSES (rec);
766a708,712
>
> if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
> cp_warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
> basetype, rec);
>
770c716
< unshare_base_binfos (base_binfo);
---
> propagate_binfo_offsets (base_binfo, BINFO_OFFSET (base_binfo));
778a725,733
> propagate_binfo_offsets (vbase_types, BINFO_OFFSET (vbase_types));
>
> if (extra_warnings)
> {
> tree basetype = BINFO_TYPE (vbase_types);
> if (get_base_distance (basetype, rec, 0, (tree*)0) == -2)
> cp_warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
> basetype, rec);
> }
854c809
< base_align));
---
> (int) base_align));
928,929c883
< char *name = (char *)alloca (TYPE_NAME_LENGTH (basetype)
< + sizeof (VBASE_NAME) + 1);
---
> const char *name;
949c903
< sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (basetype));
---
> FORMAT_VBASE_NAME (name, basetype);
1027,1029c981,982
< list_hash_lookup (hashcode, via_public, via_protected, via_virtual,
< purpose, value, chain)
< int hashcode, via_public, via_virtual, via_protected;
---
> list_hash_lookup (hashcode, purpose, value, chain)
> int hashcode;
1036,1038d988
< && TREE_VIA_VIRTUAL (h->list) == via_virtual
< && TREE_VIA_PUBLIC (h->list) == via_public
< && TREE_VIA_PROTECTED (h->list) == via_protected
1063,1066c1013,1015
< /* Given TYPE, and HASHCODE its hash code, return the canonical
< object for an identical list if one already exists.
< Otherwise, return TYPE, and record it as the canonical object
< if it is a permanent object.
---
> /* Given list components PURPOSE, VALUE, AND CHAIN, return the canonical
> object for an identical list if one already exists. Otherwise, build a
> new one, and record it as the canonical object. */
1068,1073d1016
< To use this function, first create a list of the sort you want.
< Then compute its hash code from the fields of the list that
< make it different from other similar lists.
< Then call this function and use the value.
< This function frees the list you pass in if it is a duplicate. */
<
1079,1080c1022
< hash_tree_cons (via_public, via_virtual, via_protected, purpose, value, chain)
< int via_public, via_virtual, via_protected;
---
> hash_tree_cons (purpose, value, chain)
1090,1091c1032
< t = list_hash_lookup (hashcode, via_public, via_protected, via_virtual,
< purpose, value, chain);
---
> t = list_hash_lookup (hashcode, purpose, value, chain);
1099,1101d1039
< TREE_VIA_PUBLIC (t) = via_public;
< TREE_VIA_PROTECTED (t) = via_protected;
< TREE_VIA_VIRTUAL (t) = via_virtual;
1117c1055
< return hash_tree_cons (0, 0, 0, NULL_TREE, value, chain);
---
> return hash_tree_cons (NULL_TREE, value, chain);
1135,1188d1072
<
< static tree
< get_identifier_list (value)
< tree value;
< {
< tree list = IDENTIFIER_AS_LIST (value);
< if (list != NULL_TREE
< && (TREE_CODE (list) != TREE_LIST
< || TREE_VALUE (list) != value))
< list = NULL_TREE;
< else if (IDENTIFIER_HAS_TYPE_VALUE (value)
< && TREE_CODE (IDENTIFIER_TYPE_VALUE (value)) == RECORD_TYPE
< && IDENTIFIER_TYPE_VALUE (value)
< == TYPE_MAIN_VARIANT (IDENTIFIER_TYPE_VALUE (value)))
< {
< tree type = IDENTIFIER_TYPE_VALUE (value);
<
< if (TYPE_PTRMEMFUNC_P (type))
< list = NULL_TREE;
< else if (type == current_class_type)
< /* Don't mess up the constructor name. */
< list = tree_cons (NULL_TREE, value, NULL_TREE);
< else
< {
< if (! CLASSTYPE_ID_AS_LIST (type))
< CLASSTYPE_ID_AS_LIST (type)
< = perm_tree_cons (NULL_TREE, TYPE_IDENTIFIER (type), NULL_TREE);
< list = CLASSTYPE_ID_AS_LIST (type);
< }
< }
< return list;
< }
<
< tree
< get_decl_list (value)
< tree value;
< {
< tree list = NULL_TREE;
<
< if (TREE_CODE (value) == IDENTIFIER_NODE)
< list = get_identifier_list (value);
< else if (TREE_CODE (value) == RECORD_TYPE
< && TYPE_LANG_SPECIFIC (value)
< && value == TYPE_MAIN_VARIANT (value))
< list = CLASSTYPE_AS_LIST (value);
<
< if (list != NULL_TREE)
< {
< my_friendly_assert (TREE_CHAIN (list) == NULL_TREE, 301);
< return list;
< }
<
< return build_decl_list (NULL_TREE, value);
< }
1203c1087
< VIRTUALS are the virtual functions sitting in VTABLE.
---
> VIRTUALS are the virtual functions sitting in VTABLE. */
1205,1206d1088
< CHAIN are more associations we must retain. */
<
1208c1090
< make_binfo (offset, binfo, vtable, virtuals, chain)
---
> make_binfo (offset, binfo, vtable, virtuals)
1211d1092
< tree chain;
1221c1102
< binfo = TYPE_BINFO (binfo);
---
> binfo = CLASS_TYPE_P (type) ? TYPE_BINFO (binfo) : NULL_TREE;
1224,1227d1104
< TREE_CHAIN (new_binfo) = chain;
< if (chain)
< TREE_USED (new_binfo) = TREE_USED (chain);
<
1255a1133,1137
> /* Return a reversed copy of the BINFO-chain given by PATH. (If the
> BINFO_INHERITANCE_CHAIN points from base classes to derived
> classes, it will instead point from derived classes to base
> classes.) Returns the first node in the reversed chain. */
>
1260,1261c1142,1144
< register tree prev = 0, tmp, next;
< for (tmp = path; tmp; tmp = next)
---
> register tree prev = NULL_TREE, cur;
> push_expression_obstack ();
> for (cur = path; cur; cur = BINFO_INHERITANCE_CHAIN (cur))
1263,1265c1146,1148
< next = BINFO_INHERITANCE_CHAIN (tmp);
< BINFO_INHERITANCE_CHAIN (tmp) = prev;
< prev = tmp;
---
> tree r = copy_node (cur);
> BINFO_INHERITANCE_CHAIN (r) = prev;
> prev = r;
1266a1150
> pop_obstacks ();
1289c1173
< n = skip_rtti_stuff (&virtuals);
---
> n = skip_rtti_stuff (&virtuals, BINFO_TYPE (elem));
1343,1351c1227,1231
< /* XXX A baselink is also considered an overloaded function.
< As is a placeholder from push_class_decls. */
< if (TREE_CODE (x) == TREE_LIST)
< {
< my_friendly_assert (TREE_CODE (TREE_PURPOSE (x)) == TREE_VEC
< || TREE_CODE (TREE_PURPOSE (x)) == IDENTIFIER_NODE,
< 388);
< x = TREE_VALUE (x);
< }
---
> /* A baselink is also considered an overloaded function. */
> if (TREE_CODE (x) == OFFSET_REF)
> x = TREE_OPERAND (x, 1);
> if (BASELINK_P (x))
> x = TREE_VALUE (x);
1362,1364c1242,1245
< /* A baselink is also considered an overloaded function.
< This might also be an ambiguous class member. */
< if (TREE_CODE (x) == TREE_LIST)
---
> /* A baselink is also considered an overloaded function. */
> if (TREE_CODE (x) == OFFSET_REF)
> x = TREE_OPERAND (x, 1);
> if (BASELINK_P (x))
1377c1258
< if (TREE_CODE (from) == TREE_LIST)
---
> if (BASELINK_P (from))
1381a1263,1273
> /* Returns nonzero if T is a ->* or .* expression that refers to a
> member function. */
>
> int
> bound_pmf_p (t)
> tree t;
> {
> return (TREE_CODE (t) == OFFSET_REF
> && TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (t, 1))));
> }
>
1420c1312
< if (!chain)
---
> if (! chain && TREE_CODE (decl) != TEMPLATE_DECL)
1422c1314
< if (TREE_CODE (chain) != OVERLOAD)
---
> if (chain && TREE_CODE (chain) != OVERLOAD)
1521,1522c1413
< int constp = TYPE_READONLY (type);
< int volatilep = TYPE_VOLATILE (type);
---
> int type_quals = TYPE_QUALS (type);
1526,1527c1417,1420
< if (TYPE_READONLY (v) != constp
< || TYPE_VOLATILE (v) != volatilep)
---
> tree t;
> tree u;
>
> if (TYPE_QUALS (v) != type_quals)
1530,1532c1423,1429
< /* @@ This should do set equality, not exact match. */
< if (simple_cst_list_equal (TYPE_RAISES_EXCEPTIONS (v), raises))
< /* List of exceptions raised matches previously found list.
---
> for (t = TYPE_RAISES_EXCEPTIONS (v), u = raises;
> t != NULL_TREE && u != NULL_TREE;
> t = TREE_CHAIN (t), u = TREE_CHAIN (u))
> if (((TREE_VALUE (t) != NULL_TREE)
> != (TREE_VALUE (u) != NULL_TREE))
> || !same_type_p (TREE_VALUE (t), TREE_VALUE (u)))
> break;
1534,1535c1431,1432
< @@ Nice to free up storage used in consing up the
< @@ list of exceptions raised. */
---
> if (!t && !u)
> /* There's a memory leak here; RAISES is not freed. */
1543,1548c1440
< {
< push_obstacks_nochange ();
< end_temporary_allocation ();
< raises = copy_list (raises);
< pop_obstacks ();
< }
---
> raises = copy_to_permanent (raises);
1562c1454,1460
< tree t2 = make_lang_type (TEMPLATE_TEMPLATE_PARM);
---
> tree t2;
>
> /* Make sure these end up on the permanent_obstack. */
> push_obstacks_nochange ();
> end_temporary_allocation ();
>
> t2 = make_lang_type (TEMPLATE_TEMPLATE_PARM);
1564a1463,1465
>
> pop_obstacks ();
>
1571c1472,1473
< CLASSTYPE_TEMPLATE_INFO (t2) = CLASSTYPE_TEMPLATE_INFO (t);
---
> TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2)
> = TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t);
1575c1477,1478
< /* Subroutine of copy_to_permanent
---
> /* Walk through the tree structure T, applying func. If func ever returns
> non-null, return that value. */
1577,1579d1479
< Assuming T is a node build bottom-up, make it all exist on
< permanent obstack, if it is not permanent already. */
<
1581c1481
< mapcar (t, func)
---
> search_tree (t, func)
1584a1485,1486
> #define TRY(ARG) if (tmp=search_tree (ARG, func), tmp != NULL_TREE) return tmp
>
1595a1498,1690
> break;
>
> case IDENTIFIER_NODE:
> break;
>
> case VAR_DECL:
> case FUNCTION_DECL:
> case CONST_DECL:
> case TEMPLATE_DECL:
> case NAMESPACE_DECL:
> break;
>
> case TYPE_DECL:
> TRY (TREE_TYPE (t));
> break;
>
> case PARM_DECL:
> TRY (TREE_TYPE (t));
> TRY (TREE_CHAIN (t));
> break;
>
> case TREE_LIST:
> TRY (TREE_PURPOSE (t));
> TRY (TREE_VALUE (t));
> TRY (TREE_CHAIN (t));
> break;
>
> case OVERLOAD:
> TRY (OVL_FUNCTION (t));
> TRY (OVL_CHAIN (t));
> break;
>
> case TREE_VEC:
> {
> int len = TREE_VEC_LENGTH (t);
>
> t = copy_node (t);
> while (len--)
> TRY (TREE_VEC_ELT (t, len));
> }
> break;
>
> case INTEGER_CST:
> case REAL_CST:
> case STRING_CST:
> case DEFAULT_ARG:
> break;
>
> case PTRMEM_CST:
> TRY (TREE_TYPE (t));
> break;
>
> case COND_EXPR:
> case TARGET_EXPR:
> case AGGR_INIT_EXPR:
> case NEW_EXPR:
> TRY (TREE_OPERAND (t, 0));
> TRY (TREE_OPERAND (t, 1));
> TRY (TREE_OPERAND (t, 2));
> break;
>
> case MODIFY_EXPR:
> case PLUS_EXPR:
> case MINUS_EXPR:
> case MULT_EXPR:
> case TRUNC_DIV_EXPR:
> case TRUNC_MOD_EXPR:
> case MIN_EXPR:
> case MAX_EXPR:
> case LSHIFT_EXPR:
> case RSHIFT_EXPR:
> case BIT_IOR_EXPR:
> case BIT_XOR_EXPR:
> case BIT_AND_EXPR:
> case BIT_ANDTC_EXPR:
> case TRUTH_ANDIF_EXPR:
> case TRUTH_ORIF_EXPR:
> case LT_EXPR:
> case LE_EXPR:
> case GT_EXPR:
> case GE_EXPR:
> case EQ_EXPR:
> case NE_EXPR:
> case CEIL_DIV_EXPR:
> case FLOOR_DIV_EXPR:
> case ROUND_DIV_EXPR:
> case CEIL_MOD_EXPR:
> case FLOOR_MOD_EXPR:
> case ROUND_MOD_EXPR:
> case COMPOUND_EXPR:
> case PREDECREMENT_EXPR:
> case PREINCREMENT_EXPR:
> case POSTDECREMENT_EXPR:
> case POSTINCREMENT_EXPR:
> case ARRAY_REF:
> case SCOPE_REF:
> case TRY_CATCH_EXPR:
> case WITH_CLEANUP_EXPR:
> case CALL_EXPR:
> TRY (TREE_OPERAND (t, 0));
> TRY (TREE_OPERAND (t, 1));
> break;
>
> case SAVE_EXPR:
> case CONVERT_EXPR:
> case ADDR_EXPR:
> case INDIRECT_REF:
> case NEGATE_EXPR:
> case BIT_NOT_EXPR:
> case TRUTH_NOT_EXPR:
> case NOP_EXPR:
> case NON_LVALUE_EXPR:
> case COMPONENT_REF:
> case CLEANUP_POINT_EXPR:
> case LOOKUP_EXPR:
> case SIZEOF_EXPR:
> case ALIGNOF_EXPR:
> TRY (TREE_OPERAND (t, 0));
> break;
>
> case MODOP_EXPR:
> case CAST_EXPR:
> case REINTERPRET_CAST_EXPR:
> case CONST_CAST_EXPR:
> case STATIC_CAST_EXPR:
> case DYNAMIC_CAST_EXPR:
> case ARROW_EXPR:
> case DOTSTAR_EXPR:
> case TYPEID_EXPR:
> break;
>
> case COMPLEX_CST:
> TRY (TREE_REALPART (t));
> TRY (TREE_IMAGPART (t));
> break;
>
> case CONSTRUCTOR:
> TRY (CONSTRUCTOR_ELTS (t));
> break;
>
> case TEMPLATE_TEMPLATE_PARM:
> case TEMPLATE_PARM_INDEX:
> case TEMPLATE_TYPE_PARM:
> break;
>
> case BIND_EXPR:
> break;
>
> case REAL_TYPE:
> case COMPLEX_TYPE:
> case VOID_TYPE:
> case BOOLEAN_TYPE:
> case TYPENAME_TYPE:
> case UNION_TYPE:
> case ENUMERAL_TYPE:
> case TYPEOF_TYPE:
> break;
>
> case POINTER_TYPE:
> case REFERENCE_TYPE:
> TRY (TREE_TYPE (t));
> break;
>
> case FUNCTION_TYPE:
> case METHOD_TYPE:
> TRY (TREE_TYPE (t));
> TRY (TYPE_ARG_TYPES (t));
> break;
>
> case ARRAY_TYPE:
> TRY (TREE_TYPE (t));
> TRY (TYPE_DOMAIN (t));
> break;
>
> case INTEGER_TYPE:
> TRY (TYPE_MAX_VALUE (t));
> break;
>
> case OFFSET_TYPE:
> TRY (TREE_TYPE (t));
> TRY (TYPE_OFFSET_BASETYPE (t));
> break;
>
> case RECORD_TYPE:
> if (TYPE_PTRMEMFUNC_P (t))
> TRY (TYPE_PTRMEMFUNC_FN_TYPE (t));
> break;
>
> /* This list is incomplete, but should suffice for now.
> It is very important that `sorry' not call
> `report_error_function'. That could cause an infinite loop. */
> default:
> sorry ("initializer contains unrecognized tree code");
1597a1693,1752
> }
>
> return NULL_TREE;
>
> #undef TRY
> }
>
> /* Passed to search_tree. Checks for the use of types with no linkage. */
>
> static tree
> no_linkage_helper (t)
> tree t;
> {
> if (TYPE_P (t)
> && (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
> && (decl_function_context (TYPE_MAIN_DECL (t))
> || ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))))
> return t;
> return NULL_TREE;
> }
>
> /* Check if the type T depends on a type with no linkage and if so, return
> it. */
>
> tree
> no_linkage_check (t)
> tree t;
> {
> t = search_tree (t, no_linkage_helper);
> if (t != error_mark_node)
> return t;
> return NULL_TREE;
> }
>
>
> /* Make copies of all the nodes below T. If FUNC is non-NULL, call it
> for each node. */
>
> tree
> mapcar (t, func)
> tree t;
> tree (*func) PROTO((tree));
> {
> tree tmp;
>
> if (t == NULL_TREE)
> return t;
>
> if (func)
> {
> tmp = func (t);
> if (tmp)
> return tmp;
> }
>
> switch (TREE_CODE (t))
> {
> case ERROR_MARK:
> return error_mark_node;
>
1611,1615c1766,1772
< tmp = decl_constant_value (t);
< if (tmp != t)
< return mapcar (tmp, func);
< else
< return error_mark_node;
---
> if (TREE_READONLY_DECL_P (t))
> {
> tmp = decl_constant_value (t);
> if (tmp != t)
> return mapcar (tmp, func);
> }
> return error_mark_node;
1661a1819,1824
> case PTRMEM_CST:
> t = copy_node (t);
> TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
> PTRMEM_CST_MEMBER (t) = mapcar (PTRMEM_CST_MEMBER (t), func);
> return t;
>
1725c1888
< build_call_declarator puts trees in there. */
---
> make_call_declarator puts trees in there. */
1741a1905
> case NON_LVALUE_EXPR:
1742a1907
> TREE_TYPE (t) = mapcar (TREE_TYPE (t), func);
1748c1913
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, TYPE_QUALS (t));
1751c1916
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, TYPE_QUALS (t));
1755c1920
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, TYPE_QUALS (t));
1759c1924
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, CP_TYPE_QUALS (t));
1762c1927
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, TYPE_QUALS (t));
1766c1931
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, TYPE_QUALS (t));
1772c1937
< return cp_build_type_variant (tmp, TYPE_READONLY (t), TYPE_VOLATILE (t));
---
> return cp_build_qualified_type (tmp, TYPE_QUALS (t));
1801a1967,1971
> case LOOKUP_EXPR:
> t = copy_node (t);
> TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
> return t;
>
1820a1991,2000
> /* Returns T if T is allocated on the permanent obstack, NULL_TREE
> otherwise. */
>
> tree
> permanent_p (t)
> tree t;
> {
> return TREE_PERMANENT (t) ? t : NULL_TREE;
> }
>
1888d2067
< #ifdef __STDC__
1893,1898d2071
< #else
< char *string;
< char *expression;
< unsigned line;
< char *filename;
< #endif
2040c2213
< TREE_TYPE (t) = tt;
---
> TREE_TYPE (t) = copy_to_permanent (tt);
2117c2290
< if (comptypes (elem, BINFO_TYPE (TREE_VEC_ELT (vec, i)), 1))
---
> if (same_type_p (elem, BINFO_TYPE (TREE_VEC_ELT (vec, i))))
2136a2310,2327
> /* Returns the namespace that contains DECL, whether directly or
> indirectly. */
>
> tree
> decl_namespace_context (decl)
> tree decl;
> {
> while (1)
> {
> if (TREE_CODE (decl) == NAMESPACE_DECL)
> return decl;
> else if (TYPE_P (decl))
> decl = CP_DECL_CONTEXT (TYPE_MAIN_DECL (decl));
> else
> decl = CP_DECL_CONTEXT (decl);
> }
> }
>
2190c2381
< if (!(comptypes (TREE_TYPE (t1), TREE_TYPE (t2), 1)
---
> if (!(same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))
2258c2449
< return comptypes (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0), 1);
---
> return same_type_p (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
2260a2452,2457
> case PTRMEM_CST:
> /* Two pointer-to-members are the same if they point to the same
> field or function in the same class. */
> return (PTRMEM_CST_MEMBER (t1) == PTRMEM_CST_MEMBER (t2)
> && same_type_p (PTRMEM_CST_CLASS (t1), PTRMEM_CST_CLASS (t2)));
>
2287c2484,2485
< /* Similar to make_tree_vec, but build on a temporary obstack. */
---
> /* Similar to make_tree_vec, but build on the momentary_obstack.
> Thus, these vectors are really and truly temporary. */
2294,2295c2492
< register struct obstack *ambient_obstack = current_obstack;
< current_obstack = expression_obstack;
---
> push_expression_obstack ();
2297c2494
< current_obstack = ambient_obstack;
---
> pop_obstacks ();
2336c2533
< tree
---
> static tree
2381,2382c2578
< return cp_build_type_variant
< (type, TREE_READONLY (arg), TREE_THIS_VOLATILE (arg));
---
> return type;
2424a2621,2811
>
> /* Create a placeholder for member access where we don't actually have an
> object that the access is against. */
>
> tree
> build_dummy_object (type)
> tree type;
> {
> tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_zero_node);
> return build_indirect_ref (decl, NULL_PTR);
> }
>
> /* We've gotten a reference to a member of TYPE. Return *this if appropriate,
> or a dummy object otherwise. If BINFOP is non-0, it is filled with the
> binfo path from current_class_type to TYPE, or 0. */
>
> tree
> maybe_dummy_object (type, binfop)
> tree type;
> tree *binfop;
> {
> tree decl, context;
>
> if (current_class_type
> && get_base_distance (type, current_class_type, 0, binfop) != -1)
> context = current_class_type;
> else
> {
> /* Reference from a nested class member function. */
> context = type;
> if (binfop)
> *binfop = TYPE_BINFO (type);
> }
>
> if (current_class_ref && context == current_class_type)
> decl = current_class_ref;
> else
> decl = build_dummy_object (context);
>
> return decl;
> }
>
> /* Returns 1 if OB is a placeholder object, or a pointer to one. */
>
> int
> is_dummy_object (ob)
> tree ob;
> {
> if (TREE_CODE (ob) == INDIRECT_REF)
> ob = TREE_OPERAND (ob, 0);
> return (TREE_CODE (ob) == NOP_EXPR
> && TREE_OPERAND (ob, 0) == void_zero_node);
> }
>
> /* Returns 1 iff type T is a POD type, as defined in [basic.types]. */
>
> int
> pod_type_p (t)
> tree t;
> {
> tree f;
>
> while (TREE_CODE (t) == ARRAY_TYPE)
> t = TREE_TYPE (t);
>
> if (! IS_AGGR_TYPE (t))
> return 1;
>
> if (CLASSTYPE_NON_AGGREGATE (t)
> || TYPE_HAS_COMPLEX_ASSIGN_REF (t)
> || TYPE_HAS_DESTRUCTOR (t))
> return 0;
>
> for (f = TYPE_FIELDS (t); f; f = TREE_CHAIN (f))
> {
> if (TREE_CODE (f) != FIELD_DECL)
> continue;
>
> if (TREE_CODE (TREE_TYPE (f)) == REFERENCE_TYPE
> || TYPE_PTRMEMFUNC_P (TREE_TYPE (f))
> || TYPE_PTRMEM_P (TREE_TYPE (f)))
> return 0;
> }
>
> return 1;
> }
>
> /* Return a 1 if ATTR_NAME and ATTR_ARGS denote a valid C++-specific
> attribute for either declaration DECL or type TYPE and 0 otherwise.
> Plugged into valid_lang_attribute. */
>
> int
> cp_valid_lang_attribute (attr_name, attr_args, decl, type)
> tree attr_name;
> tree attr_args ATTRIBUTE_UNUSED;
> tree decl ATTRIBUTE_UNUSED;
> tree type ATTRIBUTE_UNUSED;
> {
> if (is_attribute_p ("com_interface", attr_name))
> {
> if (! flag_vtable_thunks)
> {
> error ("`com_interface' only supported with -fvtable-thunks");
> return 0;
> }
>
> if (attr_args != NULL_TREE
> || decl != NULL_TREE
> || ! CLASS_TYPE_P (type)
> || type != TYPE_MAIN_VARIANT (type))
> {
> warning ("`com_interface' attribute can only be applied to class definitions");
> return 0;
> }
>
> CLASSTYPE_COM_INTERFACE (type) = 1;
> return 1;
> }
> else if (is_attribute_p ("init_priority", attr_name))
> {
> tree initp_expr = (attr_args ? TREE_VALUE (attr_args): NULL_TREE);
> int pri;
>
> if (initp_expr)
> STRIP_NOPS (initp_expr);
>
> if (!initp_expr || TREE_CODE (initp_expr) != INTEGER_CST)
> {
> error ("requested init_priority is not an integer constant");
> return 0;
> }
>
> pri = TREE_INT_CST_LOW (initp_expr);
>
> while (TREE_CODE (type) == ARRAY_TYPE)
> type = TREE_TYPE (type);
>
> if (decl == NULL_TREE
> || TREE_CODE (decl) != VAR_DECL
> || ! TREE_STATIC (decl)
> || DECL_EXTERNAL (decl)
> || (TREE_CODE (type) != RECORD_TYPE
> && TREE_CODE (type) != UNION_TYPE)
> /* Static objects in functions are initialized the
> first time control passes through that
> function. This is not precise enough to pin down an
> init_priority value, so don't allow it. */
> || current_function_decl)
> {
> error ("can only use init_priority attribute on file-scope definitions of objects of class type");
> return 0;
> }
>
> if (pri > MAX_INIT_PRIORITY || pri <= 0)
> {
> error ("requested init_priority is out of range");
> return 0;
> }
>
> /* Check for init_priorities that are reserved for
> language and runtime support implementations.*/
> if (pri <= MAX_RESERVED_INIT_PRIORITY)
> {
> warning
> ("requested init_priority is reserved for internal use");
> }
>
> DECL_INIT_PRIORITY (decl) = pri;
> return 1;
> }
>
> return 0;
> }
>
> /* Return a new PTRMEM_CST of the indicated TYPE. The MEMBER is the
> thing pointed to by the constant. */
>
> tree
> make_ptrmem_cst (type, member)
> tree type;
> tree member;
> {
> tree ptrmem_cst = make_node (PTRMEM_CST);
> /* If would seem a great convenience if make_node would set
> TREE_CONSTANT for things of class `c', but it does not. */
> TREE_CONSTANT (ptrmem_cst) = 1;
> TREE_TYPE (ptrmem_cst) = type;
> PTRMEM_CST_MEMBER (ptrmem_cst) = member;
> return ptrmem_cst;
> }
>