[Piglit] [PATCH] arb_uniform_buffer_object-maxblocks: Silence uninitialized variable warning.

Vinson Lee vlee at freedesktop.org
Sat Jan 25 00:06:14 PST 2014


This patch fixes this Clang sometimes-uninitialized warning.

maxblocks.c:117:2: warning: variable 'shader' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
maxblocks.c:124:9: note: uninitialized use occurs here
        return shader;
               ^~~~~~
maxblocks.c:62:14: note: initialize the variable 'shader' to silence this warning
        char *shader;
                    ^
                     = NULL

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

diff --git a/tests/spec/arb_uniform_buffer_object/maxblocks.c b/tests/spec/arb_uniform_buffer_object/maxblocks.c
index f846894..dedce0e 100644
--- a/tests/spec/arb_uniform_buffer_object/maxblocks.c
+++ b/tests/spec/arb_uniform_buffer_object/maxblocks.c
@@ -59,7 +59,7 @@ PIGLIT_GL_TEST_CONFIG_END
 static char *
 get_shader(GLenum target, const char *block_prefix, int blocks)
 {
-	char *shader;
+	char *shader = NULL;
 	const char *vs_source =
 		"#extension GL_ARB_uniform_buffer_object : enable\n"
 		"\n"
-- 
1.8.5.3



More information about the Piglit mailing list