Merge branch '2.4.x'
[catacomb] / symm / blkc.h
index d6e3da0..e083752 100644 (file)
 
 #define BLKC_SHOW(PRE, tag, w) do {                                    \
   fputs(tag ": ", stdout);                                             \
-  BLKC_SKEL_X(PRE, BLKC_W(w);, printf("%08x ", *_w++););               \
+  BLKC_SKEL_X(PRE, const BLKC_W(w);, printf("%08x ", *_w++););         \
   fputc('\n', stdout);                                                 \
 } while (0)
 
   unsigned _i; BLKC_W(w); unsigned long _x = x;                                \
   for (_i = 0; _i < PRE##_BLKSZ / 4; _i++) {                           \
     *_w++ = U32(_x);                                                   \
-    _x = ((_x & ~MASK32) >> 16) >> 16;                                 \
+    _x = ((_x & ~(unsigned long)MASK32) >> 16) >> 16;                  \
   }                                                                    \
 } while (0)
 
   unsigned _i; BLKC_W(w); unsigned long _x = x;        _w += PRE##_BLKSZ / 4;  \
   for (_i = 0; _i < PRE##_BLKSZ / 4; _i++) {                           \
     *--_w = U32(_x);                                                   \
-    _x = ((_x & ~MASK32) >> 16) >> 16;                                 \
+    _x = ((_x & ~(unsigned long)MASK32) >> 16) >> 16;                  \
   }                                                                    \
 } while (0)
 
 #include <mLib/quis.h>
 #include <mLib/testrig.h>
 
-#define BLKC_VERIFY(PRE, pre)                                          \
+#define BLKC_VERIFY(PRE, pre) BLKC_VERIFYX(PRE, pre, #pre)
+
+#define BLKC_VERIFYX(PRE, pre, name)                                   \
                                                                        \
 static int pre##_verify(dstr *v)                                       \
 {                                                                      \
@@ -316,26 +318,32 @@ static int pre##_verify(dstr *v)                                  \
   return (ok);                                                         \
 }
 
-#define BLKC_TEST(PRE, pre)                                            \
+#define BLKC_TESTDEFS(PRE, pre) BLKC_TESTDEFSX(PRE, pre, #pre)
+
+#define BLKC_TESTDEFSX(PRE, pre, name)                                 \
+  { name, pre##_verify, { &type_hex, &type_hex, &type_hex, 0 } },
+
+#define BLKC_TESTX(PRE, pre, name, fname)                              \
                                                                        \
-BLKC_VERIFY(PRE, pre)                                                  \
+BLKC_VERIFYX(PRE, pre, name)                                           \
                                                                        \
 static const test_chunk defs[] = {                                     \
-  { #pre, pre##_verify, { &type_hex, &type_hex, &type_hex, 0 } },      \
+  BLKC_TESTDEFSX(PRE, pre, name)                                       \
   { 0, 0, { 0 } }                                                      \
 };                                                                     \
                                                                        \
 int main(int argc, char *argv[])                                       \
 {                                                                      \
-  test_run(argc, argv, defs, SRCDIR"/t/" #pre);                                \
+  test_run(argc, argv, defs, SRCDIR"/t/" fname);                       \
   return (0);                                                          \
 }
 
 #else
-#  define BLKC_VERIFY(PRE, pre)
-#  define BLKC_TEST(PRE, pre)
+#  define BLKC_TESTX(PRE, pre, name, fname)
 #endif
 
+#define BLKC_TEST(PRE, pre) BLKC_TESTX(PRE, pre, #pre, #pre)
+
 /*----- That's all, folks -------------------------------------------------*/
 
 #ifdef __cplusplus