aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:44 -0700
commit3dd93bf837b10e01864d7d223ae9d3f9b92df74e (patch)
tree6f48c2db566069ae33c55e883994927dcc1b570c /gdb/printcmd.c
parent9c79936b3df018166d53869f7f2bb2909f129e51 (diff)
downloadgdb-3dd93bf837b10e01864d7d223ae9d3f9b92df74e.zip
gdb-3dd93bf837b10e01864d7d223ae9d3f9b92df74e.tar.gz
gdb-3dd93bf837b10e01864d7d223ae9d3f9b92df74e.tar.bz2
Remove some null checks
When not parsing for completion, parse_expression ensures that the resulting expression has operations. This patch removes a couple of unnecessary checks for this situation. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * printcmd.c (set_command): Remove null check. * value.c (init_if_undefined_command): Remove null check.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 2a06aea..8508906 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1375,21 +1375,20 @@ set_command (const char *exp, int from_tty)
{
expression_up expr = parse_expression (exp);
- if (expr->op != nullptr)
- switch (expr->op->opcode ())
- {
- case UNOP_PREINCREMENT:
- case UNOP_POSTINCREMENT:
- case UNOP_PREDECREMENT:
- case UNOP_POSTDECREMENT:
- case BINOP_ASSIGN:
- case BINOP_ASSIGN_MODIFY:
- case BINOP_COMMA:
- break;
- default:
- warning
- (_("Expression is not an assignment (and might have no effect)"));
- }
+ switch (expr->op->opcode ())
+ {
+ case UNOP_PREINCREMENT:
+ case UNOP_POSTINCREMENT:
+ case UNOP_PREDECREMENT:
+ case UNOP_POSTDECREMENT:
+ case BINOP_ASSIGN:
+ case BINOP_ASSIGN_MODIFY:
+ case BINOP_COMMA:
+ break;
+ default:
+ warning
+ (_("Expression is not an assignment (and might have no effect)"));
+ }
evaluate_expression (expr.get ());
}