[Mesa-dev] [PATCH] i965: Inform compiler of variable range to silence warning.

Ilia Mirkin imirkin at alum.mit.edu
Fri Jan 15 13:41:09 PST 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

Neat! Wasn't aware of (or forgot all about?) the assume macro.

On Fri, Jan 15, 2016 at 4:40 PM, Matt Turner <mattst88 at gmail.com> wrote:
> Extends commit 6531ccb70 to silence the warning in release builds as
> well.
> ---
>  src/mesa/drivers/dri/i965/brw_vue_map.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vue_map.c b/src/mesa/drivers/dri/i965/brw_vue_map.c
> index fea2436..b66c209 100644
> --- a/src/mesa/drivers/dri/i965/brw_vue_map.c
> +++ b/src/mesa/drivers/dri/i965/brw_vue_map.c
> @@ -248,6 +248,8 @@ brw_compute_tess_vue_map(struct brw_vue_map *vue_map,
>  static const char *
>  varying_name(brw_varying_slot slot)
>  {
> +   assume(slot < BRW_VARYING_SLOT_COUNT);
> +
>     if (slot < VARYING_SLOT_MAX)
>        return gl_varying_slot_name(slot);
>
> @@ -257,7 +259,6 @@ varying_name(brw_varying_slot slot)
>        [BRW_VARYING_SLOT_PNTC - VARYING_SLOT_MAX] = "BRW_VARYING_SLOT_PNTC",
>     };
>
> -   assert(slot < BRW_VARYING_SLOT_COUNT);
>     return brw_names[slot - VARYING_SLOT_MAX];
>  }
>
> --
> 2.4.9
>
> _______________________________________________
> 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