From b882857d288debc327486894e20eeb47edf9241d Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 26 Jan 2021 14:11:04 -0500 Subject: [PATCH] glsl: Silence a warning at -Og MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ../src/compiler/glsl/gl_nir_link_uniforms.c:1786:50: warning: ‘blocks’ may be used uninitialized in this function [-Wmaybe-uninitialized] 1786 | const struct gl_uniform_block *const block = Just do nothing if we somehow fail to initialize blocks. Reviewed-by: Eric Anholt Part-of: --- src/compiler/glsl/gl_nir_link_uniforms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index 45643e8..008f07d 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -1651,7 +1651,7 @@ gl_nir_link_uniforms(struct gl_context *ctx, int location = var->data.location; - struct gl_uniform_block *blocks; + struct gl_uniform_block *blocks = NULL; int num_blocks = 0; int buffer_block_index = -1; if (!prog->data->spirv && state.var_is_in_block) { @@ -1729,7 +1729,7 @@ gl_nir_link_uniforms(struct gl_context *ctx, } } - if (!prog->data->spirv && state.var_is_in_block) { + if (blocks && !prog->data->spirv && state.var_is_in_block) { if (glsl_without_array(state.current_var->type) != state.current_var->interface_type) { /* this is nested at some offset inside the block */ bool found = false; -- 2.7.4