+2004-02-24 Jason Merrill <jason@redhat.com>
+
+ * tree.c (check_qualified_type): New fn.
+ (get_qualified_type): Use it. If type already has the desired
+ quals, just return it.
+ * tree.h: Declare it.
+ * cp/tree.c (build_exception_variant): Use it.
+
2003-02-24 Sanjiv Kumar Gupta <sanjivg@noida.hcltech.com>
* target-def.h (TARGET_SCHED_INIT_GLOBAL,
2004-02-10 Danny Smith <dannysmith@users.sourceforge.net>
PR c/14088
- real.c (real_from_string): Look for 'X' as well as 'x' in
+ * real.c (real_from_string): Look for 'X' as well as 'x' in
hexfloat strings.
2004-02-10 Kazu Hirata <kazu@cs.umass.edu>
int type_quals = TYPE_QUALS (type);
for (; v; v = TYPE_NEXT_VARIANT (v))
- if (TYPE_QUALS (v) == type_quals
- && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1)
- && (*targetm.comp_type_attributes) (type, v))
+ if (check_qualified_type (v, type, type_quals)
+ && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
return v;
/* Need to build a new variant. */
TYPE_RESTRICT (type) = (type_quals & TYPE_QUAL_RESTRICT) != 0;
}
+/* Returns true iff cand is equivalent to base with type_quals. */
+
+bool
+check_qualified_type (tree cand, tree base, int type_quals)
+{
+ return (TYPE_QUALS (cand) == type_quals
+ && TYPE_NAME (cand) == TYPE_NAME (base)
+ /* Apparently this is needed for Objective-C. */
+ && TYPE_CONTEXT (cand) == TYPE_CONTEXT (base)
+ && attribute_list_equal (TYPE_ATTRIBUTES (cand),
+ TYPE_ATTRIBUTES (base)));
+}
+
/* Return a version of the TYPE, qualified as indicated by the
TYPE_QUALS, if one exists. If no qualified version exists yet,
return NULL_TREE. */
{
tree t;
+ if (TYPE_QUALS (type) == type_quals)
+ return type;
+
/* Search the chain of variants to see if there is already one there just
like the one we need to have. If so, use that existing one. We must
preserve the TYPE_NAME, since there is code that depends on this. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
- if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type)
- && TYPE_CONTEXT (t) == TYPE_CONTEXT (type)
- && attribute_list_equal (TYPE_ATTRIBUTES (t), TYPE_ATTRIBUTES (type)))
+ if (check_qualified_type (t, type, type_quals))
return t;
return NULL_TREE;
extern tree merge_dllimport_decl_attributes (tree, tree);
#endif
+/* Check whether CAND is suitable to be returned from get_qualified_type
+ (BASE, TYPE_QUALS). */
+
+extern bool check_qualified_type (tree, tree, int);
+
/* Return a version of the TYPE, qualified as indicated by the
TYPE_QUALS, if one exists. If no qualified version exists yet,
return NULL_TREE. */