[Piglit] [PATCH] depthstencil-render-miplevels: Silence uninitialized variable warning.

Vinson Lee vlee at freedesktop.org
Fri Jan 24 23:58:58 PST 2014


This patch fixes this Clang sometimes-uninitialized warning.

depthstencil-render-miplevels.cpp:159:2: warning: variable 'format' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
depthstencil-render-miplevels.cpp:163:16: note: uninitialized use occurs here
        GLenum type = format == GL_DEPTH_STENCIL
                      ^~~~~~
depthstencil-render-miplevels.cpp:141:15: note: initialize the variable 'format' to silence this warning
        GLenum format;
                     ^
                      = 0

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/texturing/depthstencil-render-miplevels.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/texturing/depthstencil-render-miplevels.cpp b/tests/texturing/depthstencil-render-miplevels.cpp
index af8f747..4f57e09 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -138,7 +138,7 @@ supported_format(GLenum internal_format)
 GLuint
 create_mipmapped_tex(GLenum internal_format)
 {
-	GLenum format;
+	GLenum format = GL_NONE;
 
 	if (!supported_format(internal_format))
 		return 0;
-- 
1.8.5.3



More information about the Piglit mailing list