Skip to content

Commit b785bb6

Browse files
committed
Remove op_name
op_name is only needed in a single place, so remove it and inline it there.
1 parent 87c84f0 commit b785bb6

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

gdb/expprint.c

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,6 @@
3636

3737
#include <ctype.h>
3838

39-
/* Default name for the standard operator OPCODE (i.e., one defined in
40-
the definition of enum exp_opcode). */
41-
42-
const char *
43-
op_name (enum exp_opcode opcode)
44-
{
45-
switch (opcode)
46-
{
47-
default:
48-
{
49-
static char buf[30];
50-
51-
xsnprintf (buf, sizeof (buf), "<unknown %d>", opcode);
52-
return buf;
53-
}
54-
#define OP(name) \
55-
case name: \
56-
return #name ;
57-
#include "std-operator.def"
58-
#undef OP
59-
}
60-
}
61-
6239
/* Meant to be used in debug sessions, so don't export it in a header file. */
6340
extern void ATTRIBUTE_USED debug_exp (struct expression *exp);
6441

@@ -84,7 +61,23 @@ check_objfile (const struct block *block, struct objfile *objfile)
8461
void
8562
dump_for_expression (struct ui_file *stream, int depth, enum exp_opcode op)
8663
{
87-
gdb_printf (stream, _("%*sOperation: %s\n"), depth, "", op_name (op));
64+
gdb_printf (stream, _("%*sOperation: "), depth, "");
65+
66+
switch (op)
67+
{
68+
default:
69+
gdb_printf (stream, "<unknown %d>", op);
70+
break;
71+
72+
#define OP(name) \
73+
case name: \
74+
gdb_puts (#name, stream); \
75+
break;
76+
#include "std-operator.def"
77+
#undef OP
78+
}
79+
80+
gdb_puts ("\n", stream);
8881
}
8982

9083
void

gdb/expression.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,6 @@ extern struct value *evaluate_subexp_do_call (expression *exp,
284284
const char *function_name,
285285
type *default_return_type);
286286

287-
/* From expprint.c */
288-
289-
extern const char *op_name (enum exp_opcode opcode);
290-
291287
/* In an OP_RANGE expression, either bound could be empty, indicating
292288
that its value is by default that of the corresponding bound of the
293289
array or string. Also, the upper end of the range can be exclusive

0 commit comments

Comments
 (0)