From d4cf9db1eb2e1b654e47a1186f79d7269131366a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 9 Apr 2009 03:50:06 -0400 Subject: [PATCH] Handle macro arguments that contain parentheses, like macro((1+1),2). Fixes unit test preprocessor/output/macro-paren-stacking. --- mojoshader_preprocessor.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index e410ad5f..e79a62c6 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -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