[Mesa-dev] [PATCH 2/3] nir: Replace assert(0) with unreachable().

Connor Abbott cwabbott0 at gmail.com
Tue Feb 10 11:31:29 PST 2015


Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

On Tue, Feb 10, 2015 at 2:24 PM, Matt Turner <mattst88 at gmail.com> wrote:
> ---
>  src/glsl/nir/glsl_to_nir.cpp | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
> index 46cfac3..e505a1d 100644
> --- a/src/glsl/nir/glsl_to_nir.cpp
> +++ b/src/glsl/nir/glsl_to_nir.cpp
> @@ -604,7 +604,7 @@ nir_visitor::visit(ir_call *ir)
>        } else if (strcmp(ir->callee_name(), "__intrinsic_atomic_predecrement") == 0) {
>           op = nir_intrinsic_atomic_counter_dec_var;
>        } else {
> -         assert(0);
> +         unreachable("not reached");
>        }
>
>        nir_intrinsic_instr *instr = nir_intrinsic_instr_create(shader, op);
> @@ -1162,7 +1162,7 @@ nir_visitor::visit(ir_expression *ir)
>              case 2: emit(nir_op_fnoise1_2, dest_size, srcs); break;
>              case 3: emit(nir_op_fnoise1_3, dest_size, srcs); break;
>              case 4: emit(nir_op_fnoise1_4, dest_size, srcs); break;
> -            default: assert(0); break;
> +            default: unreachable("not reached");
>           }
>           break;
>        case 2:
> @@ -1171,7 +1171,7 @@ nir_visitor::visit(ir_expression *ir)
>              case 2: emit(nir_op_fnoise2_2, dest_size, srcs); break;
>              case 3: emit(nir_op_fnoise2_3, dest_size, srcs); break;
>              case 4: emit(nir_op_fnoise2_4, dest_size, srcs); break;
> -            default: assert(0); break;
> +            default: unreachable("not reached");
>           }
>           break;
>        case 3:
> @@ -1180,7 +1180,7 @@ nir_visitor::visit(ir_expression *ir)
>              case 2: emit(nir_op_fnoise3_2, dest_size, srcs); break;
>              case 3: emit(nir_op_fnoise3_3, dest_size, srcs); break;
>              case 4: emit(nir_op_fnoise3_4, dest_size, srcs); break;
> -            default: assert(0); break;
> +            default: unreachable("not reached");
>           }
>           break;
>        case 4:
> @@ -1189,7 +1189,7 @@ nir_visitor::visit(ir_expression *ir)
>              case 2: emit(nir_op_fnoise4_2, dest_size, srcs); break;
>              case 3: emit(nir_op_fnoise4_3, dest_size, srcs); break;
>              case 4: emit(nir_op_fnoise4_4, dest_size, srcs); break;
> -            default: assert(0); break;
> +            default: unreachable("not reached");
>           }
>           break;
>        default:
> @@ -1517,7 +1517,7 @@ nir_visitor::visit(ir_expression *ir)
>           case 2: emit(nir_op_vec2, dest_size, srcs); break;
>           case 3: emit(nir_op_vec3, dest_size, srcs); break;
>           case 4: emit(nir_op_vec4, dest_size, srcs); break;
> -         default: assert(0); break;
> +         default: unreachable("not reached");
>        }
>        break;
>
> @@ -1627,7 +1627,7 @@ nir_visitor::visit(ir_texture *ir)
>        instr->dest_type = nir_type_unsigned;
>        break;
>     default:
> -      assert(0);
> +      unreachable("not reached");
>     }
>
>     ir->sampler->accept(this);
> --
> 2.0.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list