[Mesa-dev] [PATCH] st/mesa: silence warnings in optimized builds

Marek Olšák maraeo at gmail.com
Fri Nov 18 22:48:04 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Nov 17, 2016 at 11:00 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Mark variables and static functions that only occur in assert()s as
> MAYBE_UNUSED.
> ---
>  src/mesa/state_tracker/st_sampler_view.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
> index 2b2fa8b..88d5d1a 100644
> --- a/src/mesa/state_tracker/st_sampler_view.c
> +++ b/src/mesa/state_tracker/st_sampler_view.c
> @@ -310,21 +310,21 @@ get_texture_format_swizzle(const struct st_context *st,
>     return swizzle_swizzle(stObj->base._Swizzle, tex_swizzle);
>  }
>
>
>  /**
>   * Return TRUE if the texture's sampler view swizzle is not equal to
>   * the texture's swizzle.
>   *
>   * \param stObj  the st texture object,
>   */
> -static boolean
> +MAYBE_UNUSED static boolean
>  check_sampler_swizzle(const struct st_context *st,
>                        const struct st_texture_object *stObj,
>                       const struct pipe_sampler_view *sv, unsigned glsl_version)
>  {
>     unsigned swizzle = get_texture_format_swizzle(st, stObj, glsl_version);
>
>     return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) ||
>             (sv->swizzle_g != GET_SWZ(swizzle, 1)) ||
>             (sv->swizzle_b != GET_SWZ(swizzle, 2)) ||
>             (sv->swizzle_a != GET_SWZ(swizzle, 3)));
> @@ -466,21 +466,21 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
>     if (*sv) {
>        /* Debug check: make sure that the sampler view's parameters are
>         * what they're supposed to be.
>         */
>        MAYBE_UNUSED struct pipe_sampler_view *view = *sv;
>        assert(!check_sampler_swizzle(st, stObj, view, glsl_version));
>        assert(get_sampler_view_format(st, stObj, samp) == view->format);
>        assert(gl_target_to_pipe(stObj->base.Target) == view->target);
>        if (stObj->base.Target == GL_TEXTURE_BUFFER) {
>           unsigned base = stObj->base.BufferOffset;
> -         unsigned size = MIN2(stObj->pt->width0 - base,
> +         MAYBE_UNUSED unsigned size = MIN2(stObj->pt->width0 - base,
>                                (unsigned) stObj->base.BufferSize);
>           assert(view->u.buf.offset == base);
>           assert(view->u.buf.size == size);
>        }
>        else {
>           assert(stObj->base.MinLevel + stObj->base.BaseLevel ==
>                  view->u.tex.first_level);
>           assert(last_level(stObj) == view->u.tex.last_level);
>           assert(stObj->layer_override || stObj->base.MinLayer == view->u.tex.first_layer);
>           assert(stObj->layer_override || last_layer(stObj) == view->u.tex.last_layer);
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list