diff options
author | Tristan Gingold <gingold@adacore.com> | 2012-05-04 07:57:57 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2012-05-04 07:57:57 +0000 |
commit | 0599b1780d127fff8f7c29af624921b987b4d7b4 (patch) | |
tree | 14afaf403fba71e860b5c8cc237f58ebd0694d1a /gdb/printcmd.c | |
parent | 494e00bc65a0f9b4c28f5507ffe9a23243eb8667 (diff) | |
download | gdb-0599b1780d127fff8f7c29af624921b987b4d7b4.tar.gz |
2012-05-04 Tristan Gingold <gingold@adacore.com>
* printcmd.c (set_command): Emit a warning if the expression is not
an assignment.
testsuite/
2012-05-04 Tristan Gingold <gingold@adacore.com>
* gdb.base/set-noassign.exp: New test.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index d441dfe5244..79e38f21d57 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1080,6 +1080,12 @@ set_command (char *exp, int from_tty) struct cleanup *old_chain = make_cleanup (free_current_contents, &expr); + if (expr->nelts >= 1 + && expr->elts[0].opcode != BINOP_ASSIGN + && expr->elts[0].opcode != BINOP_ASSIGN_MODIFY + && expr->elts[0].opcode != BINOP_COMMA) + warning (_("Expression is not an assignment (and might have no effect)")); + evaluate_expression (expr); do_cleanups (old_chain); } |