+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.
+
2020-11-30 Tom Tromey <tom@tromey.com>
* eval.c (init_array_element): Remove.
static int possible_user_operator_p (enum exp_opcode, struct value **);
-static const char *ada_op_name (enum exp_opcode);
-
static const char *ada_decoded_op_name (enum exp_opcode);
static int numeric_type_p (struct type *);
return 0;
}
-static const char *
-ada_op_name (enum exp_opcode opcode)
-{
- switch (opcode)
- {
- default:
- return op_name_standard (opcode);
-
-#define OP_DEFN(op, len, args, binop) case op: return #op;
- ADA_OPERATORS;
-#undef OP_DEFN
-
- case OP_AGGREGATE:
- return "OP_AGGREGATE";
- case OP_CHOICES:
- return "OP_CHOICES";
- case OP_NAME:
- return "OP_NAME";
- }
-}
-
/* As for operator_length, but assumes PC is pointing at the first
element of the operator, and gives meaningful results only for the
Ada-specific operators, returning 0 for *OPLENP and *ARGSP otherwise. */
ada_print_subexp,
ada_operator_length,
ada_operator_check,
- ada_op_name,
ada_dump_subexp_body,
ada_evaluate_subexp
};
default:
error (_("Unsupported operator %s (%d) in expression."),
- op_name (exp, op), op);
+ op_name (op), op);
}
}
print_subexp_standard,
operator_length_standard,
operator_check_standard,
- op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_c
};
static int dump_subexp_body (struct expression *exp, struct ui_file *, int);
-/* Name for OPCODE, when it appears in expression EXP. */
-
-const char *
-op_name (struct expression *exp, enum exp_opcode opcode)
-{
- if (opcode >= OP_UNUSED_LAST)
- {
- char *cell = get_print_cell ();
- xsnprintf (cell, PRINT_CELL_SIZE, "unknown opcode: %u",
- unsigned (opcode));
- return cell;
- }
- return exp->language_defn->expression_ops ()->op_name (opcode);
-}
-
/* Default name for the standard operator OPCODE (i.e., one defined in
the definition of enum exp_opcode). */
const char *
-op_name_standard (enum exp_opcode opcode)
+op_name (enum exp_opcode opcode)
{
switch (opcode)
{
case name: \
return #name ;
#include "std-operator.def"
+#include "ada-operator.def"
+#include "fortran-operator.def"
#undef OP
}
}
{
fprintf_filtered (stream, "\t%5d ", elt);
- const char *opcode_name = op_name (exp, exp->elts[elt].opcode);
+ const char *opcode_name = op_name (exp->elts[elt].opcode);
fprintf_filtered (stream, "%20s ", opcode_name);
print_longest (stream, 'd', 0, exp->elts[elt].longconst);
fprintf_filtered (stream, " ");
indent += 2;
- fprintf_filtered (stream, "%-20s ", op_name (exp, exp->elts[elt].opcode));
+ fprintf_filtered (stream, "%-20s ", op_name (exp->elts[elt].opcode));
elt = dump_subexp_body (exp, stream, elt);
extern void print_expression (struct expression *, struct ui_file *);
-extern const char *op_name (struct expression *exp, enum exp_opcode opcode);
+extern const char *op_name (enum exp_opcode opcode);
extern const char *op_string (enum exp_opcode);
}
}
-/* 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
print_subexp_f,
operator_length_f,
operator_check_f,
- op_name_f,
dump_subexp_body_f,
evaluate_subexp_f
};
print_subexp_standard,
operator_length_standard,
operator_check_standard,
- op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_modula2
};
print_subexp_standard,
operator_length_standard,
operator_check_standard,
- op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_opencl
};
print_subexp_standard,
operator_length_standard,
operator_check_standard,
- op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_standard
};
(struct objfile *objfile, void *data),
void *data);
-extern const char *op_name_standard (enum exp_opcode);
-
extern bool parse_float (const char *p, int len,
const struct type *type, gdb_byte *data);
\f
void *data),
void *data);
- /* Name of this operator for dumping purposes.
- The returned value should never be NULL, even if EXP_OPCODE is
- an unknown opcode (a string containing an image of the numeric
- value of the opcode can be returned, for instance). */
- const char *(*op_name) (enum exp_opcode);
-
/* Dump the rest of this (prefix) expression after the operator
itself has been printed. See dump_subexp_body_standard in
(expprint.c). */
*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
rust_print_subexp,
rust_operator_length,
rust_operator_check,
- rust_op_name,
rust_dump_subexp_body,
rust_evaluate_subexp
};