[Mesa-dev] [PATCH v1 2/7] etnaviv: Add return statement to etna_amode so compiler is happy

Emil Velikov emil.l.velikov at gmail.com
Fri Jun 16 12:54:17 UTC 2017


On 15 June 2017 at 21:47, Robert Foss <robert.foss at collabora.com> wrote:
> From: Tomeu Vizoso <tomeu.vizoso at collabora.com>
>
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_compiler.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> index eafb511bb8..8f73113059 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> @@ -885,6 +885,8 @@ etna_amode(struct tgsi_ind_register indirect)
>     default:
>        assert(!"Invalid swizzle");
>     }
> +
> +   return 0;
All the cases are handled correctly and even the default one will
never be reached.
Guess the compiler isn't smart enough, since we're using int:2 while
in reality we're storing an enum and using enum:2 might not always
work.

Alternative solutions is s/assert/unreachable/. The call will be up-to
the etna devs, but including something like the above (in the commit
summary or elsewhere) will be a good idea, IMHO.

-Emil


More information about the mesa-dev mailing list