Skip to content

Commit

Permalink
Handle macro arguments that contain parentheses, like macro((1+1),2).
Browse files Browse the repository at this point in the history
 Fixes unit test preprocessor/output/macro-paren-stacking.
  • Loading branch information
icculus committed Apr 9, 2009
1 parent 3991032 commit d4cf9db
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mojoshader_preprocessor.c
Expand Up @@ -1232,14 +1232,16 @@ static int handle_pp_identifier(Context *ctx)
paren++;
else if (t == ')')
{
if (i != def->paramcount-1)
{
fail(ctx, "Too few macro arguments");
goto handle_pp_identifier_failed;
} // if

assert(paren >= 0);
if (paren == 0)
{
if (i != def->paramcount-1)
{
fail(ctx, "Too few macro arguments");
goto handle_pp_identifier_failed;
} // if
break;
} // if

paren--;
} // else if
Expand Down

0 comments on commit d4cf9db

Please sign in to comment.