[Mesa-dev] [PATCH 4/4] gallium: Use STATIC_ASSERT whenever possible.

Roland Scheidegger sroland at vmware.com
Tue Apr 12 15:33:20 UTC 2016


Am 12.04.2016 um 08:37 schrieb Jose Fonseca:
> ---
>  src/gallium/auxiliary/rtasm/rtasm_x86sse.c | 2 +-
>  src/gallium/auxiliary/tgsi/tgsi_lowering.c | 2 +-
>  src/gallium/auxiliary/tgsi/tgsi_parse.c    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
> index 27ee8f1..3e7d699 100644
> --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
> +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
> @@ -2203,7 +2203,7 @@ voidptr_to_x86_func(void *v)
>        void *v;
>        x86_func f;
>     } u;
> -   assert(sizeof(u.v) == sizeof(u.f));
> +   STATIC_ASSERT(sizeof(u.v) == sizeof(u.f));
>     u.v = v;
>     return u.f;
>  }
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_lowering.c b/src/gallium/auxiliary/tgsi/tgsi_lowering.c
> index a3b90bd..0ffd855 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_lowering.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_lowering.c
> @@ -1430,7 +1430,7 @@ tgsi_transform_lowering(const struct tgsi_lowering_config *config,
>     int newlen, numtmp;
>  
>     /* sanity check in case limit is ever increased: */
> -   assert((sizeof(config->saturate_s) * 8) >= PIPE_MAX_SAMPLERS);
> +   STATIC_ASSERT((sizeof(config->saturate_s) * 8) >= PIPE_MAX_SAMPLERS);
>  
>     memset(&ctx, 0, sizeof(ctx));
>     ctx.base.transform_instruction = transform_instr;
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
> index ae95ebd..16564dd 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
> @@ -313,7 +313,7 @@ tgsi_dump_tokens(const struct tgsi_token *tokens)
>     int nr = tgsi_num_tokens(tokens);
>     int i;
>     
> -   assert(sizeof(*tokens) == sizeof(unsigned));
> +   STATIC_ASSERT(sizeof(*tokens) == sizeof(unsigned));
>  
>     debug_printf("const unsigned tokens[%d] = {\n", nr);
>     for (i = 0; i < nr; i++)
> 

Looks great.
For the series,
Reviewed-by: Roland Scheidegger <sroland at vmware.com>


More information about the mesa-dev mailing list