Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.c:
return c; }
+static bool hlsl_switch_has_case(const struct hlsl_ir_switch_case *check, struct list *cases) +{ + struct hlsl_ir_switch_case *c; + + if (check->is_default) + return false; + + LIST_FOR_EACH_ENTRY(c, cases, struct hlsl_ir_switch_case, entry) + { + if (c->is_default) continue; + if (c->value == check->value && c != check) + return true; + }
This will report an error twice for each duplicate case. I guess in some sense that's fine, but it's not how we report most redefinition errors; we use an hlsl_error() for the redefinition and a hlsl_note() for the previous location. Along the lines of "report errors when parsing", we may want to structure this so that we check for a redefinition when adding a new case, like we do for e.g. struct fields. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/361#note_49499