Don't replace macros with args until later in preprocessing.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 12 Mar 2010 10:35:37 -0500
changeset 898 7f55db1ec3c1
parent 897 c1b1c55d292a
child 899 460820bb1286
Don't replace macros with args until later in preprocessing. Fixes unit_tests/preprocessor/output/macro-with-arg-as-macro-arg ...
mojoshader_preprocessor.c
--- a/mojoshader_preprocessor.c	Fri Mar 12 09:42:24 2010 -0500
+++ b/mojoshader_preprocessor.c	Fri Mar 12 10:35:37 2010 -0500
@@ -1503,7 +1503,8 @@
             else if (t == TOKEN_IDENTIFIER)
             {
                 const Define *def = find_define_by_token(ctx);
-                if (def)
+                // don't replace macros with arguments so they replace correctly, later.
+                if ((def) && (def->paramcount == 0))
                 {
                     expr = def->definition;
                     exprlen = strlen(def->definition);