diff options
author | Ken Werner <ken.werner@de.ibm.com> | 2010-11-03 13:49:38 +0000 |
---|---|---|
committer | Ken Werner <ken.werner@de.ibm.com> | 2010-11-03 13:49:38 +0000 |
commit | c37f7098e9cb05b2574cf82e6ae299530ed407ba (patch) | |
tree | 04d07481c7bee9f22662d80e56efecb1311ce103 /gdb/testsuite | |
parent | 2ebf396434301f62203a5f1d3ada888af8dd193d (diff) | |
download | gdb-c37f7098e9cb05b2574cf82e6ae299530ed407ba.zip gdb-c37f7098e9cb05b2574cf82e6ae299530ed407ba.tar.gz gdb-c37f7098e9cb05b2574cf82e6ae299530ed407ba.tar.bz2 |
gdb:
* value.h (value_non_lval): Declare.
* value.c (value_non_lval): New function.
* eval.c (evaluate_subexp_standard) <UNOP_POSTINCREMENT,
UNOP_POSTDECREMENT>: Call value_non_lval to ensure to return a
non-lvalue.
gdb/testsuite:
* gdb.base/exprs.exp: Add tests for pre-/post- in-/decrement operators.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/exprs.exp | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4b24a22..38ee97f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-11-03 Ken Werner <ken.werner@de.ibm.com> + + * gdb.base/exprs.exp: Add tests for pre-/post- in-/decrement operators. + 2010-11-02 Doug Evans <dje@google.com> * gdb.python/py-pp-maint.c: New file. diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp index e84bf31..25ba687 100644 --- a/gdb/testsuite/gdb.base/exprs.exp +++ b/gdb/testsuite/gdb.base/exprs.exp @@ -253,3 +253,12 @@ gdb_test "set output-radix 8" ".*" test_expr "print red" "\\$\[0-9\]* = red" test_expr "print/d red" "\\$\[0-9\]* = 0" gdb_test "set output-radix 10" ".*" + +# Pre-/post in-/decrement tests. +gdb_test "set variable v_int = 1" "" +gdb_test "print v_int++" "\\$\[0-9\]* = 1" +gdb_test "print ++v_int" "\\$\[0-9\]* = 3" +gdb_test "print v_int--" "\\$\[0-9\]* = 3" +gdb_test "print --v_int" "\\$\[0-9\]* = 1" +gdb_test "print v_int++ = 5" "Left operand of assignment is not an lvalue." +gdb_test "print v_int-- = 5" "Left operand of assignment is not an lvalue." |