* expr.c (operand): Reject ++ and --.

(operator): Likewise.
This commit is contained in:
Nathan Sidwell 2004-03-18 09:19:20 +00:00
parent 79349b0926
commit 3e4caed2b1
2 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2004-03-18 Nathan Sidwell <nathan@codesourcery.com>
* expr.c (operand): Reject ++ and --.
(operator): Likewise.
2004-03-17 Kaz Kojima <kkojima@rr.iij4u.or.jp> 2004-03-17 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* config/tc-sh.c: Include dw2gencfi.h. * config/tc-sh.c: Include dw2gencfi.h.

View file

@ -1021,6 +1021,9 @@ operand (expressionS *expressionP)
break; break;
case '+': case '+':
/* Do not accept ++e as +(+e) */
if (input_line_pointer[1] == '+')
goto target_op;
(void) operand (expressionP); (void) operand (expressionP);
break; break;
@ -1038,6 +1041,10 @@ operand (expressionS *expressionP)
case '!': case '!':
case '-': case '-':
{ {
/* Do not accept --e as -(-e) */
if (c == '-' && input_line_pointer[1] == '-')
goto target_op;
operand (expressionP); operand (expressionP);
if (expressionP->X_op == O_constant) if (expressionP->X_op == O_constant)
{ {
@ -1289,6 +1296,7 @@ operand (expressionS *expressionP)
} }
else else
{ {
target_op:
/* Let the target try to parse it. Success is indicated by changing /* Let the target try to parse it. Success is indicated by changing
the X_op field to something other than O_absent and pointing the X_op field to something other than O_absent and pointing
input_line_pointer past the expression. If it can't parse the input_line_pointer past the expression. If it can't parse the
@ -1541,6 +1549,13 @@ operator (int *num_chars)
default: default:
return op_encoding[c]; 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 '<': case '<':
switch (input_line_pointer[1]) switch (input_line_pointer[1])
{ {