d3dcompiler: Fail if modifiers are applied to a function.

Signed-off-by: Zebediah Figura <zfigura@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 2020-03-13 17:34:55 +01:00 committed by Alexandre Julliard
parent eb4fc30463
commit afd3a1e388
2 changed files with 12 additions and 0 deletions

View File

@ -1322,8 +1322,15 @@ func_declaration: func_prototype compound_statement
pop_scope(&hlsl_ctx);
}
/* var_modifiers is necessary to avoid shift/reduce conflicts. */
func_prototype: var_modifiers type var_identifier '(' parameters ')' colon_attribute
{
if ($1)
{
hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR,
"unexpected modifiers on a function");
YYABORT;
}
if (get_variable(hlsl_ctx.globals, $3))
{
hlsl_report_message(get_location(&@3),

View File

@ -925,6 +925,11 @@ static void test_fail(void)
" float a[(x = 2)];\n"
" return float4(0, 0, 0, 0);\n"
"}",
"uniform float4 test() : SV_TARGET\n"
"{\n"
" return float4(0, 0, 0, 0);\n"
"}",
};
static const char *targets[] = {"ps_2_0", "ps_3_0", "ps_4_0"};