diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2000-08-17 13:10:50 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2000-08-17 13:10:50 +0000 |
commit | 5e76004e062f06a6a17a4933537e9a7b6732ae28 (patch) | |
tree | 6d50b727176b151472606d3cc6e5adf0682b6d63 /gcc | |
parent | 321cba9761d5183ffb2cf1f294e7551e9c889a2b (diff) | |
download | gcc-5e76004e062f06a6a17a4933537e9a7b6732ae28.zip gcc-5e76004e062f06a6a17a4933537e9a7b6732ae28.tar.gz gcc-5e76004e062f06a6a17a4933537e9a7b6732ae28.tar.bz2 |
cp-tree.h (instantiate_type_flags): New enumeration.
* cp-tree.h (instantiate_type_flags): New enumeration.
(instantiate_type): Change parameter.
* class.c (instantiate_type): Adjust prototype. Adjust.
* call.c (standard_conversion): Adjust instantiate_type call.
(reference_binding): Likewise.
(build_op_delete_call): Likewise.
(convert_like_real): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
* pt.c (convert_nontype_argument): Likewise.
* typeck.c (build_binary_op): Likewise.
(build_ptrmemfunc): Likewise.
(convert_for_assignment): Likewise.
From-SVN: r35757
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/cp/call.c | 10 | ||||
-rw-r--r-- | gcc/cp/class.c | 20 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 9 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 8 |
7 files changed, 48 insertions, 26 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ea1ed1d..a3ad3fa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,21 @@ 2000-08-17 Nathan Sidwell <nathan@codesourcery.com> + * cp-tree.h (instantiate_type_flags): New enumeration. + (instantiate_type): Change parameter. + * class.c (instantiate_type): Adjust prototype. Adjust. + * call.c (standard_conversion): Adjust instantiate_type call. + (reference_binding): Likewise. + (build_op_delete_call): Likewise. + (convert_like_real): Likewise. + * cvt.c (cp_convert_to_pointer): Likewise. + (convert_to_reference): Likewise. + * pt.c (convert_nontype_argument): Likewise. + * typeck.c (build_binary_op): Likewise. + (build_ptrmemfunc): Likewise. + (convert_for_assignment): Likewise. + +2000-08-17 Nathan Sidwell <nathan@codesourcery.com> + * cp-tree.h (CPTR_AGGR_TAG): New global tree node. (current_aggr): Define. * decl.c (grokdeclarator): Make sure a friend class is an diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4a68f57..9c2b295 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -657,7 +657,7 @@ standard_conversion (to, from, expr) if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to)) && expr && type_unknown_p (expr)) { - expr = instantiate_type (to, expr, 0); + expr = instantiate_type (to, expr, itf_none); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); @@ -1043,7 +1043,7 @@ reference_binding (rto, rfrom, expr, flags) if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr)) { - expr = instantiate_type (to, expr, 0); + expr = instantiate_type (to, expr, itf_none); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); @@ -3555,7 +3555,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, 2); + fn = instantiate_type (fntype, fns, itf_no_attributes); if (fn != error_mark_node) { @@ -3575,7 +3575,7 @@ 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, 2); + fn = instantiate_type (fntype, fns, itf_no_attributes); if (fn != error_mark_node) { @@ -3694,7 +3694,7 @@ convert_like_real (convs, expr, fn, argnum, inner) } case IDENTITY_CONV: if (type_unknown_p (expr)) - expr = instantiate_type (TREE_TYPE (convs), expr, 1); + expr = instantiate_type (TREE_TYPE (convs), expr, itf_complain); return expr; case AMBIG_CONV: /* Call build_user_type_conversion again for the error. */ diff --git a/gcc/cp/class.c b/gcc/cp/class.c index aafecbe..f9c27ab 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5977,24 +5977,22 @@ resolve_address_of_overloaded_function (target_type, /* This function will instantiate the type of the expression given in RHS to match the type of LHSTYPE. If errors exist, then return - error_mark_node. We only complain is COMPLAIN is set. If we are - not complaining, never modify rhs, as overload resolution wants to - 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. - + error_mark_node. FLAGS is a bit mask. If ITF_COMPLAIN is set, then + we complain on errors. If we are not complaining, never modify rhs, + as overload resolution wants to try many possible instantiations, in + the hope that at least one will work. + For non-recursive calls, LHSTYPE should be a function, pointer to function, or a pointer to member function. */ tree instantiate_type (lhstype, rhs, flags) tree lhstype, rhs; - int flags; + enum instantiate_type_flags flags; { - int complain = (flags & 1); - int strict = (flags & 2) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT; - tree r; + int complain = (flags & itf_complain); + int strict = (flags & itf_no_attributes) + ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT; if (TREE_CODE (lhstype) == UNKNOWN_TYPE) { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f5a38ba..1f21995 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3204,6 +3204,13 @@ typedef enum special_function_kind { sfk_conversion /* A conversion operator. */ } special_function_kind; +/* Bitmask flags to pass to instantiate_type. */ +typedef enum instantiate_type_flags { + itf_none = 0, /* nothing special */ + itf_complain = 1 << 0, /* complain about errors */ + itf_no_attributes = 1 << 1 /* ignore attributes on comparisons */ +} instantiate_type_flags; + /* Non-zero means that if a label exists, and no other identifier applies, use the value of the label. */ extern int flag_labels_ok; @@ -3822,7 +3829,7 @@ extern void push_nested_class PARAMS ((tree, int)); extern void pop_nested_class PARAMS ((void)); extern void push_lang_context PARAMS ((tree)); extern void pop_lang_context PARAMS ((void)); -extern tree instantiate_type PARAMS ((tree, tree, int)); +extern tree instantiate_type PARAMS ((tree, tree, enum instantiate_type_flags)); extern void print_class_statistics PARAMS ((void)); extern int first_vfun_index PARAMS ((tree)); extern void build_self_reference PARAMS ((void)); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 977571d..77e7ae8 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -267,7 +267,7 @@ cp_convert_to_pointer (type, expr) } if (type_unknown_p (expr)) - return instantiate_type (type, expr, 1); + return instantiate_type (type, expr, itf_no_attributes); cp_error ("cannot convert `%E' from type `%T' to type `%T'", expr, intype, type); @@ -464,7 +464,8 @@ convert_to_reference (reftype, expr, convtype, flags, decl) if (TREE_CODE (type) == FUNCTION_TYPE && intype == unknown_type_node) { expr = instantiate_type (type, expr, - (flags & LOOKUP_COMPLAIN) != 0); + (flags & LOOKUP_COMPLAIN) + ? itf_complain : itf_none); if (expr == error_mark_node) return error_mark_node; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 302d962..0451158 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2911,7 +2911,7 @@ convert_nontype_argument (type, expr) else fns = expr; - fn = instantiate_type (type_pointed_to, fns, 0); + fn = instantiate_type (type_pointed_to, fns, itf_none); if (fn == error_mark_node) return error_mark_node; @@ -2976,7 +2976,7 @@ convert_nontype_argument (type, expr) set (_over.over_). */ tree fn; - fn = instantiate_type (type_referred_to, expr, 0); + fn = instantiate_type (type_referred_to, expr, itf_none); if (fn == error_mark_node) return error_mark_node; @@ -3051,7 +3051,7 @@ convert_nontype_argument (type, expr) if (TREE_CODE (expr) != ADDR_EXPR) return error_mark_node; - expr = instantiate_type (type, expr, 0); + expr = instantiate_type (type, expr, itf_none); if (expr == error_mark_node) return error_mark_node; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index e7f8d2f..ddd827a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3344,7 +3344,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) /* DTRT if one side is an overloaded function, but complain about it. */ if (type_unknown_p (op0)) { - tree t = instantiate_type (TREE_TYPE (op1), op0, 0); + tree t = instantiate_type (TREE_TYPE (op1), op0, itf_none); if (t != error_mark_node) { cp_pedwarn ("assuming cast to type `%T' from overloaded function", @@ -3354,7 +3354,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) } if (type_unknown_p (op1)) { - tree t = instantiate_type (TREE_TYPE (op0), op1, 0); + tree t = instantiate_type (TREE_TYPE (op0), op1, itf_none); if (t != error_mark_node) { cp_pedwarn ("assuming cast to type `%T' from overloaded function", @@ -6199,7 +6199,7 @@ build_ptrmemfunc (type, pfn, force) } if (type_unknown_p (pfn)) - return instantiate_type (type, pfn, 1); + return instantiate_type (type, pfn, itf_complain); fn = TREE_OPERAND (pfn, 0); my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0); @@ -6464,7 +6464,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) overloaded function. Call instantiate_type to get error messages. */ if (rhstype == unknown_type_node) - instantiate_type (type, rhs, 1); + instantiate_type (type, rhs, itf_complain); else if (fndecl) cp_error ("cannot convert `%T' to `%T' for argument `%P' to `%D'", rhstype, type, parmnum, fndecl); |