[Mesa-dev] [PATCH 2/5] mesa: Remove CHECK macro.

Matt Turner mattst88 at gmail.com
Sun Feb 22 21:13:26 PST 2015


There's some commentary about how it's defined by other "modules", and
maybe that was true in 2000 when the code was added.
---
 src/mesa/main/compiler.h    |  6 ----
 src/mesa/math/m_trans_tmp.h | 76 ++++++++++++++++++---------------------------
 src/mesa/math/m_translate.c |  6 ----
 3 files changed, 30 insertions(+), 58 deletions(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 6653bb2..91a6cd1 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -200,12 +200,6 @@ static inline GLuint CPU_TO_LE32(GLuint x)
 #endif
 
 
-/* Turn off macro checking systems used by other libraries */
-#ifdef CHECK
-#undef CHECK
-#endif
-
-
 /**
  * ASSERT macro
  */
diff --git a/src/mesa/math/m_trans_tmp.h b/src/mesa/math/m_trans_tmp.h
index f39a3c8..0e9f666 100644
--- a/src/mesa/math/m_trans_tmp.h
+++ b/src/mesa/math/m_trans_tmp.h
@@ -40,13 +40,11 @@ static void DEST_4F( GLfloat (*t)[4],
    (void) first;
    (void) start;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
-	 if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
-	 if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
-	 if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0;
-      }
+      NEXT_F2;
+      if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
+      if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
+      if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
+      if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0;
    }
 }
 #endif
@@ -66,13 +64,11 @@ static void DEST_4FN( GLfloat (*t)[4],
    (void) first;
    (void) start;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 if (SZ >= 1) t[i][0] = TRX_4FN(f, 0);
-	 if (SZ >= 2) t[i][1] = TRX_4FN(f, 1);
-	 if (SZ >= 3) t[i][2] = TRX_4FN(f, 2);
-	 if (SZ == 4) t[i][3] = TRX_4FN(f, 3); else t[i][3] = 1.0;
-      }
+      NEXT_F2;
+      if (SZ >= 1) t[i][0] = TRX_4FN(f, 0);
+      if (SZ >= 2) t[i][1] = TRX_4FN(f, 1);
+      if (SZ >= 3) t[i][2] = TRX_4FN(f, 2);
+      if (SZ == 4) t[i][3] = TRX_4FN(f, 3); else t[i][3] = 1.0;
    }
 }
 #endif
@@ -90,12 +86,10 @@ static void DEST_3FN( GLfloat (*t)[3],
    (void) first;
    (void) start;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 t[i][0] = TRX_3FN(f, 0);
-	 t[i][1] = TRX_3FN(f, 1);
-	 t[i][2] = TRX_3FN(f, 2);
-      }
+      NEXT_F2;
+      t[i][0] = TRX_3FN(f, 0);
+      t[i][1] = TRX_3FN(f, 1);
+      t[i][2] = TRX_3FN(f, 2);
    }
 }
 #endif
@@ -112,10 +106,8 @@ static void DEST_1F( GLfloat *t,
    (void) first;
    (void) start;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 t[i] = TRX_1F(f, 0);
-      }
+      NEXT_F2;
+      t[i] = TRX_1F(f, 0);
    }
 }
 #endif
@@ -132,13 +124,11 @@ static void DEST_4UB( GLubyte (*t)[4],
    (void) start;
    (void) first;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 if (SZ >= 1) TRX_UB(t[i][0], f, 0);
-	 if (SZ >= 2) TRX_UB(t[i][1], f, 1);
-	 if (SZ >= 3) TRX_UB(t[i][2], f, 2);
-	 if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
-      }
+      NEXT_F2;
+      if (SZ >= 1) TRX_UB(t[i][0], f, 0);
+      if (SZ >= 2) TRX_UB(t[i][1], f, 1);
+      if (SZ >= 3) TRX_UB(t[i][2], f, 2);
+      if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
    }
 }
 #endif
@@ -156,13 +146,11 @@ static void DEST_4US( GLushort (*t)[4],
    (void) start;
    (void) first;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 if (SZ >= 1) TRX_US(t[i][0], f, 0);
-	 if (SZ >= 2) TRX_US(t[i][1], f, 1);
-	 if (SZ >= 3) TRX_US(t[i][2], f, 2);
-	 if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535;
-      }
+      NEXT_F2;
+      if (SZ >= 1) TRX_US(t[i][0], f, 0);
+      if (SZ >= 2) TRX_US(t[i][1], f, 1);
+      if (SZ >= 3) TRX_US(t[i][2], f, 2);
+      if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535;
    }
 }
 #endif
@@ -180,10 +168,8 @@ static void DEST_1UB( GLubyte *t,
    (void) start;
    (void) first;
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	  TRX_UB(t[i], f, 0);
-      }
+      NEXT_F2;
+      TRX_UB(t[i], f, 0);
    }
 }
 #endif
@@ -202,10 +188,8 @@ static void DEST_1UI( GLuint *t,
    (void) first;
 
    for (i = DST_START ; i < n ; i++, NEXT_F) {
-      CHECK {
-         NEXT_F2;
-	 t[i] = TRX_UI(f, 0);
-      }
+      NEXT_F2;
+      t[i] = TRX_UI(f, 0);
    }
 }
 #endif
diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c
index 3a8ca74..a5bf5d7 100644
--- a/src/mesa/math/m_translate.c
+++ b/src/mesa/math/m_translate.c
@@ -84,10 +84,6 @@ typedef void (*trans_3fn_func)(GLfloat (*to)[3],
 #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1      /* 0xa + 1 */
 
 
-/* This macro is used on other systems, so undefine it for this module */
-
-#undef	CHECK
-
 static trans_1f_func  _math_trans_1f_tab[MAX_TYPES];
 static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES];
 static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES];
@@ -108,7 +104,6 @@ static trans_4f_func  _math_trans_4fn_tab[5][MAX_TYPES];
 #define STRIDE stride
 #define NEXT_F f += stride
 #define NEXT_F2
-#define CHECK
 
 
 
@@ -604,7 +599,6 @@ static void init_translate_raw(void)
 #undef CLASS
 #endif
 #undef ARGS
-#undef CHECK
 #undef SRC_START
 #undef DST_START
 #undef NEXT_F
-- 
2.0.5



More information about the mesa-dev mailing list