diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-28 02:58:19 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-28 02:58:19 +0000 |
commit | 97cc4539a7f02aed875e05ca4a0dbdf2d66ed368 (patch) | |
tree | e69d1900e45d7c20303ea928d731e1f70c7ec263 /gcc/cp/call.c | |
parent | 30dceb30ca0876d616e90c132fbb60833da50268 (diff) | |
download | ppe42-gcc-97cc4539a7f02aed875e05ca4a0dbdf2d66ed368.tar.gz ppe42-gcc-97cc4539a7f02aed875e05ca4a0dbdf2d66ed368.zip |
2000-05-27 Alex Samuel <samuel@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (ansi_opname): Make it a macro.
(ansi_assopname): Likewise.
(struct lang_decl_flags): Add assignment_operator_p.
(struct lang_decl): Add operator_code.
(DECL_VTT_PARM): Adjust.
(DECL_OVERLOADED_OPERATOR_P): Return the operator_code for an
overloaded operator.
(SET_OVERLOADED_OPERATOR_CODE): New macro.
(DECL_ASSIGNMENT_OPERATOR_P): New macro.
(DECL_ARRAY_DELETE_OPERATOR_P): Adjust.
(opname_tab): Remove.
(assignop_tab): Likewise.
(operator_name_info_t): New type.
(operator_name_info): New variable.
(assignment_operator_name_info): Likewise.
(build_cp_library_fn): Remove declaration.
(push_cp_library_fn): Likewise.
(operator_name_string): Likewise.
(build_decl_overload): Likewise.
* call.c (print_z_candidates): Simplify.
(build_object_call): Adjust usage of ansi_opname. Use
DECL_OVERLOADED_OPERATOR_P.
(op_error): Adjust operator name lookup.
(build_conditional_expr): Adjust usage of ansi_opname.
(build_new_op): Likewise.
(build_op_delete_call): Likewise.
(build_over_call): Likewise.
(joust): Use DECL_OVERLOADED_OPERATOR_P.
* decl.c (duplicate_decls): Copy operator_code.
(init_decl_processing): Adjust parameters to push_cp_library_fn.
(builtin_function): Adjust parameters to build_library_fn_1.
(build_library_fn_1): Accept an overloaded operator code.
(build_library_fn): Pass ERROR_MARK.
(build_cp_library_fn): Accept an overloaded operator code.
(push_cp_library_fn): Likewise.
(grokfndecl): Tweak.
(grokdeclarator): Simplify code to compute names of overloaded
operators. Adjust use of ansi_opname.
(ambi_op_p): Work on tree_codes, not identifiers.
(unary_op_p): Likewise.
(grok_op_properties): Likewise.
(start_function): Use DECL_OVERLOADED_OPERATOR_P.
(lang_mark_tree): Don't try to mark the operator_code.
* decl2.c (grok_function_init): Use DECL_OVERLOADED_OPERATOR_P.
* error.c (dump_decl): Remove special handling for operator
names.
(dump_function_name): Likewise.
(dump_expr): Adjust name lookup of operators.
(op_to_string): Simplify.
(assop_to_string): Likewise.
* init.c (build_new_1): Adjust use of ansi_opname.
* lex.c (opname_tab): Remove.
(assignop_tab): Likewise.
(ansi_opname): Likewise.
(ansi_assopname): Likewise.
(operator_name_string): Likewise.
(reinit_lang_specific): Likewise.
(operator_name_info): New variable.
(assignment_operator_name_info): Likewise.
(init_operators): New function.
(init_parse): Use it.
(do_identifier): Adjust use of ansi_opname.
* method.c (mangle_expression): Don't use ansi_opname for
mangling.
(build_decl_overload_real): Use DECL_OVERLOADED_OPERATOR_P.
(build_decl_overload): Remove.
(build_typename_overload): Use OPERATOR_TYPENAME_FORMAT directly.
(do_build_assign_ref): Adjust use of ansi_opname.
(synthesize_method): Likewise.
(implicitly_declare_fn): Likewise.
* operators.def: New file.
* parse.y (operator): Adjust use of ansi_opname.
* pt.c (tsubst_decl): Use IDENTIFIER_OPNAME_P.
(set_mangled_name_for_template_decl): Don't play games with
current_namespace.
(special_function_p): Adjust use of ansi_opname.
* typeck.c (check_return_expr): Likewise.
* Make-lang.in (cc1plus): Depend on operators.def.
* Makefile.in (lex.o): Likewise.
(decl.o): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index a034f5292a6..2bd5c81843a 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2257,7 +2257,7 @@ print_z_candidates (candidates) { if (TREE_CODE (candidates->fn) == IDENTIFIER_NODE) { - if (candidates->fn == ansi_opname [COND_EXPR]) + if (TREE_VEC_LENGTH (candidates->convs) == 3) cp_error ("%s %D(%T, %T, %T) <builtin>", str, candidates->fn, TREE_TYPE (TREE_VEC_ELT (candidates->convs, 0)), TREE_TYPE (TREE_VEC_ELT (candidates->convs, 1)), @@ -2609,7 +2609,7 @@ build_object_call (obj, args) return error_mark_node; } - fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname [CALL_EXPR], 1); + fns = lookup_fnfields (TYPE_BINFO (type), ansi_opname (CALL_EXPR), 1); if (fns == error_mark_node) return error_mark_node; @@ -2689,7 +2689,7 @@ build_object_call (obj, args) function, we must be careful not to unconditionally look at DECL_NAME here. */ if (TREE_CODE (cand->fn) == FUNCTION_DECL - && DECL_NAME (cand->fn) == ansi_opname [CALL_EXPR]) + && DECL_OVERLOADED_OPERATOR_P (cand->fn) == CALL_EXPR) return build_over_call (cand, mem_args, LOOKUP_NORMAL); obj = convert_like_with_context @@ -2705,8 +2705,12 @@ op_error (code, code2, arg1, arg2, arg3, problem) tree arg1, arg2, arg3; const char *problem; { - const char * opname - = (code == MODIFY_EXPR ? assignop_tab [code2] : opname_tab [code]); + const char * opname; + + if (code == MODIFY_EXPR) + opname = assignment_operator_name_info[code2].name; + else + opname = operator_name_info[code].name; switch (code) { @@ -2987,7 +2991,7 @@ build_conditional_expr (arg1, arg2, arg3) candidates = add_builtin_candidates (candidates, COND_EXPR, NOP_EXPR, - ansi_opname[COND_EXPR], + ansi_opname (COND_EXPR), args, LOOKUP_NORMAL); @@ -3166,10 +3170,10 @@ build_new_op (code, flags, arg1, arg2, arg3) { code2 = TREE_CODE (arg3); arg3 = NULL_TREE; - fnname = ansi_assopname[code2]; + fnname = ansi_assopname (code2); } else - fnname = ansi_opname[code]; + fnname = ansi_opname (code); switch (code) { @@ -3314,7 +3318,8 @@ build_new_op (code, flags, arg1, arg2, arg3) one, then we fall back to the old way of doing things. */ if (flags & LOOKUP_COMPLAIN) cp_pedwarn ("no `%D (int)' declared for postfix `%s', trying prefix operator instead", - fnname, opname_tab [code]); + fnname, + operator_name_info[code].name); if (code == POSTINCREMENT_EXPR) code = PREINCREMENT_EXPR; else @@ -3354,7 +3359,7 @@ build_new_op (code, flags, arg1, arg2, arg3) { extern int warn_synth; if (warn_synth - && fnname == ansi_opname[MODIFY_EXPR] + && fnname == ansi_assopname (NOP_EXPR) && DECL_ARTIFICIAL (cand->fn) && candidates->next && ! candidates->next->next) @@ -3516,7 +3521,7 @@ build_op_delete_call (code, addr, size, flags, placement) return error_mark_node; type = TREE_TYPE (TREE_TYPE (addr)); - fnname = ansi_opname[code]; + fnname = ansi_opname (code); if (IS_AGGR_TYPE (type) && ! (flags & LOOKUP_GLOBAL)) /* In [class.free] @@ -4137,7 +4142,7 @@ build_over_call (cand, args, flags) return address; } } - else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR] + else if (DECL_OVERLOADED_OPERATOR_P (fn) == NOP_EXPR && copy_args_p (fn) && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn))) { @@ -5123,7 +5128,7 @@ joust (cand1, cand2, warn) /* Kludge around broken overloading rules whereby Integer a, b; test ? a : b; is ambiguous, since there's a builtin that takes references and another that takes values. */ - if (cand1->fn == ansi_opname[COND_EXPR]) + if (DECL_OVERLOADED_OPERATOR_P (cand1->fn) == COND_EXPR) { tree c1 = TREE_VEC_ELT (cand1->convs, 1); tree c2 = TREE_VEC_ELT (cand2->convs, 1); |