radv/ac: some fix maybe-uninitialized warnings
authorGrazvydas Ignotas <notasas@gmail.com>
Sat, 10 Dec 2016 19:10:05 +0000 (21:10 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 10 Dec 2016 20:46:56 +0000 (21:46 +0100)
Mark some paths unreachable so that compiler knows variables are
initialized in all valid paths.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_nir_to_llvm.c

index d5dfbb1329229496fccd6d5067c575e2f04d53ea..398db6ace37e37c01230107b398db66ed85cef50 100644 (file)
@@ -721,7 +721,8 @@ build_gather_values_extended(struct nir_to_llvm_context *ctx,
                if (load)
                        return LLVMBuildLoad(builder, values[0], "");
                return values[0];
-       }
+       } else if (!value_count)
+               unreachable("value_count is 0");
 
        for (i = 0; i < value_count; i++) {
                LLVMValueRef value = values[i * value_stride];
@@ -3151,6 +3152,8 @@ static LLVMValueRef get_sampler_desc(struct nir_to_llvm_context *ctx,
                type = ctx->v4i32;
                type_size = 16;
                break;
+       default:
+               unreachable("invalid desc_type\n");
        }
 
        if (deref->deref.child) {