From 6e9cfa6452349f0523912448b5c97c7dc24f4920 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 3 Mar 2010 08:06:44 -0800 Subject: [PATCH] When processing identifiers in macro "calls", check both args and #defines. --- mojoshader_preprocessor.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index b0ab38b7..77a03a23 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -1387,11 +1387,16 @@ static int handle_pp_identifier(Context *ctx) break; } // else if - // is this an arg in the current macro? - // This is a special case, we need to replace here. - else if ((state->is_macro) && (t == TOKEN_IDENTIFIER)) + // see if a replacement is in order... + // !!! FIXME: this fails if we get another macro with args: + // !!! FIXME: macro1(macro2(arg)) + else if (t == TOKEN_IDENTIFIER) { - const Define *arg = find_macro_arg(state); + const Define *arg = NULL; + if (state->is_macro) + arg = find_macro_arg(state); + if (arg == NULL) + arg = find_define_by_token(ctx); if (arg) { expr = arg->definition;