[pypy-svn] r72831 - in pypy/branch/fix-64/pypy/translator/c: . test

arigo at codespeak.net arigo at codespeak.net
Thu Mar 25 17:56:36 CET 2010


Author: arigo
Date: Thu Mar 25 17:56:35 2010
New Revision: 72831

Modified:
   pypy/branch/fix-64/pypy/translator/c/node.py
   pypy/branch/fix-64/pypy/translator/c/test/test_lltyped.py
Log:
Fix test_padding_in_prebuilt_struct() in genc.


Modified: pypy/branch/fix-64/pypy/translator/c/node.py
==============================================================================
--- pypy/branch/fix-64/pypy/translator/c/node.py	(original)
+++ pypy/branch/fix-64/pypy/translator/c/node.py	Thu Mar 25 17:56:35 2010
@@ -571,7 +571,19 @@
         if hasattr(self.T, "_hints") and self.T._hints.get('union'):
             data = data[0:1]
 
+        if 'get_padding_drop' in self.T._hints:
+            d = {}
+            for name, _ in data:
+                T = defnode.c_struct_field_type(name)
+                typename = self.db.gettype(T)
+                d[name] = cdecl(typename, '')
+            padding_drop = self.T._hints['get_padding_drop'](d)
+        else:
+            padding_drop = []
+
         for name, value in data:
+            if name in padding_drop:
+                continue
             c_expr = defnode.access_expr(self.name, name)
             lines = generic_initializationexpr(self.db, value, c_expr,
                                                decoration + name)

Modified: pypy/branch/fix-64/pypy/translator/c/test/test_lltyped.py
==============================================================================
--- pypy/branch/fix-64/pypy/translator/c/test/test_lltyped.py	(original)
+++ pypy/branch/fix-64/pypy/translator/c/test/test_lltyped.py	Thu Mar 25 17:56:35 2010
@@ -804,6 +804,7 @@
                                            ("s1", Signed),
                                            ("l3", Signed)])
         S = rffi_platform.configure(CConfig)['STRUCT']
+        assert 'get_padding_drop' in S._hints
         s1 = malloc(S, immortal=True)
         s1.c_c1 = rffi.cast(S.c_c1, -12)
         s1.c_s1 = rffi.cast(S.c_s1, -7843)



More information about the Pypy-commit mailing list