Mesa (main): lima/ppir: clean up override-init warnings

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 11 22:03:19 UTC 2022


Module: Mesa
Branch: main
Commit: 3d77950b8b79c3ced785462b48f8283704f38e9a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d77950b8b79c3ced785462b48f8283704f38e9a

Author: Erico Nunes <nunes.erico at gmail.com>
Date:   Sun Jan 30 10:50:42 2022 +0100

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 <nunes.erico at gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14894>

---

 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 1d58708ae70..816daf7f6f5 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 cc51448bfb3..8948208b220 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 70b95590697..de2b54257e8 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,



More information about the mesa-commit mailing list