[Piglit] [PATCH] arb_uniform_buffer_object: Silence uninitialized variable warnings.

Vinson Lee vlee at freedesktop.org
Wed Jan 29 20:31:21 PST 2014


This patch silences these Clang sometimes-uninitialized warnings.

maxuniformblocksize.c:158:2: warning: variable 'vs_source' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
maxuniformblocksize.c:162:52: note: uninitialized use occurs here
        vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
                                                          ^~~~~~~~~
maxuniformblocksize.c:106:17: note: initialize the variable 'vs_source' to silence this warning
        char *vs_source, *fs_source;
                       ^
                        = NULL
maxuniformblocksize.c:158:2: warning: variable 'fs_source' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
maxuniformblocksize.c:163:54: note: uninitialized use occurs here
        fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
                                                            ^~~~~~~~~
maxuniformblocksize.c:106:29: note: initialize the variable 'fs_source' to silence this warning
        char *vs_source, *fs_source;
                                   ^
                                    = NULL

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c b/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c
index 720fc5c..bf5f3fd 100644
--- a/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c
+++ b/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c
@@ -156,6 +156,8 @@ piglit_display(void)
 		printf("Testing FS with uniform block vec4 v[%d]\n", vec4s);
 		break;
 	default:
+		vs_source = NULL;
+		fs_source = NULL;
 		piglit_report_result(PIGLIT_FAIL);
 	}
 
-- 
1.8.3.2



More information about the Piglit mailing list