From: Matt Turner Date: Thu, 22 Jan 2015 04:22:18 +0000 (-0800) Subject: nir: Replace assert(0) with unreachable(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28b7c6b28523f9a6786441bb0b86bf143b8a9b7c;p=mesa.git nir: Replace assert(0) with unreachable(). Fixes a couple of warnings in the process. Reviewed-by: Connor Abbott --- diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp index 6ac830e44d9..1457c1cac1c 100644 --- a/src/glsl/nir/glsl_to_nir.cpp +++ b/src/glsl/nir/glsl_to_nir.cpp @@ -216,8 +216,7 @@ constant_copy(ir_constant *ir, void *mem_ctx) break; default: - assert(0); - break; + unreachable("not reached"); } return ret; @@ -278,8 +277,7 @@ nir_visitor::visit(ir_variable *ir) break; default: - assert(0); - break; + unreachable("not reached"); } var->data.interpolation = ir->data.interpolation; @@ -311,8 +309,7 @@ nir_visitor::visit(ir_variable *ir) var->data.depth_layout = nir_depth_layout_unchanged; break; default: - assert(0); - break; + unreachable("not reached"); } var->data.location = ir->data.location; @@ -374,8 +371,7 @@ nir_visitor::visit(ir_variable *ir) break; default: - assert(0); - break; + unreachable("not reached"); } _mesa_hash_table_insert(var_table, ir, var); @@ -429,8 +425,7 @@ nir_visitor::create_overload(ir_function_signature *ir, nir_function *function) break; default: - assert(0); - break; + unreachable("not reached"); } overload->params[i].type = param->type; @@ -573,8 +568,7 @@ nir_visitor::visit(ir_loop_jump *ir) type = nir_jump_continue; break; default: - assert(0); - break; + unreachable("not reached"); } nir_jump_instr *instr = nir_jump_instr_create(this->shader, type); @@ -793,8 +787,7 @@ get_instr_dest(nir_instr *instr) return &tex_instr->dest; default: - assert(0); - break; + unreachable("not reached"); } return NULL; @@ -1087,8 +1080,7 @@ nir_visitor::visit(ir_expression *ir) dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } break; case ir_unop_trunc: emit(nir_op_ftrunc, dest_size, srcs); break; @@ -1207,8 +1199,7 @@ nir_visitor::visit(ir_expression *ir) } break; default: - assert(0); - break; + unreachable("not reached"); } break; case ir_binop_add: @@ -1296,8 +1287,7 @@ nir_visitor::visit(ir_expression *ir) break; default: - assert(0); - break; + unreachable("not reached"); } instr = emit(op, dest_size, srcs); @@ -1402,8 +1392,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_ball_fequal3, dest_size, srcs); break; case 4: emit(nir_op_ball_fequal4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } } else { switch (ir->operands[0]->type->vector_elements) { @@ -1412,8 +1401,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_ball_iequal3, dest_size, srcs); break; case 4: emit(nir_op_ball_iequal4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } } } else { @@ -1423,8 +1411,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_fall_equal3, dest_size, srcs); break; case 4: emit(nir_op_fall_equal4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } } break; @@ -1437,8 +1424,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_bany_fnequal3, dest_size, srcs); break; case 4: emit(nir_op_bany_fnequal4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } } else { switch (ir->operands[0]->type->vector_elements) { @@ -1447,8 +1433,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_bany_inequal3, dest_size, srcs); break; case 4: emit(nir_op_bany_inequal4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } } } else { @@ -1458,8 +1443,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_fany_nequal3, dest_size, srcs); break; case 4: emit(nir_op_fany_nequal4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } } break; @@ -1487,8 +1471,7 @@ nir_visitor::visit(ir_expression *ir) case 3: emit(nir_op_fdot3, dest_size, srcs); break; case 4: emit(nir_op_fdot4, dest_size, srcs); break; default: - assert(0); - break; + unreachable("not reached"); } break; @@ -1545,8 +1528,7 @@ nir_visitor::visit(ir_expression *ir) break; default: - assert(0); - break; + unreachable("not reached"); } } @@ -1621,8 +1603,7 @@ nir_visitor::visit(ir_texture *ir) break; default: - assert(0); - break; + unreachable("not reached"); } if (ir->projector != NULL) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 7b5794d7470..52bcd877f44 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -938,8 +938,7 @@ nir_tex_instr_dest_size(nir_tex_instr *instr) ret = 3; break; default: - assert(0); - break; + unreachable("not reached"); } if (instr->is_array) ret++; diff --git a/src/glsl/nir/nir_lower_system_values.c b/src/glsl/nir/nir_lower_system_values.c index f681a6ce934..631f7cd4636 100644 --- a/src/glsl/nir/nir_lower_system_values.c +++ b/src/glsl/nir/nir_lower_system_values.c @@ -64,8 +64,7 @@ convert_instr(nir_intrinsic_instr *instr) op = nir_intrinsic_load_invocation_id; break; default: - assert(0); - break; + unreachable("not reached"); } nir_intrinsic_instr *new_instr = nir_intrinsic_instr_create(mem_ctx, op); diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c index b9b1cff9cf2..548f0c5ac23 100644 --- a/src/glsl/nir/nir_to_ssa.c +++ b/src/glsl/nir/nir_to_ssa.c @@ -313,7 +313,7 @@ rewrite_alu_instr_forward(nir_alu_instr *instr, rewrite_state *state) case 2: op = nir_op_vec2; break; case 3: op = nir_op_vec3; break; case 4: op = nir_op_vec4; break; - default: assert(0); break; + default: unreachable("not reached"); } nir_alu_instr *vec = nir_alu_instr_create(state->mem_ctx, op);