[Mesa-dev] [PATCH] nir: change asserts to unreachable in nir_type_conversion_op

Tapani Pälli tapani.palli at intel.com
Tue Jan 10 08:20:42 UTC 2017



On 01/10/2017 10:14 AM, Tapani Pälli wrote:
> this is to avoid following compilation error on Android:
>
>    error: control may reach end of non-void function [-Werror,-Wreturn-type]
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>  src/compiler/nir/nir.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
> index a2af390..f82b670 100644
> --- a/src/compiler/nir/nir.c
> +++ b/src/compiler/nir/nir.c
> @@ -1998,7 +1998,7 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type dst)
>              return nir_op_f2i;
>           };
>        default:
> -         assert(!"Invalid conversion");
> +         unreachable("Invalid conversion");
>        };
>     }
>
> @@ -2031,9 +2031,9 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type dst)
>        case nir_type_float:
>           return nir_op_d2f;
>        default:
> -         assert(!"Invalid conversion");
> +         unreachable("Invalid conversion");
>        };
>     default:
> -      assert(!"Invalid conversion");
> +      unreachable(!"Invalid conversion");

huh sorry about this one, I've removed '!' locally

>     };
>  }
>


More information about the mesa-dev mailing list