[Piglit] [PATCH 2/2] s3tc: Silence compiler warnings when building for GLES

Ian Romanick idr at freedesktop.org
Tue Jan 22 21:33:11 UTC 2019


From: Ian Romanick <ian.d.romanick at intel.com>

tests/texturing/s3tc-errors.c: In function ‘test_format’:
tests/texturing/s3tc-errors.c:175:9: warning: unused variable ‘format2’ [-Wunused-variable]
  GLenum format2;
         ^~~~~~~
At top level:
tests/texturing/s3tc-errors.c:155:1: warning: ‘check_gl_error2_’ defined but not used [-Wunused-function]
 check_gl_error2_(GLenum err1, GLenum err2, int line)
 ^~~~~~~~~~~~~~~~
---
 tests/texturing/s3tc-errors.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index ccc0be9a7..509bff980 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -147,6 +147,7 @@ check_rendering_(int width, int height, int line)
 #define check_rendering(w, h) check_rendering_(w, h, __LINE__)
 
 
+#ifdef PIGLIT_USE_OPENGL
 /**
  * Check for either of two expected GL errors.
  * XXX this could be a piglit util function
@@ -164,6 +165,7 @@ check_gl_error2_(GLenum err1, GLenum err2, int line)
 }
 
 #define check_gl_error2(err1, err2)  check_gl_error2_(err1, err2, __LINE__)
+#endif
 
 
 static bool
@@ -172,7 +174,6 @@ test_format(int width, int height, GLfloat *image, GLenum requested_format)
 #ifdef PIGLIT_USE_OPENGL
 	GLubyte *compressed_image;
 #endif
-	GLenum format2;
 	int x, y, w, h;
 	GLuint tex;
 	bool pass = true;
@@ -350,10 +351,10 @@ test_format(int width, int height, GLfloat *image, GLenum requested_format)
 	pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
 
 	/* Try compressed subimage with different format - should not work */
-	if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
-		format2 = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-	else
-		format2 = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+	const GLenum format2 = format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT
+		? GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
+		: GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+
 	x = 4;
 	y = 4;
 	w = 4;
-- 
2.14.5



More information about the Piglit mailing list