From: Zebediah Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55361 --- libs/vkd3d-shader/preproc.l | 20 ++++++++++++++++++++ tests/preproc-macro.shader_test | 6 ++++++ 2 files changed, 26 insertions(+)
diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l index 20bf5cb57..faeb5d7a5 100644 --- a/libs/vkd3d-shader/preproc.l +++ b/libs/vkd3d-shader/preproc.l @@ -634,6 +634,26 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
switch (token) { + /* Most text gets left alone (e.g. if it contains macros, + * the macros should be evaluated later). + * Arguments are a special case, and are replaced with + * their values immediately. */ + case T_IDENTIFIER: + case T_IDENTIFIER_PAREN: + { + const struct preproc_text *expansion; + + if ((expansion = find_arg_expansion(ctx, text))) + { + preproc_push_expansion(ctx, expansion, NULL); + continue; + } + + if (current_arg) + preproc_text_add(current_arg, text); + break; + } + case T_NEWLINE: if (current_arg) preproc_text_add(current_arg, " "); diff --git a/tests/preproc-macro.shader_test b/tests/preproc-macro.shader_test index b2f2530e7..8f073965d 100644 --- a/tests/preproc-macro.shader_test +++ b/tests/preproc-macro.shader_test @@ -305,3 +305,9 @@ __LINE__ [preproc] #define KEY pass apple # KEY + +[preproc] +#define KEY2(x) x ## ss +#define KEY(a) KEY2(a) + +KEY(pa)