diff options
author | Alex Samuel <samuel@codesourcery.com> | 2000-05-28 02:58:19 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-05-28 02:58:19 +0000 |
commit | 596ea4e574aa9177437b95dcb2412e0673df8c0a (patch) | |
tree | e69d1900e45d7c20303ea928d731e1f70c7ec263 /gcc/cp/error.c | |
parent | 4f1c5cce901c4d53fb9130183ca275ef1d04fe8a (diff) | |
download | gcc-596ea4e574aa9177437b95dcb2412e0673df8c0a.zip gcc-596ea4e574aa9177437b95dcb2412e0673df8c0a.tar.gz gcc-596ea4e574aa9177437b95dcb2412e0673df8c0a.tar.bz2 |
cp-tree.h (ansi_opname): Make it a macro.
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.
Co-Authored-By: Mark Mitchell <mark@codesourcery.com>
From-SVN: r34223
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r-- | gcc/cp/error.c | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c index bfd921f..f4c116b 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -945,14 +945,6 @@ dump_decl (t, flags) dump_type (TREE_TYPE (t), flags); break; } - else if (IDENTIFIER_OPNAME_P (t)) - { - const char *name_string = operator_name_string (t); - OB_PUTS ("operator"); - if (ISALPHA (name_string[0])) - OB_PUTC (' '); - OB_PUTCP (name_string); - } else OB_PUTID (t); } @@ -1278,13 +1270,7 @@ dump_function_name (t, flags) dump_type (TREE_TYPE (TREE_TYPE (t)), flags); } else if (IDENTIFIER_OPNAME_P (name)) - { - const char *name_string = operator_name_string (name); - OB_PUTS ("operator"); - if (ISALPHA (name_string[0])) - OB_PUTC (' '); - OB_PUTCP (name_string); - } + OB_PUTID (name); else dump_decl (name, flags); @@ -1694,7 +1680,7 @@ dump_expr (t, flags) case EQ_EXPR: case NE_EXPR: case EXACT_DIV_EXPR: - dump_binary_op (opname_tab[(int) TREE_CODE (t)], t, flags); + dump_binary_op (operator_name_info[(int) TREE_CODE (t)].name, t, flags); break; case CEIL_DIV_EXPR: @@ -1782,14 +1768,14 @@ dump_expr (t, flags) case TRUTH_NOT_EXPR: case PREDECREMENT_EXPR: case PREINCREMENT_EXPR: - dump_unary_op (opname_tab [(int)TREE_CODE (t)], t, flags); + dump_unary_op (operator_name_info [(int)TREE_CODE (t)].name, t, flags); break; case POSTDECREMENT_EXPR: case POSTINCREMENT_EXPR: OB_PUTC ('('); dump_expr (TREE_OPERAND (t, 0), flags | TS_EXPR_PARENS); - OB_PUTCP (opname_tab[(int)TREE_CODE (t)]); + OB_PUTCP (operator_name_info[(int)TREE_CODE (t)].name); OB_PUTC (')'); break; @@ -2307,13 +2293,10 @@ op_to_string (p, v) enum tree_code p; int v ATTRIBUTE_UNUSED; { - static char buf[] = "operator "; + tree id; - if (p == 0) - return "{unknown}"; - - strcpy (buf + 8, opname_tab [p]); - return buf; + id = operator_name_info[(int) p].identifier; + return id ? IDENTIFIER_POINTER (id) : "{unknown}"; } static const char * @@ -2342,13 +2325,10 @@ assop_to_string (p, v) enum tree_code p; int v ATTRIBUTE_UNUSED; { - static char buf[] = "operator "; + tree id; - if (p == 0) - return "{unknown}"; - - strcpy (buf + 9, assignop_tab [p]); - return buf; + id = assignment_operator_name_info[(int) p].identifier; + return id ? IDENTIFIER_POINTER (id) : "{unknown}"; } static const char * |