Mesa (master): glsl: 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: b882857d288debc327486894e20eeb47edf9241d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b882857d288debc327486894e20eeb47edf9241d
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Jan 26 14:11:04 2021 -0500
glsl: Silence a warning at -Og
../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 <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>
---
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 45643e82ae4..008f07d287e 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;
More information about the mesa-commit
mailing list