Skip to content

Commit

Permalink
Let "#if ((0) + (1) < 2)" understand that '+' isn't a unary operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Apr 16, 2013
1 parent 5db65b2 commit d731fb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mojoshader_preprocessor.c
Expand Up @@ -1691,12 +1691,16 @@ static int reduce_pp_expression(Context *ctx)
isleft = 0;
else if (token == ((Token) '-'))
{
if ((isleft = (previous_token == TOKEN_INT_LITERAL)) == 0)
isleft = ((previous_token == TOKEN_INT_LITERAL) ||
(previous_token == ((Token) ')')));
if (!isleft)
token = TOKEN_PP_UNARY_MINUS;
} // else if
else if (token == ((Token) '+'))
{
if ((isleft = (previous_token == TOKEN_INT_LITERAL)) == 0)
isleft = ((previous_token == TOKEN_INT_LITERAL) ||
(previous_token == ((Token) ')')));
if (!isleft)
token = TOKEN_PP_UNARY_PLUS;
} // else if

Expand Down

0 comments on commit d731fb1

Please sign in to comment.