From 3d77950b8b79c3ced785462b48f8283704f38e9a Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Sun, 30 Jan 2022 10:50:42 +0100 Subject: [PATCH] lima/ppir: clean up override-init warnings Define ppir_op_unsupported as 0 so that we don't have to do the initialization to -1. Signed-off-by: Erico Nunes Reviewed-by: Vasily Khoruzhick Part-of: --- src/gallium/drivers/lima/ir/pp/nir.c | 5 +---- src/gallium/drivers/lima/ir/pp/node.c | 3 +++ src/gallium/drivers/lima/ir/pp/ppir.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c index 1d58708..816daf7 100644 --- a/src/gallium/drivers/lima/ir/pp/nir.c +++ b/src/gallium/drivers/lima/ir/pp/nir.c @@ -123,9 +123,6 @@ static void ppir_node_add_src(ppir_compiler *comp, ppir_node *node, } static int nir_to_ppir_opcodes[nir_num_opcodes] = { - /* not supported */ - [0 ... nir_last_opcode] = -1, - [nir_op_mov] = ppir_op_mov, [nir_op_fmul] = ppir_op_mul, [nir_op_fabs] = ppir_op_abs, @@ -162,7 +159,7 @@ static bool ppir_emit_alu(ppir_block *block, nir_instr *ni) nir_alu_instr *instr = nir_instr_as_alu(ni); int op = nir_to_ppir_opcodes[instr->op]; - if (op < 0) { + if (op == ppir_op_unsupported) { ppir_error("unsupported nir_op: %s\n", nir_op_infos[instr->op].name); return false; } diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c index cc51448..8948208 100644 --- a/src/gallium/drivers/lima/ir/pp/node.c +++ b/src/gallium/drivers/lima/ir/pp/node.c @@ -29,6 +29,9 @@ #include "ppir.h" const ppir_op_info ppir_op_infos[] = { + [ppir_op_unsupported] = { + .name = "unsupported", + }, [ppir_op_mov] = { .name = "mov", .slots = (int []) { diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h index 70b9559..de2b542 100644 --- a/src/gallium/drivers/lima/ir/pp/ppir.h +++ b/src/gallium/drivers/lima/ir/pp/ppir.h @@ -32,6 +32,7 @@ #include "ir/lima_ir.h" typedef enum { + ppir_op_unsupported = 0, ppir_op_mov, ppir_op_abs, ppir_op_neg, -- 2.7.4