Mesa (master): nouveau/nvc0: silence maybe-uninitialized warning

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 8 03:41:53 UTC 2020


Module: Mesa
Branch: master
Commit: 7ccf2580638c690bb2661781a06385a6f96e6217
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ccf2580638c690bb2661781a06385a6f96e6217

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Mon Jul  6 13:20:04 2020 +1000

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 <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5766>

---

 src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 1 +
 1 file changed, 1 insertion(+)

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;



More information about the mesa-commit mailing list