Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r145:e7243eb19cf3
Date: 2014-12-04 13:15 +0100
http://bitbucket.org/cffi/creflect/changeset/e7243eb19cf3/

Log:    Finding the closest integer type matching the size: move that logic
        out of creflect_debug_print.c, because it is generally useful

diff --git a/creflect/creflect.h b/creflect/creflect.h
--- a/creflect/creflect.h
+++ b/creflect/creflect.h
@@ -77,8 +77,16 @@
 #undef _CRX_SELF
 
 
-#define _CRX_INT_TYPE(cb, expr, guessname)                               \
-    _crx_int_type(cb, expr > 0, sizeof(expr), expr == 1, guessname)
+enum {
+    _crx_sc_char      = 1,
+    _crx_sc_short     = 2,
+    _crx_sc_int       = 3,
+    _crx_sc_long      = 4,
+    _crx_sc_long_long = 5,
+};
+
+#define _CRX_INT_TYPE(cb, expr, sizeclass)                              \
+    _crx_int_type(cb, expr > 0, sizeof(expr), expr == 1, sizeclass)
 
 #define _CRX_INT_CONST(cb, expr, vp, pn)                 \
     _crx_int_const(cb, vp, pn,                    \
@@ -102,14 +110,28 @@
 __attribute__((unused))
 static _crx_type_t *_crx_int_type(_crx_builder_t *cb, int expr_positive,
                                   size_t size_of_expr, int expr_equal_one,
-                                  const char *guessname)
+                                  int sizeclass)
 {
+    if (size_of_expr == 1 && expr_equal_one)
+        return cb->get_bool_type(cb);
+
+    static size_t all_sizes[] = { 0, sizeof(char), sizeof(short), sizeof(int),
+                                  sizeof(long), sizeof(long long), (size_t)-1 
};
+    while (all_sizes[sizeclass] != size_of_expr) {
+        if (all_sizes[sizeclass] > size_of_expr)
+            sizeclass--;
+        else
+            sizeclass++;
+    }
+    if (sizeclass < 1) sizeclass = 1;
+    if (sizeclass > 5) sizeclass = 5;
+
+    static const char *all_names[] = { NULL, "char", "short", "int",
+                                       "long", "long long" };
     if (!expr_positive)
-        return cb->get_signed_type(cb, size_of_expr, guessname);
-    else if (size_of_expr == 1 && expr_equal_one)
-        return cb->get_bool_type(cb);
+        return cb->get_signed_type(cb, size_of_expr, all_names[sizeclass]);
     else
-        return cb->get_unsigned_type(cb, size_of_expr, guessname);
+        return cb->get_unsigned_type(cb, size_of_expr, all_names[sizeclass]);
 }
 
 __attribute__((unused))
diff --git a/creflect/creflect_debug_print.c b/creflect/creflect_debug_print.c
--- a/creflect/creflect_debug_print.c
+++ b/creflect/creflect_debug_print.c
@@ -67,63 +67,52 @@
     return newtype("_Bool");
 }
 
