aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-05-15 22:04:00 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-05-15 22:04:00 +0000
commit8f4b394d0259cb330bf8a67f0e4b974a6070def7 (patch)
tree0d9e4b59a31b6d72e9d9201c0c3581c63d88c9e9 /gcc
parent7c942e1747c951401736c0cfc144bc307d728b6c (diff)
downloadgcc-8f4b394d0259cb330bf8a67f0e4b974a6070def7.zip
gcc-8f4b394d0259cb330bf8a67f0e4b974a6070def7.tar.gz
gcc-8f4b394d0259cb330bf8a67f0e4b974a6070def7.tar.bz2
call.c (build_op_delete_call): Avoid creating unnecessary types.
* call.c (build_op_delete_call): Avoid creating unnecessary types. * class.c (instantiate_type): Remove tests for tf_no_attributes. * cp-tree.h (tsubst_flags_t): Remove tf_no_attributes. (COMPARE_NO_ATTRIBUTES): Remove. * typeck.c (comptypes): Do not check COMPARE_NO_ATTRIBUTES. From-SVN: r66843
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c43
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/cp-tree.h10
-rw-r--r--gcc/cp/typeck.c6
5 files changed, 37 insertions, 32 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4c01679..8e8d3e9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2003-05-15 Mark Mitchell <mark@codesourcery.com>
+ * call.c (build_op_delete_call): Avoid creating unnecessary types.
+ * class.c (instantiate_type): Remove tests for tf_no_attributes.
+ * cp-tree.h (tsubst_flags_t): Remove tf_no_attributes.
+ (COMPARE_NO_ATTRIBUTES): Remove.
+ * typeck.c (comptypes): Do not check COMPARE_NO_ATTRIBUTES.
+
PR c++/8385
* semantics.c (finish_typeof): Refine type-dependency check.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 84bdcd6..1d40e42 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3953,7 +3953,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
int flags, tree placement)
{
tree fn = NULL_TREE;
- tree fns, fnname, fntype, argtypes, args, type;
+ tree fns, fnname, argtypes, args, type;
int pass;
if (addr == error_mark_node)
@@ -4019,16 +4019,6 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
the second pass we look for a two-argument delete. */
for (pass = 0; pass < (placement ? 1 : 2); ++pass)
{
- if (pass == 0)
- argtypes = tree_cons (NULL_TREE, ptr_type_node, argtypes);
- else
- /* Normal delete; now try to find a match including the size
- argument. */
- argtypes = tree_cons (NULL_TREE, ptr_type_node,
- tree_cons (NULL_TREE, sizetype,
- void_list_node));
- fntype = build_function_type (void_type_node, argtypes);
-
/* Go through the `operator delete' functions looking for one
with a matching type. */
for (fn = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
@@ -4037,13 +4027,30 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
{
tree t;
- /* Exception specifications on the `delete' operator do not
- matter. */
- t = build_exception_variant (TREE_TYPE (OVL_CURRENT (fn)),
- NULL_TREE);
- /* We also don't compare attributes. We're really just
- trying to check the types of the first two parameters. */
- if (comptypes (t, fntype, COMPARE_NO_ATTRIBUTES))
+ /* The first argument must be "void *". */
+ t = TYPE_ARG_TYPES (TREE_TYPE (OVL_CURRENT (fn)));
+ if (!same_type_p (TREE_VALUE (t), ptr_type_node))
+ continue;
+ t = TREE_CHAIN (t);
+ /* On the first pass, check the rest of the arguments. */
+ if (pass == 0)
+ {
+ while (argtypes && t)
+ {
+ if (!same_type_p (TREE_VALUE (argtypes),
+ TREE_VALUE (t)))
+ break;
+ argtypes = TREE_CHAIN (argtypes);
+ t = TREE_CHAIN (t);
+ }
+ if (!argtypes && !t)
+ break;
+ }
+ /* On the second pass, the second argument must be
+ "size_t". */
+ else if (pass == 1
+ && same_type_p (TREE_VALUE (t), sizetype)
+ && TREE_CHAIN (t) == void_list_node)
break;
}
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c693fdf..773577d 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6017,8 +6017,6 @@ tree
instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
{
int complain = (flags & tf_error);
- int strict = (flags & tf_no_attributes)
- ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
int allow_ptrmem = flags & tf_ptrmem_ok;
flags &= ~tf_ptrmem_ok;
@@ -6032,7 +6030,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
{
- if (comptypes (lhstype, TREE_TYPE (rhs), strict))
+ if (same_type_p (lhstype, TREE_TYPE (rhs)))
return rhs;
if (flag_ms_extensions
&& TYPE_PTRMEMFUNC_P (lhstype)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 3398398..78568ed 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3007,12 +3007,10 @@ typedef enum tsubst_flags_t {
tf_none = 0, /* nothing special */
tf_error = 1 << 0, /* give error messages */
tf_warning = 1 << 1, /* give warnings too */
- tf_no_attributes = 1 << 2, /* ignore attributes on comparisons
- (instantiate_type use) */
- tf_ignore_bad_quals = 1 << 3, /* ignore bad cvr qualifiers */
- tf_keep_type_decl = 1 << 4, /* retain typedef type decls
+ tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
+ tf_keep_type_decl = 1 << 3, /* retain typedef type decls
(make_typename_type use) */
- tf_ptrmem_ok = 1 << 5 /* pointers to member ok (internal
+ tf_ptrmem_ok = 1 << 4 /* pointers to member ok (internal
instantiate_type use) */
} tsubst_flags_t;
@@ -3372,8 +3370,6 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
#define COMPARE_REDECLARATION 4 /* The comparsion is being done when
another declaration of an existing
entity is seen. */
-#define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
- extra-linguistic type attributes. */
/* Used with push_overloaded_decl. */
#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 833d169..7a3c18a 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -971,11 +971,9 @@ comptypes (t1, t2, strict)
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
- if (strict & COMPARE_NO_ATTRIBUTES)
- attrval = 1;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- else if (! (attrval = (*targetm.comp_type_attributes) (t1, t2)))
- return 0;
+ if (! (attrval = (*targetm.comp_type_attributes) (t1, t2)))
+ return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
val = 0;