Zebediah Figura : d3dcompiler: Fail if modifiers are applied to a function.
Alexandre Julliard
julliard at winehq.org
Fri Mar 13 15:24:45 CDT 2020
Module: wine
Branch: master
Commit: afd3a1e388ab720ae6eadad3ac7591ba9fa1614f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=afd3a1e388ab720ae6eadad3ac7591ba9fa1614f
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri Mar 13 17:34:55 2020 +0100
d3dcompiler: Fail if modifiers are applied to a function.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dcompiler_43/hlsl.y | 7 +++++++
dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 498ca4bb59..59e0df9d8c 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -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),
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c
index b16f6e3454..3edee34d8d 100644
--- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c
+++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c
@@ -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"};
More information about the wine-cvs
mailing list