+static void badsize(const char *g, size_t sz)
+{
+    printf("type '%s' has incorrect size specification: %zd\n", g, sz);
+    abort();
+}
+
 static _crx_type_t *tst_get_signed_type(_crx_builder_t *cb, size_t sz,
                                         const char *g)
 {
-    int skip = 0;
-    if (sizeof(long) == sizeof(long long))
-        if (strcmp(g, "long long") == 0)
-            skip = 4;
-    if (sizeof(int) == sizeof(long))
-        if (strcmp(g, "long") == 0 || strcmp(g, "long long") == 0)
-            skip = 3;
+#define TT(in_name, out_name)                           \
+    if (strcmp(g, #in_name) == 0) {                     \
+        if (sz != sizeof(out_name)) badsize(g, sz);     \
+        return newtype(#out_name);                      \
+    }
 
-#define TT(name)   if (--skip && sz == sizeof(name)) { return newtype(#name); }
-    TT(signed char);
-    TT(short);
-    TT(int);
-    TT(long);
-    TT(long long);
+    TT(char, signed char)
+    TT(short, short)
+    TT(int, int)
+    TT(long, long)
+    TT(long long, long long)
 
-    printf("cannot find signed type with %zd bytes\n", sz);
+    printf("cannot find signed type '%s'\n", g);
     abort();
 }
 
 static _crx_type_t *tst_get_unsigned_type(_crx_builder_t *cb, size_t sz,
                                           const char *g)
 {
-    int skip = 0;
-    if (sizeof(long) == sizeof(long long))
-        if (strcmp(g, "long long") == 0)
-            skip = 4;
-    if (sizeof(int) == sizeof(long))
-        if (strcmp(g, "long") == 0 || strcmp(g, "long long") == 0)
-            skip = 3;
+    TT(char, unsigned char)
+    TT(short, unsigned short)
+    TT(int, unsigned int)
+    TT(long, unsigned long)
+    TT(long long, unsigned long long)
 
-    TT(unsigned char);
-    TT(unsigned short);
-    TT(unsigned int);
-    TT(unsigned long);
-    TT(unsigned long long);
-
-    printf("cannot find unsigned type with %zd bytes\n", sz);
+    printf("cannot find unsigned type '%s'\n", g);
     abort();
 }
 
 static _crx_type_t *tst_get_float_type(_crx_builder_t *cb, size_t sz,
                                        const char *g)
 {
-    int skip = 0;
-    if (sizeof(double) == sizeof(long double))
-        if (strcmp(g, "long double") == 0)
-            skip = 2;
+    TT(float, float)
+    TT(double, double)
+    TT(long double, long double)
 
-    TT(float);
-    TT(double);
-    TT(long double);
-#undef TT
-
-    printf("cannot find float type with %zd bytes\n", sz);
+    printf("cannot find float type '%s'\n", g);
     abort();
 }
 
diff --git a/creflect/model.py b/creflect/model.py
--- a/creflect/model.py
+++ b/creflect/model.py
@@ -134,6 +134,17 @@
     def is_float_type(self):
         return self.ALL_PRIMITIVE_TYPES[self.name] == 'f'
 
+    def get_simplified_integer_type(self):
+        assert self.is_integer_type()
+        name = self.name
+        if name.startswith('unsigned '):
+            name = name[9:]
+        elif name.startswith('signed '):
+            name = name[7:]
+        if name == '_Bool':
+            name = 'char'
+        return name
+
     def inspect_type(self, block, inspect, qualifiers):
         if isinstance(inspect, TypeInspector):
             star_p1 = inspect.fetch_star_p1()
@@ -157,10 +168,9 @@
             if not (qualifiers & CRX_CONST):
                 block.writeline("%s = -1;%s" % (star_p1, comment3))
             if self.is_integer_type():
-                hint = self.name.split()
-                if hint[0] in ('signed', 'unsigned'):
-                    hint = hint[1:]
-                expr = '_CRX_INT_TYPE(cb, %s, "%s")' % (star_p1, " 
".join(hint))
+                hint = self.get_simplified_integer_type()
+                hint = hint.replace(' ', '_')
+                expr = '_CRX_INT_TYPE(cb, %s, _crx_sc_%s)' % (star_p1, hint)
             elif self.is_char_type():
                 errmsg = "numeric type '%s' is not a char" % (
                     inspect.get_comment_type(0, False),)
@@ -189,12 +199,16 @@
                                          inspect.varname,
                                          qualtype.get_c_name()))
                 block.writeline("(void)p1;")
-            if self.is_signed_type():
+            if self.name == '_Bool':
+                expr = 'cb->get_bool_type(cb)'
+            elif self.is_signed_type():
+                hint = self.get_simplified_integer_type()
                 expr = 'cb->get_signed_type(cb, sizeof(%s), "%s")' % (
-                    self.name, self.name)
+                    self.name, hint)
             elif self.is_unsigned_type():
+                hint = self.get_simplified_integer_type()
                 expr = 'cb->get_unsigned_type(cb, sizeof(%s), "%s")' % (
-                    self.name, self.name)
+                    self.name, hint)
             elif self.is_char_type():
                 expr = 'cb->get_char_type(cb)'
             elif self.is_float_type():
diff --git a/creflect/test/codegen/003.c b/creflect/test/codegen/003.c
--- a/creflect/test/codegen/003.c
+++ b/creflect/test/codegen/003.c
@@ -11,7 +11,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "int");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_int);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = int
     }
diff --git a/creflect/test/codegen/003b.c b/creflect/test/codegen/003b.c
--- a/creflect/test/codegen/003b.c
+++ b/creflect/test/codegen/003b.c
@@ -11,7 +11,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "long");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_long);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = long
     }
diff --git a/creflect/test/codegen/003c.c b/creflect/test/codegen/003c.c
--- a/creflect/test/codegen/003c.c
+++ b/creflect/test/codegen/003c.c
@@ -11,7 +11,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "long long");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_long_long);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = long long
     }
diff --git a/creflect/test/codegen/003d.c b/creflect/test/codegen/003d.c
--- a/creflect/test/codegen/003d.c
+++ b/creflect/test/codegen/003d.c
@@ -11,7 +11,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "char");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_char);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = signed char
     }
