From 54bd6f7b4baffe8e33b8cdcdb96087480ca890fc Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 14 Nov 2022 20:20:16 -0600 Subject: [PATCH] vkd3d-shader/hlsl: Return a hlsl_block from the "declaration_statement" rule. --- libs/vkd3d-shader/hlsl.y | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index c41e4ae0..b9dcb5bc 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -172,12 +172,6 @@ static struct list *make_empty_list(struct hlsl_ctx *ctx) return list; } -static void destroy_instr_list(struct list *list) -{ - hlsl_free_instr_list(list); - vkd3d_free(list); -} - static void destroy_block(struct hlsl_block *block) { hlsl_block_cleanup(block); @@ -4558,7 +4552,6 @@ static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type %token PRE_LINE %type declaration -%type declaration_statement %type struct_declaration_without_vars %type type_specs %type variables_def @@ -4585,6 +4578,7 @@ static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type %type bitxor_expr %type compound_statement %type conditional_expr +%type declaration_statement %type equality_expr %type expr %type expr_optional @@ -4661,9 +4655,9 @@ hlsl_prog: | hlsl_prog buffer_declaration buffer_body | hlsl_prog declaration_statement { - if (!list_empty($2)) + if (!list_empty(&$2->instrs)) hlsl_fixme(ctx, &@2, "Uniform initializer."); - destroy_instr_list($2); + destroy_block($2); } | hlsl_prog preproc_directive | hlsl_prog ';' @@ -5512,10 +5506,16 @@ type: declaration_statement: declaration + { + $$ = list_to_block($1); + } | struct_declaration_without_vars + { + $$ = list_to_block($1); + } | typedef { - if (!($$ = make_empty_list(ctx))) + if (!($$ = make_empty_block(ctx))) YYABORT; } @@ -5912,9 +5912,6 @@ statement_list: statement: declaration_statement - { - $$ = list_to_block($1); - } | expr_statement | compound_statement | jump_statement