Zebediah Figura : vkd3d-shader/hlsl: Get rid of append_unop().
Module: vkd3d Branch: master Commit: 19b21ed005efe4a1715a072b6b5a7da9a5ab9823 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=19b21ed005efe4a1715a072b... Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 23 16:47:05 2021 -0500 vkd3d-shader/hlsl: Get rid of append_unop(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d-shader/hlsl.y | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 42a6768..941f49c 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1069,12 +1069,6 @@ static struct hlsl_ir_expr *add_expr(struct hlsl_ctx *ctx, struct list *instrs, return expr; } -static struct list *append_unop(struct list *list, struct hlsl_ir_node *node) -{ - list_add_tail(list, &node->entry); - return list; -} - static struct list *add_unary_expr(struct hlsl_ctx *ctx, struct list *instrs, enum hlsl_ir_expr_op op, struct vkd3d_shader_location loc) { @@ -2934,7 +2928,8 @@ postfix_expr: hlsl_error(ctx, @3, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Invalid swizzle \"%s\".", $3); YYABORT; } - $$ = append_unop($1, &swizzle->node); + list_add_tail($1, &swizzle->node.entry); + $$ = $1; } else { @@ -3047,6 +3042,7 @@ unary_expr: { struct hlsl_type *src_type = node_from_list($6)->data_type; struct hlsl_type *dst_type; + struct hlsl_ir_expr *cast; unsigned int i; if ($2) @@ -3074,7 +3070,13 @@ unary_expr: YYABORT; } - $$ = append_unop($6, &hlsl_new_cast(ctx, node_from_list($6), dst_type, &@3)->node); + if (!(cast = hlsl_new_cast(ctx, node_from_list($6), dst_type, &@3))) + { + hlsl_free_instr_list($6); + YYABORT; + } + list_add_tail($6, &cast->node.entry); + $$ = $6; } mul_expr:
participants (1)
-
Alexandre Julliard