diff --git a/creflect/test/codegen/003f.c b/creflect/test/codegen/003f.c
--- a/creflect/test/codegen/003f.c
+++ b/creflect/test/codegen/003f.c
@@ -11,7 +11,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "long long");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_long_long);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = unsigned long long
     }
diff --git a/creflect/test/codegen/003h.c b/creflect/test/codegen/003h.c
--- a/creflect/test/codegen/003h.c
+++ b/creflect/test/codegen/003h.c
@@ -15,7 +15,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "long long");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_long_long);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = int
     }
diff --git a/creflect/test/codegen/003i.c b/creflect/test/codegen/003i.c
--- a/creflect/test/codegen/003i.c
+++ b/creflect/test/codegen/003i.c
@@ -11,7 +11,7 @@
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
         *p1 = -1;  /* check that 'num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, *p1, "char");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_char);
         cb->define_type(cb, "num_t", t1, 0);
 #expect TYPEDEF num_t = signed char
     }
diff --git a/creflect/test/codegen/004.c b/creflect/test/codegen/004.c
--- a/creflect/test/codegen/004.c
+++ b/creflect/test/codegen/004.c
@@ -13,7 +13,7 @@
         *p1 = (void *)b;    /* check that 'num_t' is a pointer type */
         (void)(**p1 << 1);  /* check that '*num_t' is an integer type */
         **p1 = -1;  /* check that '*num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, **p1, "int");
+        t1 = _CRX_INT_TYPE(cb, **p1, _crx_sc_int);
         t2 = cb->get_pointer_type(cb, t1, 0);
         cb->define_type(cb, "num_t", t2, 0);
 #expect TYPEDEF num_t = PTR int
diff --git a/creflect/test/codegen/004b.c b/creflect/test/codegen/004b.c
--- a/creflect/test/codegen/004b.c
+++ b/creflect/test/codegen/004b.c
@@ -15,7 +15,7 @@
         **p1 = (void *)b;    /* check that '*num_t' is a pointer type */
         (void)(***p1 << 1);  /* check that '**num_t' is an integer type */
         ***p1 = -1;  /* check that '**num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, ***p1, "int");
+        t1 = _CRX_INT_TYPE(cb, ***p1, _crx_sc_int);
         t2 = cb->get_pointer_type(cb, t1, 0);
         t3 = cb->get_pointer_type(cb, t2, 0);
         cb->define_type(cb, "num_t", t3, 0);
diff --git a/creflect/test/codegen/005.c b/creflect/test/codegen/005.c
--- a/creflect/test/codegen/005.c
+++ b/creflect/test/codegen/005.c
@@ -15,7 +15,7 @@
         }
         (void)(**p1 << 1);  /* check that 'foo_t[]' is an integer type */
         **p1 = -1;  /* check that 'foo_t[]' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, **p1, "int");
+        t1 = _CRX_INT_TYPE(cb, **p1, _crx_sc_int);
         t2 = cb->get_array_type(cb, t1, sizeof(*p1) / sizeof(**p1));
         cb->define_type(cb, "foo_t", t2, 0);
 #expect TYPEDEF foo_t = ARRAY[27] int
diff --git a/creflect/test/codegen/005b.c b/creflect/test/codegen/005b.c
--- a/creflect/test/codegen/005b.c
+++ b/creflect/test/codegen/005b.c
@@ -17,7 +17,7 @@
         **p1 = (void *)b;    /* check that 'foo_t[]' is a pointer type */
         (void)(***p1 << 1);  /* check that '*foo_t[]' is an integer type */
         ***p1 = -1;  /* check that '*foo_t[]' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, ***p1, "int");
+        t1 = _CRX_INT_TYPE(cb, ***p1, _crx_sc_int);
         t2 = cb->get_pointer_type(cb, t1, 0);
         t3 = cb->get_array_type(cb, t2, sizeof(*p1) / sizeof(**p1));
         cb->define_type(cb, "foo_t", t3, 0);
diff --git a/creflect/test/codegen/005c.c b/creflect/test/codegen/005c.c
--- a/creflect/test/codegen/005c.c
+++ b/creflect/test/codegen/005c.c
@@ -17,7 +17,7 @@
         }
         (void)(***p1 << 1);  /* check that '(*foo_t)[]' is an integer type */
         ***p1 = -1;  /* check that '(*foo_t)[]' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, ***p1, "int");
+        t1 = _CRX_INT_TYPE(cb, ***p1, _crx_sc_int);
         t2 = cb->get_array_type(cb, t1, sizeof(**p1) / sizeof(***p1));
         t3 = cb->get_pointer_type(cb, t2, 0);
         cb->define_type(cb, "foo_t", t3, 0);
diff --git a/creflect/test/codegen/005d.c b/creflect/test/codegen/005d.c
--- a/creflect/test/codegen/005d.c
+++ b/creflect/test/codegen/005d.c
@@ -37,7 +37,7 @@
         *********p1 = (void *)b;    /* check that '*(***foo_t[][])[][]' is a 
pointer type */
         (void)(**********p1 << 1);  /* check that '**(***foo_t[][])[][]' is an 
integer type */
         **********p1 = -1;  /* check that '**(***foo_t[][])[][]' is not 
declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, **********p1, "int");
+        t1 = _CRX_INT_TYPE(cb, **********p1, _crx_sc_int);
         t2 = cb->get_pointer_type(cb, t1, 0);
         t3 = cb->get_pointer_type(cb, t2, 0);
         t4 = cb->get_array_type(cb, t3, sizeof(*******p1) / 
sizeof(********p1));
diff --git a/creflect/test/codegen/006.c b/creflect/test/codegen/006.c
--- a/creflect/test/codegen/006.c
+++ b/creflect/test/codegen/006.c
@@ -11,7 +11,7 @@
         memset(b, -1, sizeof(b));
         p1 = (void *)b;
         (void)(*p1 << 1);  /* check that 'num_t' is an integer type */
