Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r82:a20d5500a35a
Date: 2014-11-18 19:10 +0100
http://bitbucket.org/cffi/creflect/changeset/a20d5500a35a/

Log:    next test

diff --git a/test/codegen/struct-002.c b/test/codegen/struct-002.c
--- a/test/codegen/struct-002.c
+++ b/test/codegen/struct-002.c
@@ -4,20 +4,28 @@
 
 # ____________________________________________________________
 
-int teststruct_002(char *r)
+void teststruct_002(crx_builder_t *cb)
 {
-    if (!r)
-        return 100;
-    r += sprintf(r, "struct foo_s /*%lld,%lld*/{\n", (long long)sizeof(struct 
foo_s), (long long)(((char *)&((struct{char a; struct foo_s b;} *)0)->b) - 
(char *)0));
+    crx_type_t *t1, *t2, *t3;
+    crx_field_t d1[1];
+    t1 = cb->get_struct_type(cb, "foo_s");
     {
         struct foo_s *p1;
-        long long o = ((char *)&((struct foo_s *)0)->aa) - (char *)0;  /* 
check that 'struct foo_s::aa' is not an array */
-        char b[sizeof(p1->aa)];
-        r += sprintf(r, "  /*%lld*/", o);
-        p1 = (void *)(((char *)b) - o);
+        size_t o = ((char *)&((struct foo_s *)0)->aa) - (char *)0;  /* check 
that 'struct foo_s::aa' is not an array */
+        char *p2;
+        p1 = (void *)(((char *)&p2) - o);
         p1->aa = (void *)0;    /* check that 'struct foo_s::aa' is a pointer 
type */
-        r += sprintf(r, "void *aa;\n");
+        t2 = cb->get_void_type(cb);
+        t3 = cb->get_pointer_type(cb, t2);
+        d1[0].name = "aa";
+        d1[0].type = t3;
+        d1[0].offset = o;
+        d1[0].numbits = -1;
+        d1[0].bitshift = -1;
     }
-    r += sprintf(r, "};\n");
-    return 0;
+    cb->complete(cb, t1, sizeof(struct foo_s),
+                 ((char *)&((struct{char a; struct foo_s b;} *)0)->b) - (char 
*)0,
+                 d1, 1);
+#expect STRUCT foo_s:
+#expect | aa: PTR void
 }
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to