[Piglit] [PATCH] shader_runner: Replace some macros with real functions

Chad Versace chad.versace at linux.intel.com
Tue Dec 11 15:45:49 PST 2012


For some GL functions that are not present in GLES3, in
shader_runner_gles_workarounds.h I defined silly macros to suppress
unused-variable warnings. This patch replaces the silly macros with less
silly things: real functions.

CC: Eric Anholt <eric at anholt.net>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/shaders/shader_runner_gles_workarounds.h | 32 ++++++++++----------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/tests/shaders/shader_runner_gles_workarounds.h b/tests/shaders/shader_runner_gles_workarounds.h
index 9a33d21..f8940ed 100644
--- a/tests/shaders/shader_runner_gles_workarounds.h
+++ b/tests/shaders/shader_runner_gles_workarounds.h
@@ -72,10 +72,6 @@ unsupported_function(const char *name)
 }
 
 /**
- * This macro should be sufficient for most functions. If one of the actual
- * function's parameters causes an unused-variable warning, you must
- * special-case the function. See glBindProgramARB for example.
- *
  * GLES doesn't exist on Windows. So we're free to use the GCC/Clang extension
  * for statement expressions.
  */
@@ -101,23 +97,19 @@ unsupported_function(const char *name)
 #define glProgramLocalParameter4fvARB(...) 		UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0)
 #define glShadeModel(...) 				UNSUPPORTED_FUNCTION(glShadeModel, 0)
 
-#define glBindProgramARB(a, b) \
-	/* Custom definition to suppress unused-variable warnings. */ \
-	({ \
-	 	(void) a; \
-	 	(void) b; \
-		unsupported_function("glBindProgramARB"); \
-	 })
+/* Define a real function to suppress unused-variable warnings. */
+static void
+glBindProgramARB(GLenum target, GLuint program)
+{
+	unsupported_function("glBindProgramARB");
+}
 
-#define glVertexPointer(a, b, c, d) \
-	/* Custom definition to suppress unused-variable warnings. */ \
-	({ \
-	 	(void) a; \
-	 	(void) b; \
-	 	(void) c; \
-	 	(void) d; \
-		unsupported_function("glVertexPointer"); \
-	 })
+/* Define a real function to suppress unused-variable warnings. */
+static void
+glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
+{
+	unsupported_function("glVertexPointer");
+}
 
 static GLvoid*
 glMapBuffer(GLenum target, GLbitfield access)
-- 
1.7.11.7



More information about the Piglit mailing list