-        t1 = _CRX_INT_TYPE(cb, *p1, "int");
+        t1 = _CRX_INT_TYPE(cb, *p1, _crx_sc_int);
         cb->define_type(cb, "num_t", t1, _CRX_CONST);
 #expect TYPEDEF num_t = CONST unsigned int
     }
diff --git a/creflect/test/codegen/006b.c b/creflect/test/codegen/006b.c
--- a/creflect/test/codegen/006b.c
+++ b/creflect/test/codegen/006b.c
@@ -17,7 +17,7 @@
         }
         (void)(**p1 << 1);  /* check that '*num_t' is an integer type */
         **p1 = -1;  /* check that '*num_t' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, **p1, "int");
+        t1 = _CRX_INT_TYPE(cb, **p1, _crx_sc_int);
         t2 = cb->get_pointer_type(cb, t1, 0);
         cb->define_type(cb, "num_t", t2, _CRX_CONST);
 #expect TYPEDEF num_t = CONST PTR int
diff --git a/creflect/test/codegen/006c.c b/creflect/test/codegen/006c.c
--- a/creflect/test/codegen/006c.c
+++ b/creflect/test/codegen/006c.c
@@ -21,7 +21,7 @@
         }
         (void)(***p1 << 1);  /* check that '(*foo_t)[]' is an integer type */
         ***p1 = -1;  /* check that '(*foo_t)[]' is not declared 'const' */
-        t1 = _CRX_INT_TYPE(cb, ***p1, "int");
+        t1 = _CRX_INT_TYPE(cb, ***p1, _crx_sc_int);
         t2 = cb->get_array_type(cb, t1, sizeof(**p1) / sizeof(***p1));
         t3 = cb->get_pointer_type(cb, t2, 0);
         cb->define_type(cb, "foo_t", t3, _CRX_CONST);
