[Piglit] [PATCH 6/9] util/gl: remove '#if defined(GL_SYMBOL)' guards

Emil Velikov emil.l.velikov at gmail.com
Mon Jun 27 16:52:45 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

Those symbols are part of the ABI/API and cannot change. Just define
them locally when needed.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 tests/util/piglit-util-gl.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 727a901..b6bf4de 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -156,6 +156,17 @@ void piglit_require_not_extension(const char *name)
 
 const char* piglit_get_gl_error_name(GLenum error)
 {
+/* enums that are not available everywhere */
+#ifndef GL_STACK_OVERFLOW
+#define GL_STACK_OVERFLOW                 0x0503
+#endif
+#ifndef GL_STACK_UNDERFLOW
+#define GL_STACK_UNDERFLOW                0x0504
+#endif
+#ifndef GL_INVALID_FRAMEBUFFER_OPERATION
+#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
+#endif
+
 #define CASE(x) case x: return #x; 
     switch (error) {
     CASE(GL_INVALID_ENUM)
@@ -163,16 +174,9 @@ const char* piglit_get_gl_error_name(GLenum error)
     CASE(GL_INVALID_VALUE)
     CASE(GL_NO_ERROR)
     CASE(GL_OUT_OF_MEMORY)
-    /* enums that are not available everywhere */
-#if defined(GL_STACK_OVERFLOW)
     CASE(GL_STACK_OVERFLOW)
-#endif
-#if defined(GL_STACK_UNDERFLOW)
     CASE(GL_STACK_UNDERFLOW)
-#endif
-#if defined(GL_INVALID_FRAMEBUFFER_OPERATION)
     CASE(GL_INVALID_FRAMEBUFFER_OPERATION)
-#endif
     default:
         return "(unrecognized error)";
     }
-- 
2.8.2



More information about the Piglit mailing list