nir: silence three compiler warnings seen with MinGW
authorBrian Paul <brianp@vmware.com>
Mon, 20 May 2019 13:33:14 +0000 (07:33 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 29 May 2019 19:59:24 +0000 (13:59 -0600)
Silence two unused var warnings.  And init elem_size, elem_align to
zero to silence "maybe uninitialized" warnings.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
src/compiler/nir/nir_lower_int_to_float.c
src/compiler/nir/nir_opt_copy_prop_vars.c
src/compiler/nir_types.cpp

index e31644d8cf73370762844f81fee08e2ec1edd45b..d0da60c925bef5ce176e3d3d19777d37536fd7d3 100644 (file)
@@ -28,7 +28,7 @@
 static bool
 assert_ssa_def_is_not_int(nir_ssa_def *def, void *arg)
 {
-   BITSET_WORD *int_types = arg;
+   MAYBE_UNUSED BITSET_WORD *int_types = arg;
    assert(!BITSET_TEST(int_types, def->index));
    return true;
 }
index 94bc8affd9e831edc11ecf69eb36cfa907d85e84..0fd96b7bee86986d1d539769d98c5ad7596ae6d5 100644 (file)
@@ -433,9 +433,7 @@ load_element_from_ssa_entry_value(struct copy_prop_var_state *state,
                                   nir_builder *b, nir_intrinsic_instr *intrin,
                                   struct value *value, unsigned index)
 {
-   const struct glsl_type *type = entry->dst->type;
-   unsigned num_components = glsl_get_vector_elements(type);
-   assert(index < num_components);
+   assert(index < glsl_get_vector_elements(entry->dst->type));
 
    /* We don't have the element available, so let the instruction do the work. */
    if (!entry->src.ssa.def[index])
index 3bf93c58b228ed3b7907db17ccc432b7cfd617d6..e2dfc40ff0b0c37ab6c4ac7c26a5c6e42691f973 100644 (file)
@@ -630,7 +630,7 @@ glsl_get_natural_size_align_bytes(const struct glsl_type *type,
       *size = 0;
       *align = 0;
       for (unsigned i = 0; i < type->length; i++) {
-         unsigned elem_size, elem_align;
+         unsigned elem_size = 0, elem_align = 0;
          glsl_get_natural_size_align_bytes(type->fields.structure[i].type,
                                            &elem_size, &elem_align);
          *align = MAX2(*align, elem_align);