mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 01:50:24 +08:00
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.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* printcmd.c (set_command): Remove null check.
|
||||||
|
* value.c (init_if_undefined_command): Remove null check.
|
||||||
|
|
||||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* parse.c (parser_state::push_symbol, parser_state::push_dollar):
|
* parse.c (parser_state::push_symbol, parser_state::push_dollar):
|
||||||
|
@ -1375,7 +1375,6 @@ set_command (const char *exp, int from_tty)
|
|||||||
{
|
{
|
||||||
expression_up expr = parse_expression (exp);
|
expression_up expr = parse_expression (exp);
|
||||||
|
|
||||||
if (expr->op != nullptr)
|
|
||||||
switch (expr->op->opcode ())
|
switch (expr->op->opcode ())
|
||||||
{
|
{
|
||||||
case UNOP_PREINCREMENT:
|
case UNOP_PREINCREMENT:
|
||||||
|
@ -2015,7 +2015,7 @@ init_if_undefined_command (const char* args, int from_tty)
|
|||||||
/* Validate the expression.
|
/* Validate the expression.
|
||||||
Was the expression an assignment?
|
Was the expression an assignment?
|
||||||
Or even an expression at all? */
|
Or even an expression at all? */
|
||||||
if (expr->op == nullptr || expr->first_opcode () != BINOP_ASSIGN)
|
if (expr->first_opcode () != BINOP_ASSIGN)
|
||||||
error (_("Init-if-undefined requires an assignment expression."));
|
error (_("Init-if-undefined requires an assignment expression."));
|
||||||
|
|
||||||
/* Extract the variable from the parsed expression. */
|
/* Extract the variable from the parsed expression. */
|
||||||
|
Reference in New Issue
Block a user