MSVC is too stupid to see that line 3058 will not run unless n_variants has been set together with variants in the switch statement below.
-- v4: vkd3d-shader/hlsl: Make sure variants is initialized in declare_predefined_types().
From: Stefan Dösinger stefan@codeweavers.com
MSVC is too stupid to see it is unused when n_variants=0.
---
Note that there is a similar "error" in io_normaliser_add_index_range(). I have a work in progress implementation of vkd3d_unreachable and friends for MSVC that will take care of this. Sadly, it is on my other laptop that I left behind in Tanzania. --- libs/vkd3d-shader/hlsl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index ba5bcfbf..faeddb7e 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -3127,8 +3127,8 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
for (bt = 0; bt <= HLSL_TYPE_LAST_SCALAR; ++bt) { - unsigned int n_variants = 0; const char *const *variants; + unsigned int n_variants;
switch (bt) { @@ -3148,6 +3148,8 @@ static void declare_predefined_types(struct hlsl_ctx *ctx) break;
default: + n_variants = 0; + variants = NULL; break; }
This merge request was approved by Henri Verbeet.