[Mesa-dev] [PATCH 4/4] etnaviv: annotate variables only used in debug build

Philipp Zabel p.zabel at pengutronix.de
Thu Nov 15 15:24:07 UTC 2018


On Thu, 2018-11-15 at 15:37 +0100, Lucas Stach wrote:
> Some of the status variables in the compiler are only used in asserts
> and thus may be unused in release builds. Annotate them accordingly
> to avoid 'unused but set' warnings from the compiler.
> 
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
>  src/gallium/drivers/etnaviv/etnaviv_compiler.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> index bbc61a59fc67..386136e46836 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
> @@ -477,7 +477,7 @@ static void
>  etna_compile_parse_declarations(struct etna_compile *c)
>  {
>     struct tgsi_parse_context ctx = { };
> -   unsigned status = TGSI_PARSE_OK;
> +   MAYBE_UNUSED unsigned status = TGSI_PARSE_OK;

Maybe out of scope for this patch, but the initial assignment is
superfluous here and in the next two instances:

>     status = tgsi_parse_init(&ctx, c->tokens);
>     assert(status == TGSI_PARSE_OK);
>  
> @@ -530,7 +530,7 @@ static void
>  etna_compile_pass_check_usage(struct etna_compile *c)
>  {
>     struct tgsi_parse_context ctx = { };
> -   unsigned status = TGSI_PARSE_OK;
> +   MAYBE_UNUSED unsigned status = TGSI_PARSE_OK;
>     status = tgsi_parse_init(&ctx, c->tokens);
>     assert(status == TGSI_PARSE_OK);
>  
> @@ -662,7 +662,7 @@ etna_compile_pass_optimize_outputs(struct etna_compile *c)
>  {
>     struct tgsi_parse_context ctx = { };
>     int inst_idx = 0;
> -   unsigned status = TGSI_PARSE_OK;
> +   MAYBE_UNUSED unsigned status = TGSI_PARSE_OK;
>     status = tgsi_parse_init(&ctx, c->tokens);
>     assert(status == TGSI_PARSE_OK);
>  
> @@ -1812,7 +1812,7 @@ static void
>  etna_compile_pass_generate_code(struct etna_compile *c)
>  {
>     struct tgsi_parse_context ctx = { };
> -   unsigned status = tgsi_parse_init(&ctx, c->tokens);
> +   MAYBE_UNUSED unsigned status = tgsi_parse_init(&ctx, c->tokens);
>     assert(status == TGSI_PARSE_OK);
>  
>     int inst_idx = 0;

regards
Philipp


More information about the mesa-dev mailing list