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 <tom@tromey.com> * rust-lang.c (rust_op_name): Remove. (exp_descriptor_rust): Update. * parser-defs.h (op_name_standard): Don't declare. (struct exp_descriptor) <op_name>: 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.
This commit is contained in:
parent
1cd49c43f3
commit
88b91969e1
12 changed files with 27 additions and 92 deletions
19
gdb/f-lang.c
19
gdb/f-lang.c
|
@ -1072,24 +1072,6 @@ print_subexp_f (struct expression *exp, int *pos,
|
|||
}
|
||||
}
|
||||
|
||||
/* Special expression names for Fortran. */
|
||||
|
||||
static const char *
|
||||
op_name_f (enum exp_opcode opcode)
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
default:
|
||||
return op_name_standard (opcode);
|
||||
|
||||
#define OP(name) \
|
||||
case name: \
|
||||
return #name ;
|
||||
#include "fortran-operator.def"
|
||||
#undef OP
|
||||
}
|
||||
}
|
||||
|
||||
/* Special expression dumping for Fortran. */
|
||||
|
||||
static int
|
||||
|
@ -1159,7 +1141,6 @@ const struct exp_descriptor f_language::exp_descriptor_tab =
|
|||
print_subexp_f,
|
||||
operator_length_f,
|
||||
operator_check_f,
|
||||
op_name_f,
|
||||
dump_subexp_body_f,
|
||||
evaluate_subexp_f
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue