vkd3d-shader: Implement __LINE__.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-01-14 14:47:47 -06:00 committed by Alexandre Julliard
parent d33a896403
commit e72c2461cd
2 changed files with 21 additions and 1 deletions

View File

@ -471,6 +471,26 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
}
continue;
}
if (!strcmp(text, "__LINE__"))
{
const struct preproc_file *file = preproc_get_top_file(ctx);
/* Not the current line number, but rather the line
* number before invoking any macros. */
if (ctx->current_directive)
{
char string[13];
sprintf(string, "%d", file->buffer.location.line);
return return_token(T_INTEGER, lval, string);
}
if (preproc_is_writing(ctx))
vkd3d_string_buffer_printf(&ctx->buffer, "%d ", file->buffer.location.line);
continue;
}
}
if (ctx->current_directive)

View File

@ -350,7 +350,7 @@ static void test_preprocess(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
vkd3d_test_set_context("Source \"%s\"", tests[i].source);
todo_if (i == 9 || (i >= 12 && i <= 14))
todo_if (i == 9)
check_preprocess(tests[i].source, NULL, NULL, tests[i].present, tests[i].absent);
}
vkd3d_test_set_context(NULL);