vkd3d-shader/preproc: Expand macro arguments in macro invocations.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55361
This commit is contained in:
Zebediah Figura 2023-07-29 18:13:41 -05:00 committed by Alexandre Julliard
parent 9b98489155
commit 3a235b57f6
Notes: Alexandre Julliard 2023-08-02 21:24:27 +09:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/291
2 changed files with 26 additions and 0 deletions

View File

@ -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, " ");

View File

@ -305,3 +305,9 @@ __LINE__
[preproc]
#define KEY pass
apple # KEY
[preproc]
#define KEY2(x) x ## ss
#define KEY(a) KEY2(a)
KEY(pa)