[PATCH 2/5] d3dcompiler: Move modifer processing up out of the struct_spec rules.
Matteo Bruni
matteo.mystral at gmail.com
Thu Mar 19 15:21:04 CDT 2020
On Sun, Mar 15, 2020 at 10:25 PM Zebediah Figura <z.figura12 at gmail.com> wrote:
>
> So that storage classes will be stored in the relevant hlsl_ir_var instead of in
> the type.
>
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
> dlls/d3dcompiler_43/hlsl.y | 62 ++++++++++++++++++++------------------
> 1 file changed, 32 insertions(+), 30 deletions(-)
>
> diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
> index fca4ebc5296..556c03b11fe 100644
> --- a/dlls/d3dcompiler_43/hlsl.y
> +++ b/dlls/d3dcompiler_43/hlsl.y
> @@ -771,7 +771,7 @@ static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, s
> return list;
> }
>
> -static struct hlsl_type *new_struct_type(const char *name, DWORD modifiers, struct list *fields)
> +static struct hlsl_type *new_struct_type(const char *name, struct list *fields)
> {
> struct hlsl_type *type = d3dcompiler_alloc(sizeof(*type));
>
> @@ -783,7 +783,6 @@ static struct hlsl_type *new_struct_type(const char *name, DWORD modifiers, stru
> type->type = HLSL_CLASS_STRUCT;
> type->name = name;
> type->dimx = type->dimy = 1;
> - type->modifiers = modifiers;
> type->e.elements = fields;
>
> list_add_tail(&hlsl_ctx.types, &type->entry);
> @@ -1127,6 +1126,8 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
> %type <type> struct_spec
> %type <type> named_struct_spec
> %type <type> unnamed_struct_spec
> +%type <type> field_type
> +%type <type> typedef_type
> %type <list> type_specs
> %type <variable_def> type_spec
> %type <initializer> complex_initializer
> @@ -1248,56 +1249,60 @@ preproc_directive: PRE_LINE STRING
> }
> }
>
> -struct_declaration: struct_spec variables_def_optional ';'
> +struct_declaration: var_modifiers struct_spec variables_def_optional ';'
> {
> - if (!$2)
> + struct hlsl_type *type;
> + DWORD modifiers = $1;
> +
> + if (!$3)
> {
> - if (!$1->name)
> + if (!$2->name)
> {
> hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR,
> "anonymous struct declaration with no variables");
> }
Tiny nitpick, probably &@2 is a better location for this message.
More information about the wine-devel
mailing list