From 88b91969e1ae5d23f81b86ae6cd3c85b284c6294 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 30 Nov 2020 01:37:10 -0700 Subject: Remove per-language op_name functions enum exp_opcode is created from all the .def files, but then each language is required to implement its own op_name function to turn an enum value to a string. This seemed over-complicated to me, and this patch removes the per-language functions in favor of simply using the .def names for all languages. Note that op_name is only used for dumping expressions, which is a maintainer/debug feature. Furthermore, I don't think there was any case where the .def name and the string name differed. gdb/ChangeLog 2020-11-30 Tom Tromey * rust-lang.c (rust_op_name): Remove. (exp_descriptor_rust): Update. * parser-defs.h (op_name_standard): Don't declare. (struct exp_descriptor) : Remove. * parse.c (exp_descriptor_standard): Update. * opencl-lang.c (exp_descriptor_opencl): Update. * m2-lang.c (m2_language::exp_descriptor_modula2): Update. * f-lang.c (op_name_f): Remove. (f_language::exp_descriptor_tab): Update. * expression.h (op_name): Update. * expprint.c (op_name): Rewrite. (op_name_standard): Remove. (dump_raw_expression, dump_subexp): Update. * c-lang.c (exp_descriptor_c): Update. * ax-gdb.c (gen_expr): Update. * ada-lang.c (ada_op_name): Remove. (ada_exp_descriptor): Update. --- gdb/rust-lang.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'gdb/rust-lang.c') diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index fb2f2d5..b89fd30 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1680,22 +1680,6 @@ rust_operator_length (const struct expression *exp, int pc, int *oplenp, *argsp = args; } -/* op_name implementation for Rust. */ - -static const char * -rust_op_name (enum exp_opcode opcode) -{ - switch (opcode) - { - case OP_AGGREGATE: - return "OP_AGGREGATE"; - case OP_OTHERS: - return "OP_OTHERS"; - default: - return op_name_standard (opcode); - } -} - /* dump_subexp_body implementation for Rust. */ static int @@ -1869,7 +1853,6 @@ static const struct exp_descriptor exp_descriptor_rust = rust_print_subexp, rust_operator_length, rust_operator_check, - rust_op_name, rust_dump_subexp_body, rust_evaluate_subexp }; -- cgit v1.1