diff --git a/creflect/test/codegen/func-001b.c 
b/creflect/test/codegen/func-001b.c
--- a/creflect/test/codegen/func-001b.c
+++ b/creflect/test/codegen/func-001b.c
@@ -41,7 +41,7 @@
     _crx_qual_type a2[2];
     _crx_qual_type a3[2];
     {
-        t1 = cb->get_unsigned_type(cb, sizeof(unsigned int), "unsigned int");
+        t1 = cb->get_unsigned_type(cb, sizeof(unsigned int), "int");
         t2 = cb->get_signed_type(cb, sizeof(long), "long");
         a1[0].type = t2;
         a1[0].qualifiers = 0;
diff --git a/creflect/test/codegen/struct-001.c 
b/creflect/test/codegen/struct-001.c
--- a/creflect/test/codegen/struct-001.c
+++ b/creflect/test/codegen/struct-001.c
@@ -17,7 +17,7 @@
         p1 = (void *)(((char *)b) - o);
         (void)(p1->aa << 1);  /* check that 'struct foo_s::aa' is an integer 
type */
         p1->aa = -1;  /* check that 'struct foo_s::aa' is not declared 'const' 
*/
-        t2 = _CRX_INT_TYPE(cb, p1->aa, "int");
+        t2 = _CRX_INT_TYPE(cb, p1->aa, _crx_sc_int);
         d1[0].name = "aa";
         d1[0].type = t2;
         d1[0].qualifiers = 0;
@@ -32,7 +32,7 @@
         p1 = (void *)(((char *)b) - o);
         (void)(p1->bb << 1);  /* check that 'struct foo_s::bb' is an integer 
type */
         p1->bb = -1;  /* check that 'struct foo_s::bb' is not declared 'const' 
*/
-        t3 = _CRX_INT_TYPE(cb, p1->bb, "int");
+        t3 = _CRX_INT_TYPE(cb, p1->bb, _crx_sc_int);
         d1[1].name = "bb";
         d1[1].type = t3;
         d1[1].qualifiers = 0;
diff --git a/creflect/test/codegen/struct-001b.c 
b/creflect/test/codegen/struct-001b.c
--- a/creflect/test/codegen/struct-001b.c
+++ b/creflect/test/codegen/struct-001b.c
@@ -16,7 +16,7 @@
         memset(b, -1, sizeof(b));
         p1 = (void *)(((char *)b) - o);
         (void)(p1->aa << 1);  /* check that 'struct foo_s::aa' is an integer 
type */
-        t2 = _CRX_INT_TYPE(cb, p1->aa, "int");
+        t2 = _CRX_INT_TYPE(cb, p1->aa, _crx_sc_int);
         d1[0].name = "aa";
         d1[0].type = t2;
         d1[0].qualifiers = _CRX_CONST;
diff --git a/creflect/test/codegen/struct-003.c 
b/creflect/test/codegen/struct-003.c
--- a/creflect/test/codegen/struct-003.c
+++ b/creflect/test/codegen/struct-003.c
@@ -18,7 +18,7 @@
         p1->aa = (void *)b;    /* check that 'struct foo_s::aa' is a pointer 
type */
         (void)(*p1->aa << 1);  /* check that '*struct foo_s::aa' is an integer 
type */
         *p1->aa = -1;  /* check that '*struct foo_s::aa' is not declared 
'const' */
-        t2 = _CRX_INT_TYPE(cb, *p1->aa, "int");
+        t2 = _CRX_INT_TYPE(cb, *p1->aa, _crx_sc_int);
         t3 = cb->get_pointer_type(cb, t2, 0);
         d1[0].name = "aa";
         d1[0].type = t3;
diff --git a/creflect/test/codegen/struct-004.c 
b/creflect/test/codegen/struct-004.c
--- a/creflect/test/codegen/struct-004.c
+++ b/creflect/test/codegen/struct-004.c
@@ -20,7 +20,7 @@
         }
         (void)(*p1->aa << 1);  /* check that 'struct foo_s::aa[]' is an 
integer type */
         *p1->aa = -1;  /* check that 'struct foo_s::aa[]' is not declared 
'const' */
-        t2 = _CRX_INT_TYPE(cb, *p1->aa, "int");
+        t2 = _CRX_INT_TYPE(cb, *p1->aa, _crx_sc_int);
         t3 = cb->get_array_type(cb, t2, sizeof(p1->aa) / sizeof(*p1->aa));
         d1[0].name = "aa";
         d1[0].type = t3;
diff --git a/creflect/test/codegen/struct-005.c 
b/creflect/test/codegen/struct-005.c
--- a/creflect/test/codegen/struct-005.c
+++ b/creflect/test/codegen/struct-005.c
@@ -14,7 +14,7 @@
         p1 = (void *)(((char *)b) - o);
         (void)(p1->aa << 1);  /* check that 'foo_t::aa' is an integer type */
         p1->aa = -1;  /* check that 'foo_t::aa' is not declared 'const' */
-        t2 = _CRX_INT_TYPE(cb, p1->aa, "int");
+        t2 = _CRX_INT_TYPE(cb, p1->aa, _crx_sc_int);
         d1[0].name = "aa";
         d1[0].type = t2;
         d1[0].qualifiers = 0;
diff --git a/creflect/test/codegen/struct-005b.c 
b/creflect/test/codegen/struct-005b.c
--- a/creflect/test/codegen/struct-005b.c
+++ b/creflect/test/codegen/struct-005b.c
@@ -14,7 +14,7 @@
         p1 = (void *)(((char *)b) - o);
         (void)(p1->aa << 1);  /* check that '*foo_p::aa' is an integer type */
         p1->aa = -1;  /* check that '*foo_p::aa' is not declared 'const' */
-        t2 = _CRX_INT_TYPE(cb, p1->aa, "int");
+        t2 = _CRX_INT_TYPE(cb, p1->aa, _crx_sc_int);
         d1[0].name = "aa";
         d1[0].type = t2;
         d1[0].qualifiers = 0;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to