Commit 52529158 by Per Bothner

cppexp.c (cpp_parse_expr): Set HAVE_VALUE flag for unary minus, even if skip_evaluation is true.

* cppexp.c (cpp_parse_expr):  Set HAVE_VALUE flag for unary
minus, even if skip_evaluation is true.

From-SVN: r11085
parent de5529c8
...@@ -279,7 +279,7 @@ static struct token tokentab2[] = { ...@@ -279,7 +279,7 @@ static struct token tokentab2[] = {
struct operation struct operation
cpp_lex (pfile) cpp_lex (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
register int c; register int c;
register int namelen; register int namelen;
...@@ -793,11 +793,10 @@ cpp_parse_expr (pfile) ...@@ -793,11 +793,10 @@ cpp_parse_expr (pfile)
} }
break; break;
case '-': case '-':
if (skip_evaluation) ; /* do nothing */ if (!(top->flags & HAVE_VALUE))
else if (!(top->flags & HAVE_VALUE))
{ /* Unary '-' */ { /* Unary '-' */
top->value = - v2; top->value = - v2;
if ((top->value & v2) < 0 && ! unsigned2) if (!skip_evaluation && (top->value & v2) < 0 && !unsigned2)
integer_overflow (pfile); integer_overflow (pfile);
top->unsignedp = unsigned2; top->unsignedp = unsigned2;
top->flags |= HAVE_VALUE; top->flags |= HAVE_VALUE;
...@@ -806,7 +805,7 @@ cpp_parse_expr (pfile) ...@@ -806,7 +805,7 @@ cpp_parse_expr (pfile)
{ /* Binary '-' */ { /* Binary '-' */
top->value = v1 - v2; top->value = v1 - v2;
top->unsignedp = unsigned1 || unsigned2; top->unsignedp = unsigned1 || unsigned2;
if (! top->unsignedp if (! top->unsignedp && ! skip_evaluation
&& ! possible_sum_sign (top->value, v2, v1)) && ! possible_sum_sign (top->value, v2, v1))
integer_overflow (pfile); integer_overflow (pfile);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment