diff mbox series

[1/2] mesa: Fix clang build error w/ util_blitter_get_color_format_for_zs()

Message ID 20190703231038.73097-1-john.stultz@linaro.org (mailing list archive)
State New, archived
Headers show
Series [1/2] mesa: Fix clang build error w/ util_blitter_get_color_format_for_zs() | expand

Commit Message

John Stultz July 3, 2019, 11:10 p.m. UTC
Building with clang, I'm seeing
 u_blitter.h:627:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]

The util_blitter_get_color_format_for_zs() asserts for any
unhandled types, so we do not expect to reach the end of the
function here.

But provide a dummy return with an explicit assert above
to ensure we don't hit it with any future changes to the logic.

Cc: Rob Clark <robdclark@chromium.org>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Greg Hartman <ghartman@google.com>
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 src/gallium/auxiliary/util/u_blitter.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Marek Olšák July 4, 2019, 3:45 a.m. UTC | #1
Thanks for the notice. I had already had a fix for this, but forgot to push
it. It's pushed now.

Marek

On Wed, Jul 3, 2019 at 7:10 PM John Stultz <john.stultz@linaro.org> wrote:

> Building with clang, I'm seeing
>  u_blitter.h:627:1: error: control may reach end of non-void function
> [-Werror,-Wreturn-type]
>
> The util_blitter_get_color_format_for_zs() asserts for any
> unhandled types, so we do not expect to reach the end of the
> function here.
>
> But provide a dummy return with an explicit assert above
> to ensure we don't hit it with any future changes to the logic.
>
> Cc: Rob Clark <robdclark@chromium.org>
> Cc: Emil Velikov <emil.l.velikov@gmail.com>
> Cc: Amit Pundir <amit.pundir@linaro.org>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Alistair Strachan <astrachan@google.com>
> Cc: Greg Hartman <ghartman@google.com>
> Cc: Tapani Pälli <tapani.palli@intel.com>
> Cc: Marek Olšák <marek.olsak@amd.com>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  src/gallium/auxiliary/util/u_blitter.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/auxiliary/util/u_blitter.h
> b/src/gallium/auxiliary/util/u_blitter.h
> index 9e3fa55e648..7d6c3db64da 100644
> --- a/src/gallium/auxiliary/util/u_blitter.h
> +++ b/src/gallium/auxiliary/util/u_blitter.h
> @@ -624,6 +624,9 @@ util_blitter_get_color_format_for_zs(enum pipe_format
> format)
>     default:
>        assert(0);
>     }
> +   assert(0);
> +   /*XXX NEVER GET HERE*/
> +   return PIPE_FORMAT_R32G32_UINT;
>  }
>
>  #ifdef __cplusplus
> --
> 2.17.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index 9e3fa55e648..7d6c3db64da 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -624,6 +624,9 @@  util_blitter_get_color_format_for_zs(enum pipe_format format)
    default:
       assert(0);
    }
+   assert(0);
+   /*XXX NEVER GET HERE*/
+   return PIPE_FORMAT_R32G32_UINT;
 }
 
 #ifdef __cplusplus