From b785bb6d1869657ec26003b97548bdd4bde43c90 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 28 Apr 2023 07:15:06 -0600 Subject: Remove op_name op_name is only needed in a single place, so remove it and inline it there. --- gdb/expprint.c | 41 +++++++++++++++++------------------------ gdb/expression.h | 4 ---- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/gdb/expprint.c b/gdb/expprint.c index e0ec255..b996c9f 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -36,29 +36,6 @@ #include -/* Default name for the standard operator OPCODE (i.e., one defined in - the definition of enum exp_opcode). */ - -const char * -op_name (enum exp_opcode opcode) -{ - switch (opcode) - { - default: - { - static char buf[30]; - - xsnprintf (buf, sizeof (buf), "", opcode); - return buf; - } -#define OP(name) \ - case name: \ - return #name ; -#include "std-operator.def" -#undef OP - } -} - /* Meant to be used in debug sessions, so don't export it in a header file. */ extern void ATTRIBUTE_USED debug_exp (struct expression *exp); @@ -84,7 +61,23 @@ check_objfile (const struct block *block, struct objfile *objfile) void dump_for_expression (struct ui_file *stream, int depth, enum exp_opcode op) { - gdb_printf (stream, _("%*sOperation: %s\n"), depth, "", op_name (op)); + gdb_printf (stream, _("%*sOperation: "), depth, ""); + + switch (op) + { + default: + gdb_printf (stream, "", op); + break; + +#define OP(name) \ + case name: \ + gdb_puts (#name, stream); \ + break; +#include "std-operator.def" +#undef OP + } + + gdb_puts ("\n", stream); } void diff --git a/gdb/expression.h b/gdb/expression.h index c314fc2..77949dd 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -284,10 +284,6 @@ extern struct value *evaluate_subexp_do_call (expression *exp, const char *function_name, type *default_return_type); -/* From expprint.c */ - -extern const char *op_name (enum exp_opcode opcode); - /* In an OP_RANGE expression, either bound could be empty, indicating that its value is by default that of the corresponding bound of the array or string. Also, the upper end of the range can be exclusive -- cgit v1.1