diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-03-18 09:19:20 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2004-03-18 09:19:20 +0000 |
commit | 3e4caed2b120cd3930d19c96fc5761f9254946c5 (patch) | |
tree | eae9dcc477672a6fb76eb92e438fd58c44dc7060 /gas/expr.c | |
parent | 79349b09266bd4ce03cd5cfd39ccac3f0d73daa2 (diff) | |
download | gdb-3e4caed2b120cd3930d19c96fc5761f9254946c5.zip gdb-3e4caed2b120cd3930d19c96fc5761f9254946c5.tar.gz gdb-3e4caed2b120cd3930d19c96fc5761f9254946c5.tar.bz2 |
* expr.c (operand): Reject ++ and --.
(operator): Likewise.
Diffstat (limited to 'gas/expr.c')
-rw-r--r-- | gas/expr.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1021,6 +1021,9 @@ operand (expressionS *expressionP) break; case '+': + /* Do not accept ++e as +(+e) */ + if (input_line_pointer[1] == '+') + goto target_op; (void) operand (expressionP); break; @@ -1038,6 +1041,10 @@ operand (expressionS *expressionP) case '!': case '-': { + /* Do not accept --e as -(-e) */ + if (c == '-' && input_line_pointer[1] == '-') + goto target_op; + operand (expressionP); if (expressionP->X_op == O_constant) { @@ -1289,6 +1296,7 @@ operand (expressionS *expressionP) } else { + target_op: /* Let the target try to parse it. Success is indicated by changing the X_op field to something other than O_absent and pointing input_line_pointer past the expression. If it can't parse the @@ -1541,6 +1549,13 @@ operator (int *num_chars) default: return op_encoding[c]; + case '+': + case '-': + /* Do not allow a++b and a--b to be a + (+b) and a - (-b) */ + if (input_line_pointer[1] != c) + return op_encoding[c]; + return O_illegal; + case '<': switch (input_line_pointer[1]) { |