Mesa (master): loader: Silence a warning at -Og

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 18 21:15:30 UTC 2021


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

Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jan 26 14:11:52 2021 -0500

loader: Silence a warning at -Og

   ../src/loader/loader_dri3_helper.c: In function ‘dri3_free_buffers’:
   ../src/loader/loader_dri3_helper.c:2022:46: warning: ‘n_id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    2022 |    for (buf_id = first_id; buf_id < first_id + n_id; buf_id++) {

Can't happen, mark it unreachable.

Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>

---

 src/loader/loader_dri3_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index ccf8d1795e7..6c4b704ae5b 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -2017,6 +2017,9 @@ dri3_free_buffers(__DRIdrawable *driDrawable,
       first_id = LOADER_DRI3_FRONT_ID;
       /* Don't free a fake front holding new backbuffer content. */
       n_id = (draw->cur_blit_source == LOADER_DRI3_FRONT_ID) ? 0 : 1;
+      break;
+   default:
+      unreachable("unhandled buffer_type");
    }
 
    for (buf_id = first_id; buf_id < first_id + n_id; buf_id++) {



More information about the mesa-commit mailing list