Mesa (master): microsoft/compiler: Fix unhandled switch case warnings

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 1 17:19:59 UTC 2020


Module: Mesa
Branch: master
Commit: 4e481a1f65571be8d09d2cddea18119ae5c4ce35
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e481a1f65571be8d09d2cddea18119ae5c4ce35

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Sat Nov 28 08:20:27 2020 -0800

microsoft/compiler: Fix unhandled switch case warnings

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780>

---

 src/microsoft/compiler/dxil_dump.c   |  1 +
 src/microsoft/compiler/dxil_nir.c    |  7 +++++++
 src/microsoft/compiler/nir_to_dxil.c | 10 ++++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/microsoft/compiler/dxil_dump.c b/src/microsoft/compiler/dxil_dump.c
index 46c702c7ba4..69faa2d2b81 100644
--- a/src/microsoft/compiler/dxil_dump.c
+++ b/src/microsoft/compiler/dxil_dump.c
@@ -326,6 +326,7 @@ dump_attr_set_list(struct dxil_dumper *d, struct list_head *list)
          case DXIL_ATTR_KIND_NO_UNWIND: value = "nounwind"; break;
          case DXIL_ATTR_KIND_READ_NONE: value = "readnone"; break;
          case DXIL_ATTR_KIND_READ_ONLY: value = "readonly"; break;
+         case DXIL_ATTR_KIND_NO_DUPLICATE: value = "noduplicate"; break;
          }
          _mesa_string_buffer_append(d->buf, value);
       }
diff --git a/src/microsoft/compiler/dxil_nir.c b/src/microsoft/compiler/dxil_nir.c
index 8c59fe8edc7..a9a7b324a68 100644
--- a/src/microsoft/compiler/dxil_nir.c
+++ b/src/microsoft/compiler/dxil_nir.c
@@ -777,6 +777,8 @@ dxil_nir_lower_loads_stores_to_dxil(nir_shader *nir)
             case nir_intrinsic_store_ssbo:
                progress |= lower_store_ssbo(&b, intr);
                break;
+            default:
+               break;
             }
          }
       }
@@ -851,6 +853,8 @@ dxil_nir_lower_atomics_to_dxil(nir_shader *nir)
             ATOMIC(comp_swap);
 
 #undef ATOMIC
+            default:
+               break;
             }
          }
       }
@@ -1199,6 +1203,8 @@ lower_fp16_casts_filter(const nir_instr *instr, const void *data)
       case nir_op_f2f16_rtne:
       case nir_op_f2f16_rtz:
          return true;
+      default:
+         return false;
       }
    } else if (instr->type == nir_instr_type_intrinsic) {
       nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
@@ -1348,6 +1354,7 @@ lower_fp16_cast_impl(nir_builder *b, nir_instr *instr, void *data)
       case nir_op_f2f16_rtz:
          mode = nir_rounding_mode_rtz;
          break;
+      default: unreachable("Should've been filtered");
       }
    } else {
       nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 023f4d714fa..ad063b65990 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -429,9 +429,9 @@ unary_func_name(enum dxil_intr intr)
    case DXIL_INTR_ISFINITE:
    case DXIL_INTR_ISNORMAL:
       return "dx.op.isSpecialFloat";
+   default:
+      return "dx.op.unary";
    }
-
-   return "dx.op.unary";
 }
 
 static const struct dxil_value *
@@ -1609,6 +1609,8 @@ emit_cast(struct ntd_context *ctx, nir_alu_instr *alu,
       if (is_double(info->input_types[0], nir_src_bit_size(alu->src[0].src)))
          ctx->mod.feats.dx11_1_double_extensions = true;
       break;
+   default:
+      break;
    }
 
    const struct dxil_value *v = dxil_emit_cast(&ctx->mod, opcode, type,
@@ -3591,6 +3593,10 @@ emit_tex(struct ntd_context *ctx, nir_tex_instr *instr)
       const struct dxil_value *retval = dxil_emit_extractval(&ctx->mod, sample, 3);
       store_dest(ctx, &instr->dest, 0, retval, nir_alu_type_get_base_type(instr->dest_type));
       return true;
+
+   default:
+      fprintf(stderr, "texture op: %d\n", instr->op);
+      unreachable("unknown texture op");
    }
 
    if (!sample)



More information about the mesa-commit mailing list