[Mesa-dev] [PATCH] spirv: replace assert with unreachable

Matt Turner mattst88 at gmail.com
Mon Aug 29 19:05:46 UTC 2016


On Sun, Aug 28, 2016 at 7:13 PM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> Fixes uninitialised warning for coord_components.
> ---
>  src/compiler/spirv/spirv_to_nir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
> index ca404d8..fda38f9 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -1426,7 +1426,7 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
>           coord_components = 3;
>           break;
>        default:
> -         assert("Invalid sampler type");
> +         unreachable("Invalid sampler type");

Not only does it fix an uninitialized warning, the assert was *wrong*.
It's missing the ! so it would have always been true!

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list