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

Submitted by Ian Romanick on Jan. 22, 2019, 9:33 p.m.

Details

Message ID 20190122213311.1806-2-idr@freedesktop.org
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Ian Romanick Jan. 22, 2019, 9:33 p.m.
From: Ian Romanick <ian.d.romanick@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(-)

Patch hide | download patch | download mbox

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;