diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1999-04-13 00:20:42 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1999-04-12 20:20:42 -0400 |
commit | 940ff22359106048380577cececbf9d6f2624084 (patch) | |
tree | 8b97d89f9d31d77ac93098e94b865219d3f3077a | |
parent | f2e2cbd4a21cad06f5cb58e533209fa484acc672 (diff) | |
download | gcc-940ff22359106048380577cececbf9d6f2624084.zip gcc-940ff22359106048380577cececbf9d6f2624084.tar.gz gcc-940ff22359106048380577cececbf9d6f2624084.tar.bz2 |
cp-tree.h (COMPARE_NO_ATTRIBUTES): New macro.
* cp-tree.h (COMPARE_NO_ATTRIBUTES): New macro.
* typeck.c (comptypes): If we get it, ignore attributes.
* class.c (instantiate_type): Use BASELINK_P. Change complain
parameter to flags; 2 means ignore attributes.
* call.c (build_op_delete_call): Pass it.
From-SVN: r26393
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 52 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 4 |
5 files changed, 34 insertions, 36 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5531d63..304a122 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 1999-04-12 Jason Merrill <jason@yorick.cygnus.com> + * cp-tree.h (COMPARE_NO_ATTRIBUTES): New macro. + * typeck.c (comptypes): If we get it, ignore attributes. + * class.c (instantiate_type): Use BASELINK_P. Change complain + parameter to flags; 2 means ignore attributes. + * call.c (build_op_delete_call): Pass it. + * decl.c (xref_tag): Only complain once about using a typedef-name with 'struct'. Downgrade to pedwarn. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f3ef258..fb3df65 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2942,7 +2942,7 @@ build_op_delete_call (code, addr, size, flags, placement) if (type != TYPE_MAIN_VARIANT (type)) addr = cp_convert (build_pointer_type (TYPE_MAIN_VARIANT (type)), addr); - fn = instantiate_type (fntype, fns, 0); + fn = instantiate_type (fntype, fns, 2); if (fn != error_mark_node) { @@ -2962,11 +2962,11 @@ build_op_delete_call (code, addr, size, flags, placement) tree_cons (NULL_TREE, sizetype, void_list_node)); fntype = build_function_type (void_type_node, argtypes); - fn = instantiate_type (fntype, fns, 0); + fn = instantiate_type (fntype, fns, 2); if (fn != error_mark_node) { - if (TREE_CODE (fns) == TREE_LIST) + if (BASELINK_P (fns)) /* Member functions. */ enforce_access (TREE_PURPOSE (fns), fn); return build_function_call diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 6b7b98a..a577441 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4919,14 +4919,19 @@ resolve_address_of_overloaded_function (target_type, try many possible instantiations, in hopes that at least one will work. + FLAGS is a bitmask, as we see at the top of the function. + For non-recursive calls, LHSTYPE should be a function, pointer to function, or a pointer to member function. */ tree -instantiate_type (lhstype, rhs, complain) +instantiate_type (lhstype, rhs, flags) tree lhstype, rhs; - int complain; + int flags; { + int complain = (flags & 1); + int strict = (flags & 2) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT; + if (TREE_CODE (lhstype) == UNKNOWN_TYPE) { if (complain) @@ -4936,7 +4941,7 @@ instantiate_type (lhstype, rhs, complain) if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs))) { - if (same_type_p (lhstype, TREE_TYPE (rhs))) + if (comptypes (lhstype, TREE_TYPE (rhs), strict)) return rhs; if (complain) cp_error ("argument of type `%T' does not match `%T'", @@ -4970,7 +4975,7 @@ instantiate_type (lhstype, rhs, complain) tree new_rhs; new_rhs = instantiate_type (build_pointer_type (lhstype), - TREE_OPERAND (rhs, 0), complain); + TREE_OPERAND (rhs, 0), flags); if (new_rhs == error_mark_node) return error_mark_node; @@ -4982,14 +4987,14 @@ instantiate_type (lhstype, rhs, complain) case NOP_EXPR: rhs = copy_node (TREE_OPERAND (rhs, 0)); TREE_TYPE (rhs) = unknown_type_node; - return instantiate_type (lhstype, rhs, complain); + return instantiate_type (lhstype, rhs, flags); case COMPONENT_REF: { tree field = TREE_OPERAND (rhs, 1); tree r; - r = instantiate_type (lhstype, field, complain); + r = instantiate_type (lhstype, field, flags); if (r != error_mark_node && TYPE_PTRMEMFUNC_P (lhstype)) { @@ -5040,27 +5045,10 @@ instantiate_type (lhstype, rhs, complain) /*explicit_targs=*/NULL_TREE); case TREE_LIST: - { - if (TREE_PURPOSE (rhs) == error_mark_node) - { - /* Make sure we don't drop the non-local flag, as the old code - would rely on it. */ - int nl = TREE_NONLOCAL_FLAG (rhs); - /* We don't need the type of this node. */ - rhs = TREE_VALUE (rhs); - my_friendly_assert (TREE_NONLOCAL_FLAG (rhs) == nl, 980331); - } + /* Now we should have a baselink. */ + my_friendly_assert (BASELINK_P (rhs), 990412); - /* Now we should have a baselink. */ - my_friendly_assert (TREE_CODE (TREE_PURPOSE (rhs)) == TREE_VEC, - 980331); - my_friendly_assert (TREE_CHAIN (rhs) == NULL_TREE, 181); - my_friendly_assert (TREE_CODE (TREE_VALUE (rhs)) == FUNCTION_DECL - || TREE_CODE (TREE_VALUE (rhs)) == OVERLOAD, - 182); - - return instantiate_type (lhstype, TREE_VALUE (rhs), complain); - } + return instantiate_type (lhstype, TREE_VALUE (rhs), flags); case CALL_EXPR: /* This is too hard for now. */ @@ -5071,11 +5059,11 @@ instantiate_type (lhstype, rhs, complain) case MINUS_EXPR: case COMPOUND_EXPR: TREE_OPERAND (rhs, 0) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), complain); + = instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); if (TREE_OPERAND (rhs, 0) == error_mark_node) return error_mark_node; TREE_OPERAND (rhs, 1) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain); + = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags); if (TREE_OPERAND (rhs, 1) == error_mark_node) return error_mark_node; @@ -5143,11 +5131,11 @@ instantiate_type (lhstype, rhs, complain) return error_mark_node; } TREE_OPERAND (rhs, 1) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain); + = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags); if (TREE_OPERAND (rhs, 1) == error_mark_node) return error_mark_node; TREE_OPERAND (rhs, 2) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 2), complain); + = instantiate_type (lhstype, TREE_OPERAND (rhs, 2), flags); if (TREE_OPERAND (rhs, 2) == error_mark_node) return error_mark_node; @@ -5156,7 +5144,7 @@ instantiate_type (lhstype, rhs, complain) case MODIFY_EXPR: TREE_OPERAND (rhs, 1) - = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), complain); + = instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags); if (TREE_OPERAND (rhs, 1) == error_mark_node) return error_mark_node; @@ -5164,7 +5152,7 @@ instantiate_type (lhstype, rhs, complain) return rhs; case ADDR_EXPR: - return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), complain); + return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); case ENTRY_VALUE_EXPR: my_friendly_abort (184); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 0ed7d75..a88156d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2631,6 +2631,8 @@ extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */ #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 6016d91..c210410 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -869,8 +869,10 @@ comptypes (type1, type2, strict) #define COMP_TYPE_ATTRIBUTES(t1,t2) 1 #endif + if (strict & COMPARE_NO_ATTRIBUTES) + attrval = 1; /* 1 if no need for warning yet, 2 if warning cause has been seen. */ - if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2))) + else if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2))) return 0; /* 1 if no need for warning yet, 2 if warning cause has been seen. */ |