[Mesa-dev] [PATCH 16/17] i965: Silence uninitialized varible warnings
Ian Romanick
idr at freedesktop.org
Mon Jun 19 02:21:05 UTC 2017
From: Ian Romanick <ian.d.romanick at intel.com>
brw_blorp.c:1007:4: warning: ‘num_layers’ may be used uninitialized in this function [-Wmaybe-uninitialized]
blorp_clear_depth_stencil(&batch, &depth_surf, &stencil_surf,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
level, start_layer, num_layers,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
x0, y0, x1, y1,
~~~~~~~~~~~~~~~
(mask & BUFFER_BIT_DEPTH), ctx->Depth.Clear,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stencil_mask, ctx->Stencil.Clear);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
brw_blorp.c:1007:4: warning: ‘start_layer’ may be used uninitialized in this function [-Wmaybe-uninitialized]
brw_blorp.c:1007:4: warning: ‘level’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/dri/i965/brw_blorp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index 02158d9..05f46ee 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -955,7 +955,7 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw,
if (x0 == x1 || y0 == y1)
return;
- uint32_t level, start_layer, num_layers;
+ uint32_t level = 0, start_layer = 0, num_layers = 0;
struct isl_surf isl_tmp[4];
struct blorp_surf depth_surf, stencil_surf;
@@ -1001,6 +1001,7 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw,
}
assert((mask & BUFFER_BIT_DEPTH) || stencil_mask);
+ assert(num_layers != 0);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw, 0);
--
2.9.4
More information about the mesa-dev
mailing list