From: Timothy Arceri Date: Mon, 6 Jul 2020 03:20:04 +0000 (+1000) Subject: nouveau/nvc0: silence maybe-uninitialized warning X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7ccf2580638c690bb2661781a06385a6f96e6217;p=mesa.git nouveau/nvc0: silence maybe-uninitialized warning gcc is not smart enough to see that enum pipe_format dst_fmt; ... switch (data_size) { case 16: dst_fmt = PIPE_FORMAT_R32G32B32A32_UINT; ... break; case 12: /* RGB32 is not a valid RT format. This will be handled by the pushbuf * uploader. */ break; case 8: dst_fmt = PIPE_FORMAT_R32G32_UINT; ... break; case 4: dst_fmt = PIPE_FORMAT_R32_UINT; ... break; case 2: dst_fmt = PIPE_FORMAT_R16_UINT; ... break; case 1: dst_fmt = PIPE_FORMAT_R8_UINT; break; default: assert(!"Unsupported element size"); return; } ... if (data_size == 12) { ... return; } Does not result in dst_fmt being uninitialized when it is used so lets just initialise it to silence the warning. Reviewed-by: Ilia Mirkin Part-of: --- diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c index 731b0b5dbf8..725e391d4f7 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c @@ -514,6 +514,7 @@ nvc0_clear_buffer(struct pipe_context *pipe, /* RGB32 is not a valid RT format. This will be handled by the pushbuf * uploader. */ + dst_fmt = PIPE_FORMAT_NONE; /* Init dst_fmt to silence gcc warning */ break; case 8: dst_fmt = PIPE_FORMAT_R32G32_UINT;