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

Vinson Lee vlee at freedesktop.org
Fri Jan 10 19:06:44 PST 2014


Fix GCC maybe-uninitialized warnings.

glslparsertest.c: In function 'attach_dummy_shader':
glslparsertest.c:153:9: warning: 'shader_template' may be used uninitialized in this function [-Wmaybe-uninitialized]
  sprintf(shader_text,
         ^
glslparsertest.c: In function 'piglit_init':
glslparsertest.c:221:5: warning: 'type' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (type == GL_COMPUTE_SHADER) {
     ^
glslparsertest.c:199:9: note: 'type' was declared here
  GLenum type;
         ^

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

diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index fbfbb16..5957144 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -145,6 +145,7 @@ attach_dummy_shader(GLuint shader_prog, GLenum type)
 			"void main() { }";
 		break;
 	default:
+		shader_template = NULL;
 		printf("No dummy shader available for this shader type\n");
 		piglit_report_result(PIGLIT_FAIL);
 		break;
@@ -210,6 +211,7 @@ test(void)
 		type = GL_COMPUTE_SHADER;
 #endif
 	else {
+		type = GL_NONE;
 		fprintf(stderr, "Couldn't determine type of program %s\n",
 			filename);
 		piglit_report_result(PIGLIT_FAIL);
-- 
1.8.4.2



More information about the Piglit mailing list