nir/spirv: Use unreachable("...") rather than assert(!"...")

Quiets a number of uninitialized variable warnings in clang.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
Matt Turner
2017-07-06 18:43:28 -07:00
parent f99bde0dad
commit 02ba0d5a7b
2 changed files with 13 additions and 13 deletions

View File

@@ -262,7 +262,7 @@ vtn_handle_extension(struct vtn_builder *b, SpvOp opcode,
if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) { if (strcmp((const char *)&w[2], "GLSL.std.450") == 0) {
val->ext_handler = vtn_handle_glsl450_instruction; val->ext_handler = vtn_handle_glsl450_instruction;
} else { } else {
assert(!"Unsupported extension"); unreachable("Unsupported extension");
} }
break; break;
} }
@@ -724,7 +724,7 @@ translate_image_format(SpvImageFormat format)
case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */ case SpvImageFormatR16ui: return 0x8234; /* GL_R16UI */
case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */ case SpvImageFormatR8ui: return 0x8232; /* GL_R8UI */
default: default:
assert(!"Invalid image format"); unreachable("Invalid image format");
return 0; return 0;
} }
} }
@@ -919,7 +919,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
else if (dim == GLSL_SAMPLER_DIM_SUBPASS) else if (dim == GLSL_SAMPLER_DIM_SUBPASS)
dim = GLSL_SAMPLER_DIM_SUBPASS_MS; dim = GLSL_SAMPLER_DIM_SUBPASS_MS;
else else
assert(!"Unsupported multisampled image type"); unreachable("Unsupported multisampled image type");
} }
val->type->image_format = translate_image_format(format); val->type->image_format = translate_image_format(format);
@@ -934,7 +934,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_image_type(dim, is_array, val->type->type = glsl_image_type(dim, is_array,
glsl_get_base_type(sampled_type)); glsl_get_base_type(sampled_type));
} else { } else {
assert(!"We need to know if the image will be sampled"); unreachable("We need to know if the image will be sampled");
} }
break; break;
} }
@@ -1378,7 +1378,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
break; break;
case SpvOpConstantSampler: case SpvOpConstantSampler:
assert(!"OpConstantSampler requires Kernel Capability"); unreachable("OpConstantSampler requires Kernel Capability");
break; break;
default: default:
@@ -2626,7 +2626,7 @@ gl_primitive_from_spv_execution_mode(SpvExecutionMode mode)
case SpvExecutionModeOutputTriangleStrip: case SpvExecutionModeOutputTriangleStrip:
return 5; /* GL_TRIANGLE_STRIP */ return 5; /* GL_TRIANGLE_STRIP */
default: default:
assert(!"Invalid primitive type"); unreachable("Invalid primitive type");
return 4; return 4;
} }
} }
@@ -2646,7 +2646,7 @@ vertices_in_from_spv_execution_mode(SpvExecutionMode mode)
case SpvExecutionModeInputTrianglesAdjacency: case SpvExecutionModeInputTrianglesAdjacency:
return 6; return 6;
default: default:
assert(!"Invalid GS input mode"); unreachable("Invalid GS input mode");
return 0; return 0;
} }
} }
@@ -2974,7 +2974,7 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
break; break;
case SpvExecutionModeXfb: case SpvExecutionModeXfb:
assert(!"Unhandled execution mode"); unreachable("Unhandled execution mode");
break; break;
case SpvExecutionModeVecTypeHint: case SpvExecutionModeVecTypeHint:
@@ -3008,7 +3008,7 @@ vtn_handle_variable_or_type_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpMemberDecorate: case SpvOpMemberDecorate:
case SpvOpGroupDecorate: case SpvOpGroupDecorate:
case SpvOpGroupMemberDecorate: case SpvOpGroupMemberDecorate:
assert(!"Invalid opcode types and variables section"); unreachable("Invalid opcode types and variables section");
break; break;
case SpvOpTypeVoid: case SpvOpTypeVoid:

View File

@@ -599,7 +599,7 @@ vtn_type_block_size(struct vtn_type *type)
return type->stride * glsl_get_length(type->type); return type->stride * glsl_get_length(type->type);
default: default:
assert(!"Invalid block type"); unreachable("Invalid block type");
return 0; return 0;
} }
} }
@@ -825,7 +825,7 @@ vtn_block_load(struct vtn_builder *b, struct vtn_pointer *src)
&access_offset, &access_size); &access_offset, &access_size);
break; break;
default: default:
assert(!"Invalid block variable mode"); unreachable("Invalid block variable mode");
} }
nir_ssa_def *offset, *index = NULL; nir_ssa_def *offset, *index = NULL;
@@ -1422,7 +1422,7 @@ vtn_storage_class_to_mode(SpvStorageClass class,
mode = vtn_variable_mode_ssbo; mode = vtn_variable_mode_ssbo;
nir_mode = 0; nir_mode = 0;
} else { } else {
assert(!"Invalid uniform variable type"); unreachable("Invalid uniform variable type");
} }
break; break;
case SpvStorageClassStorageBuffer: case SpvStorageClassStorageBuffer:
@@ -1437,7 +1437,7 @@ vtn_storage_class_to_mode(SpvStorageClass class,
mode = vtn_variable_mode_sampler; mode = vtn_variable_mode_sampler;
nir_mode = nir_var_uniform; nir_mode = nir_var_uniform;
} else { } else {
assert(!"Invalid uniform constant variable type"); unreachable("Invalid uniform constant variable type");
} }
break; break;
case SpvStorageClassPushConstant: case SpvStorageClassPushConstant: